error using predict function for SVM
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Maurice Moh
le 21 Mar 2017
Commenté : Maurice Moh
le 25 Mar 2017
Hi there i am trying to create a SVM model to predict the data from the one that i have attached here and the code
load mec_prop_tempcooling20sec
table_mec_prop = array2table(mec_prop_tempcooling20sec);
table_mec_prop.Properties.VariableNames{4} = 'UTS';
table_mec_prop.Properties.VariableNames{5} = 'EaB';
table_mec_prop.Properties.VariableNames{6} = 'YM';
table_mec_prop.Properties.VariableNames{1} = 'Heating';
table_mec_prop.Properties.VariableNames{2} = 'Build';
table_mec_prop.Properties.VariableNames{3} = 'Cooling';
Mdl_tensile_Gau = fitrsvm(table_mec_prop,'UTS~Heating+Build+Cooling','KernelFunction','gaussian','KernelScale','auto','Standardize',true,'Leaveout','on');
Mdl_ymodulus_Gau = fitrsvm(table_mec_prop,'YM~Heating+Build+Cooling','KernelFunction','gaussian','KernelScale','auto','Standardize',true,'Leaveout','on');
Mdl_extension_Gau = fitrsvm(table_mec_prop,'EaB~Heating+Build+Cooling','KernelFunction','gaussian','KernelScale','auto','Standardize',true,'Leaveout','on');
Mdl_tensile_lin = fitrsvm(table_mec_prop,'UTS~Heating+Build+Cooling','KernelFunction','linear','KernelScale','auto','Standardize',true,'Leaveout','on');
Mdl_ymodulus_lin = fitrsvm(table_mec_prop,'YM~Heating+Build+Cooling','KernelFunction','linear','KernelScale','auto','Standardize',true,'Leaveout','on');
Mdl_extension_lin = fitrsvm(table_mec_prop,'EaB~Heating+Build+Cooling','KernelFunction','linear','KernelScale','auto','Standardize',true,'Leaveout','on');
mseGau_tensile = kfoldLoss(Mdl_tensile_Gau);
mseGau_ymodulus = kfoldLoss(Mdl_ymodulus_Gau);
mseGau_extension = kfoldLoss(Mdl_extension_Gau);
mseLin_tensile = kfoldLoss(Mdl_tensile_lin);
mseLin_ymodulus = kfoldLoss(Mdl_ymodulus_lin);
mseLin_extension = kfoldLoss(Mdl_extension_lin);
Mdl_tensile = fitrsvm(table_mec_prop,'UTS~Heating+Build+Cooling','KernelFunction','linear','KernelScale','auto','Standardize',true,'Leaveout','on');
Mdl_ymodulus = fitrsvm(table_mec_prop,'YM~Heating+Build+Cooling','KernelFunction','linear','KernelScale','auto','Standardize',true,'Leaveout','on');
Mdl_extension = fitrsvm(table_mec_prop,'EaB~Heating+Build+Cooling','KernelFunction','linear','KernelScale','auto','Standardize',true,'Leaveout','on');
X = mec_prop_tempcooling20sec(:,1:3);
YSVMnew_tensile = predict(Mdl_tensile, X);
YSVMnew_ymodulus = predict(Mdl_ymodulus, X);
YSVMnew_extension = predict(Mdl_extension, X);
After running through the code i have obtained this error
Error using predict (line 84)
No valid system or dataset was specified.
Error in SVM_temp_regression_cooling20sec
(line 31)
YSVMnew_tensile = predict(Mdl_tensile, X);
The .mat file is attached below
Thanks in advance
0 commentaires
Réponse acceptée
Renee Coetsee
le 24 Mar 2017
I was able to run the code without error by removing the name value pair ('Leaveout', 'on) from the function call to "fitrsvm".
I saw in the documentation for "fitrsvm" that setting KFold, Holdout, Leaveout, CrossVal, or CVPartition creates a RegressionPartitionedSVM cross-validated model. Otherwise, it creates a RegressionSVM model.
The predict function is only used with "RegressionSVM" models. In the tips section, it says "If mdl is a cross-validated RegressionPartitionedSVM model, use kfoldpredict instead of predict to predict new response values." See that information at the following link:
Refer to the documentation page for "fitrsvm" for more information:
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Support Vector Machine Regression dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!