Scikit学习中的R2值是如何计算的?

编程入门 行业动态 更新时间:2024-10-10 19:24:04
本文介绍了Scikit学习中的R2值是如何计算的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

scikit learn (metrics.r2_score()) 返回的 R^2 值可以为负数.文档 说:

The R^2 value returned by scikit learn (metrics.r2_score()) can be negative. The docs say:

"与大多数其他分数不同,R² 分数可能为负(不需要实际上是数量 R 的平方)."

"Unlike most other scores, R² score may be negative (it need not actually be the square of a quantity R)."

然而,关于 R^2 的 维基百科文章没有提到 R(非平方)数量.也许它使用绝对差异而不是平方差异.我真的不知道

However the wikipedia article on R^2 mentions no R (not squared) quantity. Perhaps it uses absolute differences instead of square differences. I really have no idea

推荐答案

scikit learn中的R^2与关于确定系数的维基百科文章(grep 表示最一般的定义").它是1 - 残差平方和/总平方和.

The R^2 in scikit learn is essentially the same as what is described in the wikipedia article on the coefficient of determination (grep for "the most general definition"). It is 1 - residual sum of square / total sum of squares.

经典统计数据设置与您通常尝试使用机器学习所做的事情之间的最大区别在于,在机器学习中,您会根据未见过的数据评估您的分数,这可能会导致 [0,1]<之外的结果/代码>.如果您将 R^2 应用于用于拟合模型的相同数据,它将位于 [0, 1]

The big difference between a classical stats setting and what you usually try to do with machine learning, is that in machine learning you evaluate your score on unseen data, which can lead to results outside [0,1]. If you apply R^2 to the same data you used to fit your model, it will lie within [0, 1]

另见这个非常类似问题

这篇关于Scikit学习中的R2值是如何计算的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-03-31 22:32:51,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Scikit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!