Trained svm model can't make predictions with new data
1 回表示 (過去 30 日間)
古いコメントを表示

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
0 件のコメント
回答 (1 件)
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)
%% 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)
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!