Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

xgboost feature importance

import matplotlib.pyplot as plt
from xgboost import plot_importance, XGBClassifier # or XGBRegressor

model = XGBClassifier() # or XGBRegressor

# X and y are input and target arrays of numeric variables
model.fit(X,y)
plot_importance(model, importance_type = 'gain') # other options available
plt.show()
# if you need a dictionary 
model.get_booster().get_score(importance_type = 'gain')
Comment

PREVIOUS NEXT
Code Example
Python :: How to find least common multiple of two numbers in Python 
Python :: matplotlib matrix plot 
Python :: python code to drop columns from dataframe 
Python :: python for loop jump by 2 
Python :: pandas to_csv append 
Python :: pca in sklearn 
Python :: how to print char of element in list of pytohn 
Python :: pandas remove index column when saving to csv 
Python :: how to append rows to a numpy matrix 
Python :: pandas reciprocal 
Python :: how to read excel file in jupyter notebook 
Python :: wtf forms required 
Python :: decode url python 
Python :: close turtle window python 
Python :: create pickle file python 
Python :: add favicon fastapi 
Python :: python how to unnest a nested list 
Python :: how to get the current web page link in selenium pthon 
Python :: python cube turtle 
Python :: pandas set font size plot 
Python :: get median of column pandas 
Python :: stop a function from continuing when a condition is met python 
Python :: best free rat for windows 
Python :: RandomForestRegressor import 
Python :: how to enable matplotlib in notebook 
Python :: how to print whole year calendar in python 
Python :: close selenium webdriver python 
Python :: stringf replcae in python 
Python :: background image in python 
Python :: numpy random int 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =