Data Science

Decision Trees: Intuitive Models

Senior Data Analyst
May 10, 2026
5 min read

The Code

from sklearn.tree import DecisionTreeClassifier, plot_tree

model = DecisionTreeClassifier(max_depth=3)

model.fit(X_train, y_train)

plt.figure(figsize=(15, 8))

plot_tree(model, feature_names=X.columns, filled=True)

plt.show()

*Day 131: Random Forests.*

Ready to put your knowledge into practice?

Join SQL Mastery and learn through interactive exercises.