Programming Assignment #1

$24.99 $18.99

Question 3: In this question we will provide three files: training_samples.txt, training_labels.txt and testing_samples.txt. Write a program to predict the category of a testing sample with K-NN algorithm given training samples and the labels of the training samples. Select a good hyperparameter K. Note that you are expected to implement the K-NN algorithm by yourself.…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:

Description

5/5 – (2 votes)

Question 3: In this question we will provide three files: training_samples.txt, training_labels.txt and testing_samples.txt. Write a program to predict the category of a testing sample with K-NN algorithm given training samples and the labels of the training samples. Select a good hyperparameter K. Note that you are expected to implement the K-NN algorithm by yourself. In other words, you are supposed to not directly use the well-implemented K-NN class or functions in packages or libraries, e.g. scikit-learn. But it is ok to use numpy and scipy.

File format:

  1. training_samples.txt: N lines of float values separated by space. Each line is a training sample.

  1. training_labels.txt: N lines where each line contains an integer.

  1. testing_samples.txt: N lines containing the coordinates of the testing samples. The elements in each line are separated by space.

Question 4: In this question we will provide a file containing N lines. Each line includes two values x and y, representing a training point. You are supposed to write and run a program to fit a linear regression model y = wx+b with the given points and then plot the fitted line and training points in a figure. Note that you are expected to implement the linear regression algorithm by yourself. In other words, you are supposed to not directly use the implementation in packages or libraries, e.g. scikit-learn. But it is ok to use numpy and scipy for data processing and calculation, like matrix multiplication.

File format:

(1) 2D_points.txt: N lines of float value pairs separated by space. Each line is a training sample (x,y).

Programming Assignment #1
$24.99 $18.99