Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me get this on Spyder? KNN is a non-parametric learning algorithm. Its purpose is to use a database in which the data

Can someone help me get this on Spyder?

image text in transcribedimage text in transcribedimage text in transcribed
KNN is a non-parametric learning algorithm. Its purpose is to use a database in which the data points are separated into several classes to predict the classification of a new sample point. You are given a dataset task6_1_dataset.csv. The first column is index, x1 and x2 can be treated as the coordinates of a point, and y is the class the point (x1, x2) belongs to. x1 Y 0 1.68223 7.81035 0 1 7.20088 9.754777 0 2 6.47379 10.44102 3 5.98175 8.025655 4.52135 9.10985 5 3.94231 9.067026 0 (The above data is for demonstration purposes only. Please download the full version of tdataset.csv.) You are asked to : train the above dataset with k=1 test the kNN classifier with [-4, 8] (1" testing point) visualize data and the 1" testing point using scatter plot. X axis is x1 Y axis is x2 Testing point's marker is "x", with a text label. plt.subplots(figsize=(7, 5), dpi=100) O scale = 75 alpha = 0.6 colors = ['green', 'blue', "magenta'] representing class 0, 1 and 2; or colors of your choice For a training data point, its color is the y class color; for a testing point, color is the predicted class color set the plot title according to the screenshot below other settings of your choice Sample output as shown in the following figure is for demonstration purposes only.3-Class classification (k = 1) the test point is predicted as class green 12 10 ey48), test point -2 -8 -6 -4 -2 0 2 6 train the above dataset with k=15 test the kNN classifier with [-2, 5] (2" testing point) visualize data and the 2" testing point using scatter plot. Create color maps/decision boundaries cmap_light = ListedColormap (["#AAFFAA', "#AAAAFF', "#FFAAAA"]] X axis is x1 Y axis is x2 Testing point's marker is "x", with a text label. pit.subplots(figsize=(7, 5), dpi=100) For a training data point, its color is the y class color; for a testing point, color is the predicted class color set the plot title according to the screenshot below other settings of your choice3-Class classification (k = 15) the test point is predicted as class magenta 12 10 6 2, 5), test paint 2 -2 -8 -6 -4 -2 2 4 6

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions