Skip to content

Instantly share code, notes, and snippets.

@ken333135
Created June 19, 2018 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ken333135/c77bd305c673b1528ddf8ac53bf3d2d2 to your computer and use it in GitHub Desktop.
Save ken333135/c77bd305c673b1528ddf8ac53bf3d2d2 to your computer and use it in GitHub Desktop.
Get Top words for each class (multi-class text classification)
#Gets the Tfidf Score of each document in the corpus, and formats it into a Pandas Dataframe
vect_data = pd.DataFrame(list(vect_uncommon.transform(uncommon_df['Fault Desc_Rect']).toarray()))
#Appends a new column containing the label of your data to the DataFrame
vect_data['Fault Code'] = list(data_df['Your_Label'])
vect_data.shape
vect_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment