Session Ready
Exercise

Fit a decision tree

Now, you will take a stab at building a decision tree model. The decision tree is a list of machine-learned if-else rules that decide in the telecom churn case, whether customers will churn or not. Here's an example decision tree graph built on the famous Titanic survival dataset.

The train_X, test_X, train_Y, test_Y from the previous exercise have been loaded for you. Also, the tree module and the accuracy_score function have been loaded from the sklearn library. You will now build your model and check its performance on unseen data.

Instructions
100 XP
  • Initialize the decision tree model with max_depth set at 5.
  • Fit the model on the training data, first train_X, then train_Y.
  • Predict values of the testing data, or in this case test_X.
  • Measure your model's performance on the testing data by comparing between your actual test labels and predicted ones.