How can I Normalize test data by applying the mean and Standard deviation of the training data?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have spam data (training data and Test Data). This file contains a training set of size 3065 and a test set of size 1536. I standardized the features so that they have zero mean and unit variance i.e. calculated the mean and standard deviation of the training data. Now I have to apply those same parameters to normalize the test data without recalculating the mean and standard deviation of the test data and Im stuck on this part. Can you please help.
0 Commenti
Risposte (3)
taruv harshita priya
il 20 Apr 2021
Matlab has an inbuilt function normalize
For the training data
[Normalized_training_data, c,s]= normalize(training data)
For testing data
Normalized_testing_data= normalize(testing data, 'center', c, 'scale', s)
I hope this helps!!!
Enjoy coding!!!
1 Commento
Steven Lord
il 20 Apr 2021
Note that while the normalize function was introduced prior to release R2021a, the ability to center and scale simultaneously via the 'center' and 'scale' methods and to return the centering and scaling parameters was introduced in that release.
Image Analyst
il 13 Apr 2014
Do you mean
testData = (testData - trainingMean) / trainingStdDev;
???
0 Commenti
Vedere anche
Categorie
Scopri di più su Hypothesis Tests in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!