I'm using python inbulit boston dataset from sklearn with CHAS as my target variable.
I built Logistic Regression model from sklearn pkg.I'm using regressors library to get the summary statistics of the model output but i'm facing the following error. pleasee help me on this and kindly let me know if you need further information
find more about regressors library in below link: [1]: https://regressors.readthedocs.io/en/latest/usage.html
Please find the below python code which i used for model building:
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)
I'm getting the following error:
ValueErrorTraceback (most recent call last)
in ()
1 #xlabels = boston.feature_names[which_betas]
----> 2 stats.summary(model, X, y ,xlabels=None)
251 )
252 coef_df['Estimate'] = np.concatenate(
--> 253 (np.round(np.array([clf.intercept_]), 6), np.round((clf.coef_), 6)))
254 coef_df['Std. Error'] = np.round(coef_se(clf, X, y), 6)
255 coef_df['t value'] = np.round(coef_tval(clf, X, y), 4)
ValueError: all the input array dimensions except for the concatenation axis must match exactly
ValueError: all the input array dimensions except for the concatenation axis must match exactly
There are other posts which has the similar error but those solution didn't help my problem.The attached above link has the information about how the summary function actually works.kindly let me know if you need further information.