Ed Norton
Ed Norton
Sep 6, 2018 · 1 min read

Hello, this line breaks for me:

plt.xticks(np.arange(1, 1 + 2 * top_features), feature_names[top_coefficients], rotation=60, ha=’right’)

The error is: index 4474914 is out of bounds for axis 1 with size 6562

I believe you are indexing feature_names with the values of top_coefficients which is not the same as the index of the top coefficients in the coef array. Unless I’m missing something?

Did anybody else get this to work?

    Ed Norton

    Written by

    Ed Norton