Which of the following option is true about k-NN algorithm?

it can be used for classification
it can be used for regression
it can be used in both classification and regression
not useful in ml algorithm

The correct answer is: C. it can be used in both classification and regression.

K-nearest neighbors (KNN) is a supervised learning algorithm that can be used for both classification and regression tasks. In classification, KNN assigns a class label to an instance by finding the k nearest neighbors of the instance in the training data and then assigning the class label that is most common among the k nearest neighbors. In regression, KNN predicts a value for an instance by finding the k nearest neighbors of the instance in the training data and then averaging the values of the k nearest neighbors.

KNN is a simple and easy-to-understand algorithm that is often used as a baseline algorithm for comparison with other algorithms. It is also a robust algorithm that can be used with a variety of data types. However, KNN can be computationally expensive, especially for large datasets.

Here is a brief explanation of each option:

  • Option A: KNN can be used for classification. In classification, KNN assigns a class label to an instance by finding the k nearest neighbors of the instance in the training data and then assigning the class label that is most common among the k nearest neighbors.
  • Option B: KNN can be used for regression. In regression, KNN predicts 132.3-11.4 132.3s0 89.4 11.4 132.3c6.3 23.7 24.8 41.5 48.3 47.8C117.2 448 288 448 288 448s170.8 0 213.4-11.5c23.5-6.3 42-24.2 48.3-47.8 11.4-42.9 11.4-132.3 11.4-132.3s0-89.4-11.4-132.3zm-317.5 213.5V175.2l142.7 81.2-142.7 81.2z"/> Subscribe on YouTube
a value for an instance by finding the k nearest neighbors of the instance in the training data and then averaging the values of the k nearest neighbors.
  • Option C: KNN can be used in both classification and regression.
  • Option D: KNN is not useful in ML algorithm. This is not true. KNN is a supervised learning algorithm that can be used for both classification and regression tasks.
  • Exit mobile version