1. Learn
  2. /
  3. Courses
  4. /
  5. Explainable AI in Python

Connected

Exercise

Decision trees vs. neural networks

Build a decision tree classifier to classify income levels based on multiple features including age, education level, and hours worked per week, and extract the learned rules that explain the decision. Then, compare its performance with an MLPClassifier trained on the same data.

X_train, X_test, y_train, and y_test are pre-loaded for you. The accuracy_score and export_text functions are also imported for you.

Instructions 1/2

undefined XP
  • 1
    • Extract the rules learned by the model.
    • Compute the model's test accuracy.
  • 2
    • Train the MLPClassifier model.
    • Derive the predictions on the test set.
    • Compute the model's test accuracy.