Search code examples
machine-learningneural-networkscaling

How to handle a situation of feature scaling in machine learning model deployment when you have only one testing instance?


I am developing a Neural Network Model for classification problem. The number of features is about 1500 and all these features have very different ranges. I trained the model using feature normalization and got better results. Now when I am gonna deploy my model, the user will test my model with only one test example. I am wondering as my network in house train/test were normalized but the user test is a single test example and It can not be normalized as it's not a set of examples but just a single instance. How would my model handle this situation?


Solution

  • Always normalize the test samples with the same values with which your training data was normalized.

    So you won't have a problem.

    You should not normalize the test data separately because the model will perform differently.

    Example: calculate the mean and standard deviation of your training set. You will be using those values to normalize the training set. Now just use the same mean and standard deviation on you test samples also.

    This should solve the issue.