libsvm
libsvm copied to clipboard
Error when using svmpredict in matlab
I succeeded in creating a svm struct model with svmtrain in matlab, but when I tried to use svmpredict to do further prediction, only to find that the output of the svmpredict were all empty. What should I do?
Below is the code I used to do the prediction.
[predict_label_1,accuracy_1] = svmpredict_01(train_label,Train_matrix,model);
Thank you very much.
I succeeded in creating a svm struct model with svmtrain in matlab, but when I tried to use svmpredict to do further prediction, only to find that the output of the svmpredict were all empty. What should I do? Below is the code I used to do the prediction.
[predict_label_1,accuracy_1] = svmpredict_01(train_label,Train_matrix,model);
Thank you very much.
Sorry I forgot to mention that since the matlab version I used is the latest, and in matlab 'svmtrain' is also a function. and this function has been removed, but in the libsvm you provided 'svmtrain' is still used, so I changed the name of the mex file from 'svmtrain' to 'svmtrain_01' (Because if not doing so, matlab will automatically output an error message which said 'function 'svmtrain' has been removed, use 'fitcsvm' instead'), and in order to keep consistence, I also changed the 'svmpredict.mexw64' file to 'svmpredict_01.mexw64'. And this is why I used 'svmpredict_01' in the code above.
Could you show more details (e.g. training and screen output of traing)? SeaBroNoMeal writes:
I succeeded in creating a svm struct model with svmtrain in matlab, but when I tried to use svmpredict to do further prediction, only to find that the output of the svmpredict were all empty. What should I do? Below is the code I used to do the prediction. [predict_label_1,accuracy_1] = svmpredict_01 (train_label,Train_matrix,model); Thank you very much.
Sorry I forgot to mention that since the matlab version I used is the latest, and in matlab 'svmtrain' is also a function. and this function has been removed, but in the libsvm you provided 'svmtrain' is still used, so I changed the name of the mex file from 'svmtrain' to 'svmtrain_01' (Because if not doing so, matlab will automatically output an error message which said 'function 'svmtrain' has been removed, use 'fitcsvm' instead'), and in order to keep consistence, I also changed the 'svmpredict.mexw64' file to 'svmpredict_01.mexw64'. And this is why I used 'svmpredict_01' in the code above.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.*
Could you show more details (e.g. training and screen output of traing)? SeaBroNoMeal writes: I succeeded in creating a svm struct model with svmtrain in matlab, but when I tried to use svmpredict to do further prediction, only to find that the output of the svmpredict were all empty. What should I do? Below is the code I used to do the prediction. [predict_label_1,accuracy_1] = svmpredict_01 (train_label,Train_matrix,model); Thank you very much. Sorry I forgot to mention that since the matlab version I used is the latest, and in matlab 'svmtrain' is also a function. and this function has been removed, but in the libsvm you provided 'svmtrain' is still used, so I changed the name of the mex file from 'svmtrain' to 'svmtrain_01' (Because if not doing so, matlab will automatically output an error message which said 'function 'svmtrain' has been removed, use 'fitcsvm' instead'), and in order to keep consistence, I also changed the 'svmpredict.mexw64' file to 'svmpredict_01.mexw64'. And this is why I used 'svmpredict_01' in the code above. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.*
I used the following test code to train a svm model, and the returned model is shown as follows.
load carsmall; X = [Horsepower,Weight]; Y = MPG; n = randperm(size(X,1)); Train_data = X(n(1:80),:); Train_label = Y(n(1:80),:); Test_data = X(n(81:end),:); Test_label = Y(n(81:end),:); model_test = svmtrain_01(Train_label,Train_data); [predict_label,acc] = svmpredict_01(Test_label,Test_data,model_test);
And the returned value of svmpredict function were all empty.
what's the screen output of model_test = svmtrain_01(Train_label,Train_data); SeaBroNoMeal writes:
Could you show more details (e.g. training and screen output of traing)? SeaBroNoMeal writes: I succeeded in creating a svm struct model with svmtrain in matlab, but when I tried to use svmpredict to do further prediction, only to find that the output of the svmpredict were all empty. What should I do? Below is the code I used to do the prediction. [predict_label_1,accuracy_1] = svmpredict_01 (train_label,Train_matrix,model); Thank you very much. Sorry I forgot to mention that since the matlab version I used is the latest, and in matlab 'svmtrain' is also a function. and this function has been removed, but in the libsvm you provided 'svmtrain' is still used, so I changed the name of the mex file from 'svmtrain' to 'svmtrain_01' (Because if not doing so, matlab will automatically output an error message which said 'function 'svmtrain' has been removed, use 'fitcsvm' instead'), and in order to keep consistence, I also changed the 'svmpredict.mexw64' file to 'svmpredict_01.mexw64'. And this is why I used 'svmpredict_01' in the code above. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.*
I used the following test code to train a svm model, and the returned model is shown as follows. load carsmall; X = [Horsepower,Weight]; Y = MPG; n = randperm (size(X,1)); Train_data = X(n(1:80),:); Train_label = Y(n (1:80),:); Test_data = X(n(81:end),:); Test_label = Y(n (81:end),:); model_test = svmtrain_01(Train_label,Train_data); [predict_label,acc] = svmpredict_01 (Test_label,Test_data,model_test);
pj b do5
And the returned value of svmpredict function were all empty. fxb j_el
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.*
what's the screen output of model_test = svmtrain_01(Train_label,Train_data); SeaBroNoMeal writes: Could you show more details (e.g. training and screen output of traing)? SeaBroNoMeal writes: I succeeded in creating a svm struct model with svmtrain in matlab, but when I tried to use svmpredict to do further prediction, only to find that the output of the svmpredict were all empty. What should I do? Below is the code I used to do the prediction. [predict_label_1,accuracy_1] = svmpredict_01 (train_label,Train_matrix,model); Thank you very much. Sorry I forgot to mention that since the matlab version I used is the latest, and in matlab 'svmtrain' is also a function. and this function has been removed, but in the libsvm you provided 'svmtrain' is still used, so I changed the name of the mex file from 'svmtrain' to 'svmtrain_01' (Because if not doing so, matlab will automatically output an error message which said 'function 'svmtrain' has been removed, use 'fitcsvm' instead'), and in order to keep consistence, I also changed the 'svmpredict.mexw64' file to 'svmpredict_01.mexw64'. And this is why I used 'svmpredict_01' in the code above. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.* I used the following test code to train a svm model, and the returned model is shown as follows. load carsmall; X = [Horsepower,Weight]; Y = MPG; n = randperm (size(X,1)); Train_data = X(n(1:80),:); Train_label = Y(n (1:80),:); Test_data = X(n(81:end),:); Test_label = Y(n (81:end),:); model_test = svmtrain_01(Train_label,Train_data); [predict_label,acc] = svmpredict_01 (Test_label,Test_data,model_test); pj b do5 And the returned value of svmpredict function were all empty. fxb j_el — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.*
It's a long screen output of training status and the last status is:
After training can you type
model_test
to see how the model looks like
SeaBroNoMeal writes:
what's the screen output of model_test = svmtrain_01 (Train_label,Train_data); SeaBroNoMeal writes: Could you show more details (e.g. training and screen output of traing)? SeaBroNoMeal writes: I succeeded in creating a svm struct model with svmtrain in matlab, but when I tried to use svmpredict to do further prediction, only to find that the output of the svmpredict were all empty. What should I do? Below is the code I used to do the prediction. [predict_label_1,accuracy_1] = svmpredict_01 (train_label,Train_matrix,model); Thank you very much. Sorry I forgot to mention that since the matlab version I used is the latest, and in matlab 'svmtrain' is also a function. and this function has been removed, but in the libsvm you provided 'svmtrain' is still used, so I changed the name of the mex file from 'svmtrain' to 'svmtrain_01' (Because if not doing so, matlab will automatically output an error message which said 'function 'svmtrain' has been removed, use 'fitcsvm' instead'), and in order to keep consistence, I also changed the 'svmpredict.mexw64' file to 'svmpredict_01.mexw64'. And this is why I used 'svmpredict_01' in the code above. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.* I used the following test code to train a svm model, and the returned model is shown as follows. load carsmall; X = [Horsepower,Weight]; Y = MPG; n = randperm (size(X,1)); Train_data = X(n(1:80),:); Train_label = Y(n (1:80),:); Test_data = X(n(81:end),:); Test_label = Y(n (81:end),:); model_test = svmtrain_01(Train_label,Train_data); [predict_label,acc] = svmpredict_01 (Test_label,Test_data,model_test); pj b do5 And the returned value of svmpredict function were all empty. fxb j_el — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.*
It's a long screen output of training status and the last status is: m7y2i6 a
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.*
I have provided the property of the returning model above, it's:
After training can you type
model_test to see how the model looks like SeaBroNoMeal writes: what's the screen output of model_test = svmtrain_01 (Train_label,Train_data); SeaBroNoMeal writes: Could you show more details (e.g. training and screen output of traing)? SeaBroNoMeal writes: I succeeded in creating a svm struct model with svmtrain in matlab, but when I tried to use svmpredict to do further prediction, only to find that the output of the svmpredict were all empty. What should I do? Below is the code I used to do the prediction. [predict_label_1,accuracy_1] = svmpredict_01 (train_label,Train_matrix,model); Thank you very much. Sorry I forgot to mention that since the matlab version I used is the latest, and in matlab 'svmtrain' is also a function. and this function has been removed, but in the libsvm you provided 'svmtrain' is still used, so I changed the name of the mex file from 'svmtrain' to 'svmtrain_01' (Because if not doing so, matlab will automatically output an error message which said 'function 'svmtrain' has been removed, use 'fitcsvm' instead'), and in order to keep consistence, I also changed the 'svmpredict.mexw64' file to 'svmpredict_01.mexw64'. And this is why I used 'svmpredict_01' in the code above. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.* I used the following test code to train a svm model, and the returned model is shown as follows. load carsmall; X = [Horsepower,Weight]; Y = MPG; n = randperm (size(X,1)); Train_data = X(n(1:80),:); Train_label = Y(n (1:80),:); Test_data = X(n(81:end),:); Test_label = Y(n (81:end),:); model_test = svmtrain_01(Train_label,Train_data); [predict_label,acc] = svmpredict_01 (Test_label,Test_data,model_test); pj b do5 And the returned value of svmpredict function were all empty. fxb j_el — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.* It's a long screen output of training status and the last status is: m7y2i6 a — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.*
Hello, are you still there ?
hello, can you find any solution? i am also getting the same error. thanks
Do you also get empty output of svmpredict?
If so, could you send us your input of calling svmpredict
On 2019-07-19 02:36, laxmi-priya wrote:
hello, can you find any solution? i am also getting the same error. thanks
-- You are receiving this because you commented. Reply to this email directly, view it on GitHub [1], or mute the thread [2]. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/cjlin1/libsvm/issues/132?email_source=notifications\u0026email_token=ABI3BHUJMBUR2ZDRCPMYY5LQAGDLDA5CNFSM4GOIHCFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2LEJFA#issuecomment-513164436", "url": "https://github.com/cjlin1/libsvm/issues/132?email_source=notifications\u0026email_token=ABI3BHUJMBUR2ZDRCPMYY5LQAGDLDA5CNFSM4GOIHCFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2LEJFA#issuecomment-513164436", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
Links:
[1] https://github.com/cjlin1/libsvm/issues/132?email_source=notifications&email_token=ABI3BHUJMBUR2ZDRCPMYY5LQAGDLDA5CNFSM4GOIHCFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2LEJFA#issuecomment-513164436 [2] https://github.com/notifications/unsubscribe-auth/ABI3BHUOY2B7TRTNGHEE7HTQAGDLDANCNFSM4GOIHCFA
thanks ..the calling function is
[predict_label] = svmpredict(1, fe, model, '-b 0');
fe=[16.6355703299288 5.50239876948526 0.129682384057353 1.46400155085363 4.09956767886523 8.53661824811379 3.12358725188358 -0.255924946091940 1.68789128840180 1.33213123121757 -1.05335395199421 0.486931074011915 0.723009120298510 -1.11653922246564 0.245289861986370 0.330718833003371 0.336561455519822 -0.448193560013909 0.0928036970400240 0.115427375679267 0.710506841834280 0.899065229298500 0.982948775277088]
model=
Your model should have a field sv_indices But it's missing?? How did you do the training?
Then in prediction fields related to prob outputs On 2019-07-21 06:00, laxmi-priya wrote:
thanks ..the calling function is [predict_label] = svmpredict(1, fe, model, '-b 0'); fe=[16.6355703299288 5.50239876948526 0.129682384057353 1.46400155085363 4.09956767886523 8.53661824811379 3.12358725188358 -0.255924946091940 1.68789128840180 1.33213123121757 -1.05335395199421 0.486931074011915 0.723009120298510 -1.11653922246564 0.245289861986370 0.330718833003371 0.336561455519822 -0.448193560013909 0.0928036970400240 0.115427375679267 0.710506841834280 0.899065229298500 0.982948775277088] model= [1]
-- You are receiving this because you commented. Reply to this email directly, view it on GitHub [2], or mute the thread [3]. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/cjlin1/libsvm/issues/132?email_source=notifications\u0026email_token=ABI3BHXJ5IU7YY3XGPU6HKDQARMXRA5CNFSM4GOIHCFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2ODAII#issuecomment-513552417", "url": "https://github.com/cjlin1/libsvm/issues/132?email_source=notifications\u0026email_token=ABI3BHXJ5IU7YY3XGPU6HKDQARMXRA5CNFSM4GOIHCFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2ODAII#issuecomment-513552417", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
Links:
[1] https://user-images.githubusercontent.com/27006197/61591485-0ae2b180-abe5-11e9-80a1-de655b06a7f9.png [2] https://github.com/cjlin1/libsvm/issues/132?email_source=notifications&email_token=ABI3BHXJ5IU7YY3XGPU6HKDQARMXRA5CNFSM4GOIHCFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2ODAII#issuecomment-513552417 [3] https://github.com/notifications/unsubscribe-auth/ABI3BHXKZKCVTI2BGHMSEELQARMXRANCNFSM4GOIHCFA