Jun-30-2018, 01:47 AM
Hi Everyone,
I am trying to print coefficients for my logistic regression model so I can get the scores for each variable input to see how predictive they are. Does anyone know how to print the coefficients with their input column (or variable) names?
coef = np.array(final_predictions.coef_)
print(coef)
Traceback (most recent call last):
File "<ipython-input-25-f79449f13b02>", line 1, in <module>
coef = np.array(final_predictions.coef_)
AttributeError: 'numpy.ndarray' object has no attribute 'coef_'
I am trying to print coefficients for my logistic regression model so I can get the scores for each variable input to see how predictive they are. Does anyone know how to print the coefficients with their input column (or variable) names?
final_model = grid_search.best_estimator_ X_test = test_set.drop("default.payment.next.month", axis=1) y_test = test_set["default.payment.next.month"].copy() X_test_prepared = cred_pipeline.transform(X_test) final_predictions = final_model.predict(X_test_prepared) final_mse = mean_squared_error(y_test, final_predictions) final_rmse = np.sqrt(final_mse) display_scores(final_rmse) coef = np.array(final_predictions.coef_) print(coef)my error
coef = np.array(final_predictions.coef_)
print(coef)
Traceback (most recent call last):
File "<ipython-input-25-f79449f13b02>", line 1, in <module>
coef = np.array(final_predictions.coef_)
AttributeError: 'numpy.ndarray' object has no attribute 'coef_'