Maximum number of classes and class names in Decision Trees?

I have two questions about decision trees:

  1. 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)?

  2. 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), train_labels)
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)?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.