stepwiselm: Can I limit the maximum number of variables to a fixed integer?

조회 수: 2 (최근 30일)
I'm using stepwiselm:
stepwiselm(X,y,'constant','Upper','quadratic','Criterion','adjrsquared')
I want my model to include all kinds of linear terms, interactions, and squared terms, so I choose "'Upper','quadratic'". At the same time I would like my model not to include more than 10 variables altogether. E.g. the goal is to find those 10 terms from all kinds of possibilities that maximize the Criterion, e.g. adjrsquared. How can I implement this?
Thank you very much.

채택된 답변

Mukul Rao
Mukul Rao 2017년 7월 19일
Hi,
I work for the MathWorks, and I believe what you are trying to accomplish is not currently supported by "stepwiselm". You can come close to this functionality by starting with a model containing only the constant term, and using the 'NSteps' option to limit the number of steps taken. That process may include terms being removed as well as entered, though, so this will not do exactly as requested.
There is an enhancement request in place and I will make sure to add your use case in the details.
  댓글 수: 1
Karsten Reuß
Karsten Reuß 2017년 7월 19일
Dear Mukul,
thank you very much for the info and the enhancement request. I think such a functionality could be very useful in several situations. Like if you want to make predictions without overfitting and you seek a parsimonious model with few, but very strong predictors.
I actually attempted to approach this functionality the way you described, but as you said, as the algorithm may remove and add terms more frequently to optimize the criteria. E.g. it may not be the best model in the end after NSteps is not always equal maxPredictors.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Model Building and Assessment에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by