1
$\begingroup$

I am currently working with the k-Nearest Neighbors (KNN) algorithm.

Is it possible to compare two datasets with different ranges of values?

In other words, I have one dataset with a range $\in [0,1]$, and the second range of the other dataset $\in [-1,1]$.

I have calculated some performance measures such as accuracy and F1 score, among others. Then, I compared them based on the performance measures.

Is this approach correct? Or do I need to transform the datasets to they lie in common ranges?

EDIT

What I mean by the range that for example, all the observations in the first dataset are between 0 and 1. Also, When I say comparing two datasets, I mean comparing the outcome of the performance measures such as accuracy and F1 score and so on.

The range is for the predictor variables. The comparison is only to replicate some results. Also, to make sure about different methods.

$\endgroup$
4
  • $\begingroup$ I think this question needs some clarification. What do you mean the dataset has a range [0,1]? Is that range for your variable of interest or for the auxiliary variable(s)? And what do you mean when you say you want to compare the two different datasets? What are you comparing between them? $\endgroup$
    – astel
    Jul 30 '18 at 18:42
  • $\begingroup$ @astel, I mean by the range that all the observations in the first dataset are between 0 and 1. When I say comparing two datasets, I mean comparing the outcome of the performance measures such as accuracy and F1 score and so on. $\endgroup$
    – jeza
    Jul 30 '18 at 18:56
  • $\begingroup$ You still didn't really answer my question, is the range you quoted for the variable of interest or the auxiliary variables? Why do you want to compare the accuracy/F1 scores of two datasets? $\endgroup$
    – astel
    Jul 30 '18 at 19:14
  • $\begingroup$ @astel, The range is for the predictor variables. The comparison is only to replicate some results. Also, to make sure about different methods. $\endgroup$
    – jeza
    Jul 30 '18 at 20:02
4
$\begingroup$

The short answer is no, your approach may not lead to the results you are looking for. You should first normalize your variables so they lie on comparable ranges.

An in-depth answer to your question can be found on this thread which has a nice visual describing why normalization is useful for you. It also has a nice discussion in the comments of the answer which you may find helpful.

$\endgroup$
2
  • $\begingroup$ I think this answer is incorrect if I am understanding the question correctly. The OP asks if it is possible to compare two DIFFERENT datasets that have predictor values with different ranges, from what I gather he is trying to perform feature selection. And of course the answer to this is yes this is fine. The normalization problem in KNN occurs when you have two variables in the SAME dataset with different ranges as in the example you gave. $\endgroup$
    – astel
    Jul 31 '18 at 15:29
  • $\begingroup$ This information was not available when OP first posted. $\endgroup$
    – ERT
    Jul 31 '18 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.