Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

y 4 0 1 [6 points] Classification using KNN. The table below provides a training dataset containing six observations (a.k.a. samples) (n = 6) each

image text in transcribed
y 4 0 1 [6 points] Classification using KNN. The table below provides a training dataset containing six observations (a.k.a. samples) (n = 6) each with three predictors (a.k.a features) (p = 3), and one qualitative response variable (a.k.a. target). Table 1. Training dataset with n = 6 observations in p = 3 dimensions with a categorical response, y Obs. * x2 *) 1 O 3 Red 2 2 0 0 Red 3 0 1 3 Red 2 Blue 5.1 0 1 Blue 6 1 1 1 Red We want to use the above training dataset to make a prediction, 9, for an unlabeled test data observation where x1 = x2 = x3 = 0 using K-nearest neighbors. You are given some code below to get you started. Note: coding is only required for part (a), for (1)-(d) please provide your reasoning based on your answer to part (a). (a) Compute the Euclidean distance between each observation and the test point, x1 = x2 = x3 = 0. Present your answer in a table similar in style to Table 1 with observations 1-6 as the row headers. (b) What is our prediction, 9, when K = 1 for the test point? Why? le) What is our prediction, 9, when K = 3 for the test point? Why? (d) If the Bayes decision boundary (the optimal decision boundary) In this problem is highly nonlinear, then would we expect the best value of K to be large or small? Why? import numpy as np X = np.array([[ 8, 3, 01, [ 2, , 0], [ 0, 1, 31, [ 0, 1, 21, [-1, , 1), [ 1, 1, 111) y = np.array( 'r',r,'r ','b', 'r'])

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions