I estimated a Partial Least Squares model where the X matrix had normalized columns. Now I want to predict the value for a new instance (which is a frequency vector summing to one.) I assume that if I just use the raw frequency values, the predicted value won't be on the same scale as the scenario where my 'new' instance was taken from the normalized X matrix. (i.e. Comparing the fitted values of the model with predicted value of new instance.)

I was thinking of adding the new instance as the bottom row of the original non-normalized X matrix, normalizing, and then using the values from this new bottom row to predict.

Alternatively, I could standardize by using the column means and standard deviations from the original non-normalized X.

Is one method preferred to the other? Is there a better way?


2 Answers 2


The normalization takes place with following steps:

  1. The mean of each variable is subtracted from that variable.
  2. Each variable is then divided by the standard deviation(stddev) of that variable

So you have mean and stddev from the unnormalized X. The most common way is to use this mean and stddev to normalize the new data with the same steps but on your new data to be predicted. Thus, your last suggestion is both correct and common.

In addition, you can also add intercept term to the BETA matrix/vector obtained from PLS model that would represent the mean-centering step. Additionally, you can also recalculate the BETA once more to give the division with stddev effect.

Adding new data to the training set (your original X matrix) and then normalizing it, however, is not a correct way. This makes the scaling and more importantly your mean, which acts like an intercept term, dependent to the training data AND your new data combined. It would lead to unreliable results. You can also test and see these two methods produce different results.

  • $\begingroup$ +1 (and in general thanks for answering a lot of old PLS questions). But could you please make it more explicit in your answer which alternative suggested by the OP is better: the one in 2nd or in the 3rd paragraph in the question. The 2nd is wrong and the 3rd is correct, so it's good to be very explicit about it. $\endgroup$
    – amoeba
    Jan 26, 2017 at 9:08
  • $\begingroup$ Answer updated accordingly. Thanks for the good advice. $\endgroup$
    – gunakkoc
    Jan 26, 2017 at 9:23

I normalized the sample data based on the values in the training dataset:

sample_data['col1'] = (sample_data['col1'] - training_data['col1'].min()) / (training_data['col1'].max() - training_data['col1'].min())
sample_data['col2'] = (sample_data['col2'] - training_data['col2'].min()) / (training_data['col2'].max() - training_data['col2'].min())
sample_data['col3'] = (sample_data['col3'] - training_data['col3'].min()) / (training_data['col3'].max() - training_data['col3'].min())
... an so on.

You sample data will be normalized according to your training data and you can start doing your predictions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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