rasbt/python-machine-learning-book-2nd-edition

Typoe Ch4 - Page 136

mzakariaCERN opened this issue · 1 comments

indices = np.argsort(importances[::-1]) # this causes the wrong order for plt.show() at the end of the code chunk (though the values are correct)
indices = importances.argsort()[::-1] # gives correct order

in the remote chance that this was a legit issue, It would be a privilege to be mentioned!

rasbt commented

Thanks for the note! In my version, it's not

indices = np.argsort(importances[::-1])

but

indices = np.argsort(importances)[::-1]

which would be similar to what you suggested with indices = importances.argsort()[::-1]

When I remember correctly, Packt had briefly an unedited version online in ~2017 that contained that issue, but it should be fixed now.

Screen Shot 2019-06-14 at 6 20 04 AM