Python回归函数库摘要函数返回Logistic回归的ValueError

2024-09-30 12:23:15 发布

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

我使用的是sklearn的python inbulit boston数据集,CHAS是我的目标变量。在

我从sklearnpkg构建了Logistic回归模型,我使用回归函数库来获得模型输出的汇总统计信息,但是我面临以下错误。请在这方面帮助我,如果你需要进一步的信息,请告诉我

在下面的链接中查找有关回归函数库的更多信息:[1]: https://regressors.readthedocs.io/en/latest/usage.html

下面是我用来建模的python代码:

import numpy as np
from sklearn import datasets
import pandas as pd

bostonn = datasets.load_boston()
boston = pd.DataFrame(bostonn.data , columns= bostonn['feature_names'])
print(boston.head())

X = boston.drop('CHAS' , axis =1)
y = boston.CHAS.astype('category')

from sklearn.linear_model import LogisticRegression
from regressors import stats
log_mod=LogisticRegression(random_state=123)
model=log_mod.fit(X,y)

stats.summary(model, X, y , xlabels=None)

我得到以下错误:

^{pr2}$

ValueError: all the input array dimensions except for the concatenation axis must match exactly

也有其他帖子有类似的错误,但这些解决方案没有帮助 我的问题。那个附加的上面的链接有关于如何总结实际功能的信息很好,很好如果你需要进一步的信息,请告诉我。在


Tags: from模型import信息model链接as错误

热门问题