jakevdp / PythonDataScienceHandbook

Python Data Science Handbook: full text in Jupyter Notebooks
http://jakevdp.github.io/PythonDataScienceHandbook
MIT License
42.77k stars 17.83k forks source link

Errors in 05.14-Image-Features #245

Open Erotemic opened 4 years ago

Erotemic commented 4 years ago

In https://github.com/jakevdp/PythonDataScienceHandbook/blob/master/notebooks/05.14-Image-Features.ipynb

visualise keyword doesn't exist

hog_vec, hog_vis = feature.hog(image, visualise=True) 

does not seem to work: TypeError: hog() got an unexpected keyword argument 'visualise'.

It looks like the visualise is spelled incorrectly or the api changed. The following line does work:

hog_vec, hog_vis = feature.hog(image, visualize=True) 

sklearn.cross_validation doesn't exist anymore

Also from sklearn.cross_validation import cross_val_score should change to from sklearn.model_selection import import cross_val_score

sklearn.grid_search doesn't exist anymore

Should change from sklearn.grid_search import GridSearchCV to from sklearn.model_selection import GridSearchCV

also

Note, that in the grid search, I get a lot of Liblinear failed to converge, increase warnings, which may indicate that default hyperparams have changed. The best C returned as 1.0 for me instead of 4.0 as noted in the notebook. Not sure if this is an issue, the finalized model does work on the astronaut image.