If we used the above k-nn algorithm to score the training


Problem

Predicting Housing Median Prices. The file BostonHousing.csv contains information on over 500 census tracts in Boston, where for each tract multiple variables are recorded. The last column (CAT.MEDV) was derived from MEDV, such that it obtains the value 1 if MEDV > 30 and 0 otherwise. Consider the goal of predicting the median value (MEDV) of a tract, given the information in the first 12 columns. Partition the data into training (60%) and validation (40%) sets.

a. Perform a k-NN prediction with all 12 predictors (ignore the CAT.MEDV column), trying values of k from 1 to 5. Make sure to normalize the data and choose function knn() from package class rather than package FNN. To make sure R is using the class package (when both packages are loaded), use class: knn(). What is the best k? What does it mean?

b. Predict the MEDV for a tract with the following information, using the best k:

1692_information-table.jpg

c. If we used the above k-NN algorithm to score the training data, what would be the error of the training set?

d. Why is the validation data error overly optimistic compared to the error rate when applying this k-NN predictor to new data?

e. If the purpose is to predict MEDV for several thousands of new tracts, what would be the disadvantage of using k-NN prediction? List the operations that the algorithm goes through in order to produce each prediction.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: If we used the above k-nn algorithm to score the training
Reference No:- TGS02721508

Expected delivery within 24 Hours