How to get MPE (Mean Percentage Error) with plsregress

6 views (last 30 days)
I am trying to use plsregress to build model for prediction. Values I am trying to predict range from 10^-5 to 1. When I want to choose the best possible number of components for my model I tried to look at MSE (Mean Squared Error) but it's higly influenced how the model predicts bigger values. It would be more helpfull if I would be able to look at MPE (Mean Percentage Error) insted of MSE. This will let my choose a model that is best for the whole range of predicted values rather then leaning more to the big values.
Is it possible to get MPE without coding whole PLS and validation method from scratch?

Accepted Answer

the cyclist
the cyclist on 3 Jan 2025
Edited: the cyclist on 7 Jan 2025
The documentation doesn't seem to indicate any way to change the metric that is optimized. (This is unsurprising to me.)
I can think of a couple options, off the top of my head.
The simpler one is to take the log of the data you are trying to predict, before sending it to plsregress. There are likely theoretical reasons to do this -- or to not do this! -- so it might be worth exploring.
The much, much more difficult option is to make your own copy of the plsregress code, and then dig into it to find where MATLAB defines the metric that is optimized, and change the function there. You'll be able to keep the machinery of the function in place, and not need to rewrite everything. But, this is nonetheless probably a big job.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!