0
$\begingroup$

We have built a machine learning classifier for some experimental data. During this process, we performed discretization on the continuous target variable using its median as a threshold. We would like to test our classifier on a similar new study. The problem we are facing is that the median of the new input data is significantly different than that of our original data. This would mean that the classifier will produce erroneous predictions. How should we address this issue? Do we need to normalize the new input data? If so, then what method would be best?

$\endgroup$
0
$\begingroup$

The correct way to do it would be use the median for the train data as the threshold as the transformations that are applied on the training set are to be replicated as it is on the test set.

The same is true whenever you are performing normalization, also check out this link on scikit-learn. Notice that the fit transform method is called on the train set and only transform is called on the test set meaning that the transformations are repeated.

You need to perform normalization on the test data (your new input data) only if you have done so on the train set(your experimental set) ,and in that case just call transform and not fit transform on your test set. Whether to perform normalization or not depends upon the algorithm used for machine learning for example Random forests can work without normalization also but logistic regression would require normalizing.

$\endgroup$
  • $\begingroup$ We used a simple binary classification: If x is less than or equal to median then 1. If x is greater than median then 0. Your response means that, if it is necessary to normalize the data, then we need to go back and perform normalization on the train data and then used normalized test data, correct? $\endgroup$ – Oliv531 Feb 28 '17 at 10:50
  • $\begingroup$ yes ,everything has to be same for the train and the test sets... $\endgroup$ – Vaibhav Arora Feb 28 '17 at 12:17
  • $\begingroup$ With our classification method, is it okay if we perform normalization on our data? Also, when I am talking about normalization on data, I mean normalizing the dependent variable, not the features. $\endgroup$ – Oliv531 Feb 28 '17 at 14:08
  • $\begingroup$ you can check stats.stackexchange.com/questions/189652/… for more on normalizing. I think it wont hurt to scale your dependent variable. You can find more about this on stats.stackexchange.com/questions/189431/… $\endgroup$ – Vaibhav Arora Feb 28 '17 at 19:38
0
$\begingroup$

Instead of median of the continuous valued feature, why not just divide them into bins and use one hot encoding for these bins. Whatever new values that you will get will definitely conform to a particular bin.

$\endgroup$
  • $\begingroup$ Could you please explain further? $\endgroup$ – Oliv531 Mar 1 '17 at 12:34

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.