How do I get ridge regression tuning parameters from fitrtree and crossval?

12 ビュー (過去 30 日間)
Jacob Yeung
Jacob Yeung 2020 年 4 月 5 日
回答済み: Asvin Kumar 2020 年 4 月 13 日
I was wondering if I could use fitrtree to create a regression tree to then run crossval on to find the tuning parameters to then use in the Matlab ridge function.

回答 (1 件)

Asvin Kumar
Asvin Kumar 2020 年 4 月 13 日
crossval finds the k-fold cross validation loss of a given model with respect to a given dataset. I don’t see how you can use fitrtree along with that to find the optimal ridge parameter ‘k’ for ridge. It is a model that you’re seeking to find in the first place.
Have a look at the methods mentioned on this page: https://www.mathworks.com/help/stats/bayesian-optimization-workflow.html. They describe the many options available to optimize the hyperparameter for a wide variety of problems, including ridge regression.
fitrlinear seems like it will meet your requirements.
Here’s an example at https://www.mathworks.com/help/stats/fitrlinear.html#bu5tqz1-1 if you want to test the performance of your model over a range of possible choices for the ridge parameter (‘Lambda’ Regularization Term Strength).
On the other hand, you can have the function optimize for the ridge parameter. Have a look at the example at https://www.mathworks.com/help/stats/fitrlinear.html#bvevent-1. This might be best suited for you. Set the name-value pair OptimizeHyperparameters’ to {‘Lambda’}.

Community Treasure Hunt

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

Start Hunting!

Translated by