How to replicate Regression Learner app based training using Matlab script?
3 Comments
Hi @Quazi Hussain,
Please see my response to your comments. The script and app give equivalent results, with minor differences due to randomness in optimization. A near-perfect R² on training data is normal for GPR since it tends to fit very closely. The key measure is cross-validated or test performance, and if that’s poor it suggests overfitting. You may want to try constraining hyperparameters, testing simpler kernels, or comparing with simpler models.
Please note @dpb is correct because the Regression Learner app and the script both rely on the same underlying fitrgp function, and the optimization process involves randomness. Without fixing the random seed, each run can produce slightly different hyperparameters and results. Setting the seed ensures reproducibility and makes the outputs from the app and script match.
Hope this helps.
@dpb - You're absolutely right, I oversimplified that. The "slightly different" comment assumes well-behaved data, but as you point out, some datasets can produce dramatically different models depending on the random subset selection.
For @Quazi Hussain's case, this variability could actually explain the overfitting issue. If CV folds are inconsistent due to data heterogeneity, the hyperparameter optimization might be fitting noise rather than signal.
Good suggestion to run multiple times with different seeds to check stability - high variability would indicate the dataset sensitivity you mentioned.
Thanks for the clarification.
Accepted Answer
More Answers (0)
Categories
Find more on Support Vector Machine Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!