在R的tidymodels中,如何设置评估逻辑模型的默认水平?

huangapple go评论96阅读模式
英文:

In R tidymodels how do I set the default level for evaluating a logistic model

问题

我想告诉 yardstick,我的逻辑模型的默认级别是第二级。我知道我可以使用 event_level = "second" 指定单独的统计数据,但我更喜欢使用全局选项来设置事件级别。当我尝试时似乎不起作用。

  1. library(tidymodels)
  2. data("two_class_example")
  3. sens(two_class_example, truth, predicted, event_level = "second")
  4. #> # A tibble: 1 × 3
  5. #> .metric .estimator .estimate
  6. #> <chr> <chr> <dbl>
  7. #> 1 sens binary 0.793
  8. options(yardstick.event_level = "second")
  9. sens(two_class_example, truth, predicted)
  10. #> # A tibble: 1 × 3
  11. #> .metric .estimator .estimate
  12. #> <chr> <chr> <dbl>
  13. #> 1 sens binary 0.880

创建于2023年07月17日,使用 reprex v2.0.2

这是一个错误吗,还是我做错了什么?

英文:

I would like to tell yardstick that the default level for my logistic model is the second level. I know I can specify individual statistics with event_level = &quot;second&quot; but I would prefer to set the event_level with a global option. When I try it does not seem to work.

  1. library(tidymodels)
  2. data(&quot;two_class_example&quot;)
  3. sens(two_class_example, truth, predicted, event_level = &quot;second&quot;)
  4. #&gt; # A tibble: 1 &#215; 3
  5. #&gt; .metric .estimator .estimate
  6. #&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt;
  7. #&gt; 1 sens binary 0.793
  8. options(yardstick.event_level = &quot;second&quot;)
  9. sens(two_class_example, truth, predicted)
  10. #&gt; # A tibble: 1 &#215; 3
  11. #&gt; .metric .estimator .estimate
  12. #&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt;
  13. #&gt; 1 sens binary 0.880

<sup>Created on 2023-07-17 with reprex v2.0.2</sup>

Is this a bug or am I doing something wrong?

答案1

得分: 1

在2020年07月13日,我们取消了全局选项。在当前版本(1.2.0)中,设置此选项将会产生一个警告,但不会产生任何效果。

英文:

On 2020-07-13 we moved away from the global option. In the current version (1.2.0), setting this option will now produce an warning, but won’t have any effect.

huangapple
  • 本文由 发表于 2023年7月18日 01:34:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76706860.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定