1 year ago
#342191
leskovecg
UserWarning: One or more of the test scores are non-finite
I'm a relatively new user to python and have question about warning. I have dataframe that has shape of (96350, 156). With that I am building my decison tree model and using grid search cross validation. Why I am getting that output and how can I solve it?
Input:
grid_param = {
'criterion': ['squared_error', 'friedman_mse', 'absolute_error'],
'splitter': ['best', 'random'],
'min_samples_split': [2, 3],
'max_features': ['auto', 'sqrt', 'log2']
}
gd_sr = GridSearchCV(estimator = DtReg,
param_grid = grid_param,
scoring = 'accuracy',
cv = 5,
n_jobs = -1)
DtReg = gd_sr.fit(X_train, y_train)
plt.figure(figsize = (20, 10))
plot_tree(DtReg.best_estimator_, filled=True, rounded=True)
Output:
UserWarning: One or more of the test scores are non-finite: [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan]
python
pandas
dataframe
cross-validation
grid-search
0 Answers
Your Answer