필터 지우기
필터 지우기

Getting the regression coefficients for a lower number of Partial Least Squares components than specified by plsregress(X,Y,ncomp) without redoing the whole regression model?

조회 수: 1 (최근 30일)
When performing a regression with the plsregress command in matlab, you specify the number of components when you fit the model like this:
ncomp = 100;
[XL,YL,XS,YS,BETA,PCTVAR] = plsregress(X,Y,ncomp);
But say I wanted to test the performance of all number of components up to 100 (so 1 component, then 2, then 3, then 4..), how can I get the regression coefficients (BETA) for that? Do I really have to repeat the model a hundred times like this:
[XL,YL,XS,YS,BETA1,PCTVAR] = plsregress(X,Y,1);
[XL,YL,XS,YS,BETA2,PCTVAR] = plsregress(X,Y,2);
[XL,YL,XS,YS,BETA3,PCTVAR] = plsregress(X,Y,3);
and so on up to 100
That seems unreasonable. Is there a faster way to get the regression coefficients for a lower number of components than the one specified when creating the model?
Thanks.
  댓글 수: 2
John D'Errico
John D'Errico 2016년 5월 30일
편집: John D'Errico 2016년 5월 30일
One day, they will let us do loops in MATLAB. Just think what an innovation that will be. Oh! That is right! There is such a thing as a for loop. Why not use one? :)
Anyway, creating numbered variables is just poor programming. Learn to use vectors and arrays, even cell arrays.
Petter Stefansson
Petter Stefansson 2016년 5월 31일
Obviously I realize that I don’t have to manually write all the 100 models by hand like the way I did in the question, sorry for not making that clear :)
My point is that I suspect it is WILDLY computationally inefficient because if I create a model with 10 components for example, I will indirectly also have created a model with 1-2-3-4-5-6-7-8-9 components since the model is created iteratively by adding one component after another is it not? So that a model with 3 components is just a continuation of a 2 component model?
But I don’t get access to that information, at least I don’t know how to, so if I’m correct in that my point is that I should only have to do one model, namely the one with 100 components, instead of a loop with 100 models which takes substantially much more time and pretty much makes it infeasible for me to do what I want to do.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by