'exhaustive search feature selection for regression model using root mean square error as a paraemter
from sklearn.linear_model import LinearRegression
from mlxtend.feature_selection import ExhaustiveFeatureSelector as EFS
from sklearn.metrics import mean_squared_error
lr = LinearRegression()
efs = EFS(lr,
min_features=1,
max_features=1,
scoring='neg_mean_squared_error',
cv=5)
efs.fit(X_train1,y_train1)
print('Best MSE score: %.2f' % efs.best_score_*(-1) )
print('Best subset:', efs.best_idx_)
print('Best subset (corresponding names):', efs.best_feature_names_)
I can't print the mean square error in output. how can I print/show the mean sqaure error or use root mean square error as a scoring parameter?
Solution 1:[1]
Print score on testing samples
print(efs.score(x_test, y_test))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | pyaj |
