0
$\begingroup$

Many machine learning algorithms require normalization as a preprocessing step.

For instance, SVM requires the input data to be normalized. So we do the normalization on the input data and then divide the set into training and testing sets and use the SVM classifier.

Now consider a situation when i get a new different set of test of data to try. Now how do i normalize this new test set? Assuming a simple normalization technique such as the min-max normalization.

In this situation what should be done? Is it like the min and max values of each feature must be computed from the training set and apply the same on the test set for normalization?

$\endgroup$
1
$\begingroup$

Is it like the min and max values of each feature must be computed from the training set and apply the same on the test set for normalization?

Exactly. For min-max normalization, MATLAB has a built-in function that does exactly this:

[ntraindata, model] = mapminmax(traindata);
ntestdata = mapminmax.apply(testdata, model);

Here, it simply saves the min and max values (of the training set) in the struct model, so you can apply what you have learned from the training set to the test set.

$\endgroup$

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.