Multioutput Regression models in MATLAB
43 views (last 30 days)
Show older comments
I am working on a project where I need to predict multiple response variables for a given data set likely using random forests or boositng. Are there any functions I could use that might provide what I am looking for. Basically, what I mean is:
data = (2-D matrix of regressors)
regression model = regression_function(data,response variables)
0 Comments
Accepted Answer
Ive J
on 6 Jun 2023
I'm not aware of such a function in MATLAB, but you can loop over your target/response variables, and each time fit a new model. Something like this:
models = cell(numel(responseVars), 1);
for k = 1:numel(models)
models{k} = fitrensemble(data(:, [features, responseVars(k)], responseVars(k)); % data table contains all features + outcomes
end
7 Comments
the cyclist
on 8 Jun 2023
fitcecoc doesn't fit multiple response variables. It fits a single (categorical) response variable that has more than two categories.
Ive J
on 8 Jun 2023
Edited: Ive J
on 8 Jun 2023
Yes, that's correct and I didn't mean fitcecoc is multivariate. For multivariate SVM one could check sklearn. But for this specific problem of OP, I meant something like this by aggregating different responses to see how one label vs others could differ compared to separate SVMs:
y1 = ["y1-1", "y1-2", "y1-3"];
y2 = ["y2-1", "y2-2"];
y_multi = y1' + "_" + y2;
y_multi = categorical(y_multi(:))
More Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!