I have two questions about decision trees:
The lesson on decision in the ML course focuses on trees with two target classes (e.g. cars accepted vs unaccepted, or Europe vs Oceania flags). Is it possible to create trees with several target classes (i.e. five different classes)? If yes, how would this affect the code (beyond having 5 different values in the y variable)?
Considering the proposed code for plotting a tree at in the Find the Flag project:
labels = df_36[“landmass”]
dt = DecisionTreeClassifier(random_state = 1, max_depth = best_depth)
tree.plot_tree(dt, feature_names = train_data.columns, class_names = [‘Europe’, ‘Oceania’], filled=True)
How can we make sure that the class names ‘Europe’ and ‘Oceania’ are correctly mapped onto the labels (3 = Europe and 6 = Oceania)?