필터 지우기
필터 지우기

Trained svm model can't make predictions with new data

조회 수: 2 (최근 30일)
li li
li li 2023년 12월 29일
답변: Sulaymon Eshkabilov 2023년 12월 29일
load('Model.mat');
new_data = [5.1, 3.5, 1.4, 0.2];
prediction = predict(Model, new_data);
matlab2017b,What can I do to make it right?thanks

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 29일
Presuming that you are working with fitrsvm() for regression model development, e.g.,
% E.g. Data for model training:
x_train = reshape(1:20, [10,2]);
y_train = (1:10)';
% Train regression SVM model:
SVM_model = fitrsvm(x_train, y_train);
% Predictor test data:
x_test = [20, 21; 24, 25];
% Make predictions using the trained model
y_pred = predict(SVM_model, x_test)
y_pred = 2×1
14.6763 18.3469
%% OR load the existing model (MODEL_SVM.mat contains the model called Model_SVM):
load('MODEL_SVM.mat')
y_pred2 = predict(Model_SVM, x_test)
y_pred2 = 2×1
14.6763 18.3469

카테고리

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