Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Feature importance Decision Tree

# Plot importance of variables
feature_importance = model.feature_importances_ 
sorted_idx = np.argsort(feature_importance) # Sort index on feature importance
fig = plt.figure(figsize=(20, 15)) # Set plot size (denoted in inches)
plt.barh(range(len(sorted_idx)), feature_importance[sorted_idx], align='center')
plt.yticks(range(len(sorted_idx)), np.array(X_test.columns)[sorted_idx])

plt.xlabel("Feature importance") # Add x axis
plt.ylabel("Feature") # Add y axis
Comment

PREVIOUS NEXT
Code Example
Python :: how to make a pygame window 
Python :: python localhost 
Python :: what is r strip function in python 
Python :: how to get chat first name in telebot 
Python :: polynomial features random forest classifier 
Python :: how do you create a countdown using turtle python 
Python :: find common words in two lists python 
Python :: how to send a message from google form to a python 
Python :: pandas remove rows with null in column 
Python :: install python 3 on mac 
Python :: plotly scatter markers size 
Python :: average out all rows pandas 
Python :: rabbitmq pika username password 
Python :: random element python 
Python :: dropping unnamed columns in pandas 
Python :: python head function show all columns 
Python :: django update increment 
Python :: remover espaços string python 
Python :: jupyter notebook check memory usage 
Python :: dict to array of string python 
Python :: ordered char list python 
Python :: how to wait until pressing button in tkinter 
Python :: arithmetic python string 
Python :: add jupyter environment 
Python :: python save .mat 
Python :: binary number in python 32 bit 
Python :: python count lines in string 
Python :: text to sound python 
Python :: get csrf_token value in django template 
Python :: check pip installed packages inside virtualenv 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =