Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16624

Error message: The 'feature_names' parameter of plot_tree must be an instance of 'list' or None

$
0
0
plt.figure(figsize=(15,7.5))plot_tree(clf_dt, filled= True, `rounded=True, class_names = ["No HD","Yes HD"], feature_names=X_encoded.columns) 

I am new to machine learning and python. Trying to plot a classification tree for the heart disease data from the UCI repository. After performing on-hot encoding for the categorical variables and storing it in X_encoded, when I try to plot the tree, it is giving me this error message:

InvalidParameterError: The 'feature_names' parameter of plot_tree must be an instance of 'list' or None. Got Index(['age', 'sex', 'cp', 'restbp', 'chol', 'fbs', 'restecg', 'thalach','exang', 'oldpeak', 'slope', 'ca', 'thal'],      dtype='object') instead.

Viewing all articles
Browse latest Browse all 16624

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>