I have built a logistic regression model using Python anaconda and was surprised to see that the number of model coefficients turned out to be proportional to the training sample size i.e.
My training data is:
print('Training data is type %s and shape %s' % (type(os_X_train), os_X_train.shape))
Training data is type <class 'pandas.core.frame.DataFrame'> and shape (174146, 11)
Then the model is:
logreg = LogisticRegression(penalty='l2',solver='lbfgs',max_iter=1000) model = make_pipeline(preprocess, logreg) model.fit(os_X_train, os_y_train) print(logreg.coef_.shape) print("Model coefficients: ", logreg.intercept_, logreg.coef_)
(1, 153024) Model coefficients: [12.02830778] [[ 0.42926969 0.14192505 -1.89354062 ... 0.008847 0.00884372 -8.15123962]]
To my understanding the number of model coefficients should be the number of columns for the predictor variables or features plus one the intercept, or?