PCA in regression learner - validation dataset

Apologies if this sounds a very simple problem but I am a real novice at Matlab. I have an issue with using the regression learner app - I have exported a number of models after exploring the training data and am now moving on to the validation stage. Some of these models were subjected to PCA in the app itself via the PCA button however some were not.
I have implemented the non PCA models with some degree of success but when I used the model with PCA from the app I got wildly different results (my dataset is normalised between 0 and 1 but I was getting predictions of -29). My main Question is - Do I need to implement the same PCA from the training data onto my Validation data (I thought that this process was coded into the exported model) and if so is this done through the app or do I need to code it myself?
kind regards

回答(1 个)

It is probably a bit late for you but perhaps some other people struggle with that issue as well.
If you used PCA during your Training, you also have to apply the PCA transformation to your data before you feed it into your model for the calculations. When you look at the structure of the exported model you will find to variables necessary for the transformation (exportedModel.PCACenters and exportedModel.PCACoefficients).
Using the following formula, you can apply the transformation manually.
Input_transformed = (input-exportedModel.PCACenters)*exportedModel.PCACoefficients;
The variable Input_transformed should now contain the information of your given input but transformed to the shape expected by your regression model.

类别

帮助中心File Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

提问:

2020-6-23

回答:

2023-10-31

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by