Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

xgb plot importance round

# Get the booster from the xgbmodel
booster = xg_reg.get_booster()

# Get the importance dictionary (by gain) from the booster
importance = booster.get_score(importance_type="gain")

# make your changes
for key in importance.keys():
    importance[key] = round(importance[key],2)

# provide the importance dictionary to the plotting function
ax = plot_importance(importance, max_num_features=3, importance_type='gain', show_values=True)
Comment

xgb plot importance round

# Get the booster from the xgbmodel
booster = xg_reg.get_booster()

# Get the importance dictionary (by gain) from the booster
importance = booster.get_score(importance_type="gain")

# make your changes
for key in importance.keys():
    importance[key] = round(importance[key],2)

# provide the importance dictionary to the plotting function
ax = plot_importance(importance, max_num_features=3, importance_type='gain', show_values=True)
Comment

PREVIOUS NEXT
Code Example
Python :: FizzBuzz in Python Using Lambda 
Python :: get ggplot colorpalette python 
Python :: zip list python first element 
Python :: unittest run one test 
Python :: pyttsx3 Running a driver event loop 
Python :: print numbers 1 to 10 using recursion in python 
Python :: print same index and value on each iteration of the for loop in Python 
Python :: read stdn puthon 3 
Python :: Python Switch case statement using if-elif-else 
Python :: Add OR Concatenation of Tuples in python 
Python :: foreach on sysargv 
Python :: lime python interpretation 
Python :: NO OF CLASSES IN PAVIA UNIV DATASET 
Python :: python lambda to rename multiple variables name by replacing any appearance with underscore 
Python :: vortex identification 
Python :: import variables fron another file 
Python :: fetch metric data from aws boto3 
Python :: Broadcasting with NumPy Arrays Example 
Python :: else 
Python :: sensitivity 
Python :: Python NumPy block Function Example by using simple array 
Python :: TemplateDoesNotExist at / 
Python :: python pandas read parquet with progressbar 
Python :: NumPy fliplr Example 
Python :: colorbar over two axes 
Python :: ax bar different colors 
Python :: adjoint of 3x3 matrix in python 
Python :: python replace date time column 
Python :: finding-the-largest-three-digits-number-within-a-number 
Python :: Examples of correct code for this rule with global declaration: 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =