Interactive Exercises

Companion exercises for the book Practical Machine Learning with R . Each chapter includes hands-on, browser-based activities to reinforce key concepts.

Chapter 3 — R Exercises (Basics)

Basic R Exercises

Here you find short and very basic exercises to introduce R.

Launch Exercise

Chapter 3 — R Exercises (piping)

The tidyverse Package (Was Chivalry Dead on the Titanic)

With an interactive exercise, the Titanic dataset, and the tidyverse package we analyze survival on the Titanic.

Launch Exercise

Chapter 4 — k-Nearest Neighbors: Predicting Wine Color

Predict Wine Color

An interactive exercise exploring the k-Nearest Neighbors algorithm. Learn how distance-based classification works by predicting wine color using real data and immediate feedback.

Launch Exercise →

Chapter 4 — k-Nearest Neighbors Project

Read Images with Handwritten Digits

This is an interactive exercise with real-world data. In a project we use the k-Nearest Neighbors algorithm to predict handwritten numbers between 0 and 9 from images.

Launch Exercise →

Chapter 5 — Linear Regression

Predict House Prices with Multivariate Regression

This is an interactive exercise to estimate housing prices with linear regression using the so-called King County House Sale dataset (Kaggle (2015)). This dataset contains house sale prices from May 2014 to May 2015 for King County in Washington State, including Seattle, WA.

Launch Exercise →

Chapter 6 — Tuning a Polynomial Regression Model

Predict House Prices Based on Square Footage Using a Poynomial Regression Model

This is an interactive project to predict house prices based on square footage. A Poynomial Regression Model is used for the analysis.

To determine which degree of polynominal model promisses the greatest predictive quality, tuning with Cross-Validation is used. You can execute and edit all 10 Steps needed for the analysis in an Internet browser.

Launch Exercise →

Chapter 6 — Tuning a k Nearest Neighbor Model

Predict Wine Color Based on Various Chemical Properties

This is an interactive project to predict the color of wines; (red or white). It uses several chemical properties of these wines as predictor variables.

A k Nearest Neighbor is used as a machine learning model and the parameter neighbors, which determines the numbers of neighbors to be considered, in tuned for values from 1 to 15.

You can execute and edit all 10 Steps needed for the analysis in an Internet browser.

Launch Exercise →

Chapter 7 — Using ElasticNet Regularization and Hyperparameter Tuning to Avoid Overfitting

Predicting House Prices with a Multivariate Polynomial Regression Model

In this exercise you use a Multivariate Polynomial Regression Model to predict house prices.

You use a mix of Ridge and Lasso regularization to keep the model parameters (the beta-values) low.

The mixture of the two regularization models (Ridge and Lasso) as well as the chosen penalty are hyperparameters. You will use tuning together with cross-validation to find the optimal values for these parameters

You can execute the analysis and the tuning process in an Internet browser.

Launch Exercise →

Upcoming Chapters

More Interactive Exercises

Additional exercises for upcoming chapters are currently under development. They will appear here as soon as they are finalized.