Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This problem is related to Nearest neighbors classifiers described in section 9.5 in Modern Statistics with R - https://modernstatisticswithr.com : Fit a kNN classification model

This problem is related to Nearest neighbors classifiers described in section 9.5 in "Modern Statistics with R" - https://modernstatisticswithr.com: Fit a kNN classification model to the wine data, using pH, alcohol, fixed.acidity, and residual.sugar as explanatory variables. Evaluate its performance using 10-fold cross-validation, using AUC to choose the best k.

To solve the problem, you'll need to load the data and libraries with:

# Import data about white and red wines:

white <- read.csv("https://tinyurl.com/winedata1",sep = ";")

red <- read.csv("https://tinyurl.com/winedata2",sep = ";")

# Add a type variable:

white$type <- "white"

red$type <- "red"

# Merge the datasets:

wine <- rbind(white, red)

wine$type <- factor(wine$type)

install.packages('caret', dependencies = TRUE)

library(caret)

# to visualize results you need the following

install.packages('MLeval', dependencies = TRUE)

library(MLeval)

For the submission:

  1. 1. Provide the commands in plain text that you used to solve the problem.
  2. Attach the figure that resulted after command: plots$roc
  3. Output after executed command: plots$optres[[1]][13,]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linear Algebra

Authors: Jim Hefferon

1st Edition

978-0982406212, 0982406215

More Books

Students also viewed these Mathematics questions