交叉验证得分为0

2024-04-26 03:08:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我是新来的数据分析,所以请原谅,如果这是一个新手问题。我在同一个数据上运行一个PLS回归,其中X由序数变量组成,y是一个指示事件是否发生的二进制变量。我生成了一些交叉验证分数,得到以下结果:

X = threat.iloc[:,2:96]
y = threat.iloc[:,1]

pls1 = PLSRegression(n_components=10)
result = pls1.fit_transform(X, y)

scoresT = cross_val_score(pls1, X, y, cv=5)
print(scoresT)

[ 0.          0.          0.          0.55965802  0.        ]

我知道每个数字代表每个“折”的分数,但我期望得到一系列的数字,比如[0.2,0.4,0.6,0.7,0.3],而不是[0,0,0,0.5,0],所以我不确定这到底是在说什么关于我的数据或模型。在

有人有什么见解吗?在


Tags: 数据二进制事件components数字交叉分数新手
1条回答
网友
1楼 · 发布于 2024-04-26 03:08:35

如果未指定交叉值得分中的“评分”参数,则返回估计器的默认评分方法。对于plsreression(就像sklearn中的所有回归模型一样,score method

Returns the coefficient of determination R^2 of the prediction.

The coefficient R^2 is defined as (1 - u/v), where u is the residual sum of squares ((y_true - y_pred) ** 2).sum() and v is the total sum of squares ((y_true - y_true.mean()) ** 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.

你得到的结果并不比固定的模型交叉验证分数好,这可能是因为你在使用回归模型来解决分类问题。请尝试使用分类模型。在

相关问题 更多 >