필터 지우기
필터 지우기

I built a cross-validated SVM model with fitcsvm but I cant seem to use "predict" to predict responses from a new data with the model

조회 수: 21 (최근 30일)
Hi there
I built a cross validated and Bayesian Optimised model (CValidated_SVMModel_for_AUC1) with Support Vector Machines (SVM) on MATLAB with the "fitcsvm" syntax
I need to use the cross validated model to predict the responses from a new data (X_test)
I have tried to use this:
[Predicted_label,score] = kfoldPredict(CValidated_SVMModel_for_AUC1, X_test) without sucess
I have also tried to use:
[label,score] = predict(SVMModel_for_AUC1,X_test) without success
I will apprecaite if someone can advise me on how to resolve this
Thank You
  댓글 수: 5
NCA
NCA 2024년 6월 25일 21:52
편집: Adam Danz 2024년 6월 26일 13:14
It was created with crossval syntax specifically CVPartition cross validation tool
CValidated_SVMModel_for_AUC1=crossval(SVMModel_for_AUC1,'CVPartition',c_part)
Adam Danz
Adam Danz 2024년 6월 26일 13:21
In that case, it seems like kfoldPredict would the right tool. What error message or unexpected output are to getting with that? It would be easier to investigate this if you attach a mat file containing SVMModel_for_AUC1 and c_part.

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

채택된 답변

Muskan
Muskan 2024년 6월 26일 4:44
Hi
You can make sure that "CValidated_SVMModel_for_AUC1" is a cross-validated SVM model object created using "fitcsvm" and that it has been optimized and validated.
Cross-validated models contain multiple trained models (one for each fold). You need to extract the best trained model from the cross-validated object to use it for prediction. And you need to use the "predict" function with the extracted model.
You can refer to the following Stackoverflow answer for a better understanding:
I hope this helps!

추가 답변 (0개)

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by