Support Vector Machine Regression Predict

I have this Airlines dataset. I used 11 yers for training and 1 for testing.
Once i've chosen and trained the model (using fitrsvm, predict...), suppose that i need to predict the next 3 months how can i do?
Probably it's a dumb question, but i can't figure out.
Thanks.

답변 (1개)

Iuliu Ardelean
Iuliu Ardelean 2021년 3월 2일
편집: Iuliu Ardelean 2021년 3월 2일

0 개 추천

Hey
You could try:
numTrainPoints = 100; % Let's say you want 100 train points
dtrain = d(1:numTrainPoints, 1:(A-af); % select first 100 points for training
model = fitrsvm(dtrain, dresponse); % fit model to train data
dtest = d(numTrainPoints:end, 1:(A-af); % select the rest for testing
predictedPassengers = predict(model, dtest); % test

댓글 수: 5

Thanks, but doesn't work.
Here the messagge error...
Error using classreg.learning.internal.numPredictorsCheck (line 29)
X data must have 11 columns.
Hey -- sorry about that -- my error -- I've updated the response -- please let me know if it still doesn't work
again thanks but still doesn't work.
Sorry
Index in position 1 exceeds array bounds (must not exceed 12).
Error in SVM_Question (line 28)
dtrain = d(1:numTrainPoints, 1:(A-af)); % select first 100 points for training
Iuliu Ardelean
Iuliu Ardelean 2021년 3월 3일
편집: Iuliu Ardelean 2021년 3월 3일
what value did you use for numTrainPoints?
Maybe try a smaller number, e.g. numTrainPoints = 10
it works only with numTrainpoints = 12, but it gaves the same result of the benigging
numTrainPoints = 12;
dtrain = d(1:numTrainPoints, 1:(A-af)); % select first points for training
model = fitrsvm(dtrain, dresponse); % fit model to train data
dtest = d(1:numTrainPoints, 1:(A-af)); % select the rest for testing
predictedPassengers = predict(model, dtest); % test
because it's the same code dtest result the same of dtrain

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

카테고리

질문:

2021년 3월 2일

댓글:

2021년 3월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by