Hands-on: k-NN Regression in Shiny

Overview

In this 30 min session you will:

  • Launch and explore the k-NN Shiny app

  • Adjust k, select backend (R vs C++)

  • Observe train/test performance and parity plots


Setup

Download the Shiny app:

install.packages("devtools")
devtools::install_github("mmadoliat/KNNreg", force = TRUE)

Open the App

# Run the Shiny application
library(KNNreg)
file.edit(system.file("examples/KNNreg-App.R", package = "KNNreg"))

Tasks

  1. Change the train/test split ratio in make_split() (e.g. 80/20).
  2. Add a slider input for the split ratio in ui and update server logic.
  3. Extend the performance panel to show Mean Absolute Error (MAE).