1
$\begingroup$

If I were to have a dataset of 9 attributes of different types that describe current weather, such as temperature, humidity, etc., and want to classify the current weather by use of a k-NN algorithm, is this possible?

From what I understand, k-NN has two different attributes that are plotted, and, wherever a point is drawn, its nearest neighbors will classify it.

Could I do the same thing but each data point is placed based on its 9 attributes?

$\endgroup$

1 Answer 1

3
$\begingroup$

The number of features is not important to use K-NN algotihm. You have to decide distance measure to detect neighbors. I share with you some links that you can check to see which kinds of distance measures that you can use. Just decide the meause and use your feature vectors in the measure.

https://www.kdnuggets.com/2020/11/most-popular-distance-metrics-knn.html

https://medium.com/@luigi.fiori.lf0303/distance-metrics-and-k-nearest-neighbor-knn-1b840969c0f4

$\endgroup$
4
  • $\begingroup$ Maybe I'm misunderstanding, but I thought that the amount of features is limited to 3, since the only way to calculate the distance between points would be in 3 dimensional space. How could I map the value that take all 9 values into account? $\endgroup$
    – Zero
    Feb 6, 2021 at 0:05
  • 1
    $\begingroup$ You can/should think your features in high dimensional vector space. So, for example if you have two vectors x and y in 9 dimensional space, just substract x from y and take absolute value of the result and sum the residual vector elements to get distance between two vectors. This is the simplest method. You do not have to live in a 3 dimensions in "the mathematical world". You can have infinite dimensions in math. $\endgroup$
    – verdery
    Feb 6, 2021 at 0:12
  • $\begingroup$ Okay, I think I have a general idea of what that means, but I’m missing the x and y part and how each point would get a unique one if it’s just a vector. Is there any reading that you could link that would explain it better for a beginner? Perhaps we could communicate via email or something so I could get some more guidance if possible? $\endgroup$
    – Zero
    Feb 6, 2021 at 0:43
  • $\begingroup$ I hope this helps you better math.stackexchange.com/questions/1047649/… $\endgroup$
    – verdery
    Feb 6, 2021 at 1:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .