This is related to Names features importance plot after preprocessing
In my case the problem is in the graph:
for importance_type in ('weight', 'gain', 'cover'):
print('%s:' % importance_type,bst.get_score(importance_type = importance_type))
node_params = {'shape': 'box', #Green
'style' : 'filled, rounded',
'fillcolor': '#78fcb'}
xgb.to_graphviz(clf_xgb,size = '10,10',condition_node_params= node_params)
graph_data = xgb.to_graphviz(clf_xgb,size = '10,10',condition_node_params=node_params)
graph_data.view(filename= 'xgboost_response')
plt.show()
for importance_type in ('weight', 'gain', 'cover'):
print('%s:' % importance_type,bst.get_score().items(importance_type = importance_type))
I add feature_names as an inside function , when I tried adding "feature_cols" manually ,which contains the feature names, I had an error. This code doesn't show feature names
Any suggestion would be appreciated
*EDITED
feature_cols = data_set_sub.columns[0:-1]
X = data_set_sub[feature_cols] # Independent variables - features
y = data_set_sub.New # Dependent variables - class
y = y.to_list()
le = preprocessing.LabelBinarizer()
y = le.fit_transform(y)
#* here goes the training/test split