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