필터 지우기
필터 지우기

Ridge Regression Code error message

조회 수: 2 (최근 30일)
Eduardo Calixto
Eduardo Calixto 2020년 4월 23일
편집: Fatma HM 2020년 12월 1일
Dear,
I wrode the following comand for Ridge regression:
X = file name
x = [Crack];
y = FFT;
n = length(y);
c = cvpartition(23,'HoldOut',0.3);
>> idxTrain = training(c,1);
>> idxTest = ~idxTrain;
>> b = ridge(y(idxTrain),X(idxTrain),lambda);
The logical indices contain a true value outside of the array bounds. (I´ve got this message. What´s wrong ?)
Thanks for your support !

답변 (1개)

Raunak Gupta
Raunak Gupta 2020년 4월 28일
Hi,
From the code I think the cvpartition that is created should have ‘n’ number of observation instead of 23. That is why the logical vector generated by training has size mismatch compare to X or y. Changing 23 to ‘n should work.
  댓글 수: 2
Eduardo Calixto
Eduardo Calixto 2020년 5월 2일
Thanks for your support Raunak ! I will try and let you know !
Fatma HM
Fatma HM 2020년 12월 1일
편집: Fatma HM 2020년 12월 1일
Hi Raunak, I have a questions how can i use the Ridge regression in matlab ? And if i have my inputs and output how will I use them in the code of ridge regression and what it will be the coefficient in ridge regression ? Please help me i can’t figure it out

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

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by