Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

feature importance naive bayes python

neg_class_prob_sorted = NB_optimal.feature_log_prob_[0, :].argsort()[::-1]
pos_class_prob_sorted = NB_optimal.feature_log_prob_[1, :].argsort()[::-1]

print(np.take(count_vect.get_feature_names(), neg_class_prob_sorted[:10]))
print(np.take(count_vect.get_feature_names(), pos_class_prob_sorted[:10]))
Comment

PREVIOUS NEXT
Code Example
Python :: how to remove a tuple from a list python 
Python :: remove ,drop,effacer, dataframe,python 
Python :: heroku python buildpack 
Python :: pandas to dictionary 
Python :: python foreach list 
Python :: SystemError: tile cannot extend outside image 
Python :: maxsize in python 
Python :: concatenate python 
Python :: heatmap of pandas dataframe with seaborn 
Python :: distance between numpy arrays 
Python :: kivy change window size 
Python :: import csrf_exempt django 
Python :: add one row to dataframe 
Python :: string to list python 
Python :: initialise a 2d array python 
Python :: Display max number of columns pandas 
Python :: gematria python 
Python :: takes 1 positional argument but 2 were given python 
Python :: python one line if statement no else 
Python :: numpy array with 2 times each value 
Python :: python extract specific keys from dictionary 
Python :: access row of dataframe 
Python :: python substring in string 
Python :: python how to draw triangle 
Python :: how to get confusion matrix in python 
Python :: how to get the value out of a dictionary python3 
Python :: how to map longitude and latitude in python 
Python :: python count occurrences of an item in a list 
Python :: np.zeros((3,3)) 
Python :: run for loop inside pdb 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =