如何使用 scikit-learn 计算调整后的 R 平方分数? [英] How do I calculate the Adjusted R-squared score using scikit-learn?

查看:59
本文介绍了如何使用 scikit-learn 计算调整后的 R 平方分数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在使用

其中 n 是样本中的观察数,p 是模型中的自变量数

I'm already using the r2_score function but don't understand how I can get the "adjusted" R^2 score from this. The description at this page doesn't mention it - maybe it's the adjusted score by default?

解决方案

Adjusted R2 requires number of independent variables as well. That's why it will not be calculated using such an independent metrics function (as we are not providing, how ypred was calculated).

However you can calculate the adjusted R2 from R2 with a simple formula given here

where n is number of observations in sample and p is number of independent variables in model

这篇关于如何使用 scikit-learn 计算调整后的 R 平方分数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆