amueller / introduction_to_ml_with_python

Notebooks and code for the book "Introduction to Machine Learning with Python"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in plot_cross_val_selection method

karitonov opened this issue · comments

plot_grid_search.py

line 20:
results = pd.DataFrame(grid_search.cv_results_)[15:]
line 37-38:
plt.xticks(range(len(results)), [str(x).strip("{}").replace("'", "") for x
in grid_search.cv_results_['params']],

In line 37-38, an error occurs because the length of results and grid_search.cv_results_['params']] does not match.

Therefore, the line number 20 is corrected as follows.

results = pd.DataFrame(grid_search.cv_results_)#[15:] comment out

And then, add the following rows to some suitable places (For example, after the 41st line.).

plt.xlim(14.5, 36)

Thank you for your cooperation.

#156 (comment)

This issue is almost the same as above.

#156 (comment)

The above method is better, so I will withdraw.