Learn Decision Trees 101
Explore the power of decision trees with this comprehensive collection of Python notebooks! Using scikit-learn, these interactive guides will take you on a journey to learn and apply the fundamentals of decision tree algorithms. From building and visualizing models to tuning hyperparameters and handling missing values, these notebooks cover it all. Whether you're a beginner looking to get started with machine learning or an experienced practitioner seeking to refine your skills, this collection is sure to provide valuable insights and hands-on practice.
Train Decision Tree classifier
Classification is a task of predicting discrete target labels. The Python `scikit-learn` package provides an implementation of the Decision Tree algorithm for classification, the `DecisionTreeClassifier`. We will train a Decision Tree model on the Iris dataset.
Train Decision Tree regressor
Train a Decision Tree Regressor using scikit-learn. This machine learning algorithm predicts continuous targets. Use the DecisionTreeRegressor class to model housing data. MEDV is the target variable (house value), and other columns are features.
Train Decision Tree on Iris data set
Python is a great choice for Machine Learning projects, because of rich ML packages ecosystem. The `scikit-learn` package provides implementation of Decision Tree algorithm. Let's train Decision Tree classifier using Iris dataset.
Save and load Decision Tree
`Scikit-learn` provides Decision Tree algorithms for classification (`DecisionTreeClassifier`) and regression (`DecisionTreeRegressor`). We'll train a classifier on the Iris dataset and save it using `pickle`. Learn to load and use the model for predictions, ensuring consistency between trained and loaded models.
Tune Decision Tree classifier
This notebook demonstrates tuning a Decision Tree model. We'll find the best hyperparameters for a Decision Tree classifier on the Iris dataset using randomized search and cross-validation, then train the model with these parameters on the full dataset.
Visualize Decision Tree
The Decision Tree algorithm's structure is human-readable, a key advantage. In this notebook, we fit a Decision Tree model using Python's `scikit-learn` and visualize it with `matplotlib`. This showcases the power of decision-tree visualization.
Decision Tree features importance
`Scikit-learn's` permutation importance assesses the impact of each feature on a Decision Tree model's predictions by measuring how much performance drops when feature values are randomly shuffled.