How do you format the function 'pcrsse' required for crossval?

6 visualizzazioni (ultimi 30 giorni)
Hi,
I am working through the example "Partial Least Squares Regression and Principal Components Regression" provided in the Mathworks Help Center. I have reached the part discussing cross validation as a method to determine the necessary number of principle components.
The instructions say it is necessary to calculate the mean squared prediction error (MSEP) for the principle component regression (PCR) using the function 'crossval.' In order to do this, you must make a function to determine the sum of squared error for PCR, but they do not give the code for this function only the name 'pcrsse.' However, inserting a function into crossval requires tricky formatting, I have also tried to follow the help file on 'crossval' with no success. Will someone please look at this example in the Help Center and help me develop this 'pcrsse' function? Many thanks.
Frederik
  2 Commenti
Asvin Kumar
Asvin Kumar il 9 Giu 2020
Can you provide details on what you've tried so far and what issues you ran into while following the help file on crossval?
Frederik Schmidt
Frederik Schmidt il 10 Giu 2020
Thanks for your willingness to help, but actually the problem has already been resolved. I only had to enter a larger amount of data for the 10-fold cross-validation to work. And obviously the function '@pcrsse' is provided by Matlab and automatically called when requested in the function call.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by