Check for missing argument or incorrect argument data type in call to function 'predict'.
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tejal Mehta
am 6 Dez. 2020
Kommentiert: Tejal Mehta
am 6 Dez. 2020
I am trying to predict values of cross-validated model using training data.But I am getting this error -
Check for missing argument or incorrect argument data type in call to function 'predict'.
The code I am using is as below -
mdlCv= fitctree(bank_Train,'y','KFold',10); %bank_Train is the training data
[label,scores] = predict(mdlCv,bank_Test); %bank_Test is the testing data
If I try to use below code then also I am getting the error
[label,scores] = predict(mdlCv.Trained{1},bank_Test);
Error using classreg.learning.internal.table2PredictMatrix>makeXMatrix (line 97)
Table variable job is not a valid predictor.
Error in classreg.learning.internal.table2PredictMatrix (line 47)
Xout = makeXMatrix(X,CategoricalPredictors,vrange,pnames);
Error in classreg.learning.classif.CompactClassificationTree/predict (line 894)
X = classreg.learning.internal.table2PredictMatrix(X,[],[],...
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 6 Dez. 2020
Bearbeitet: Walter Roberson
am 6 Dez. 2020
For cross-validated classification trees, create a classification partitioned object, https://www.mathworks.com/help/stats/classreg.learning.partition.classificationpartitionedmodel-class.html using fitctree https://www.mathworks.com/help/stats/fitctree.html#bt6cr7t-tree and use kfoldPredict https://www.mathworks.com/help/stats/classificationpartitionedmodel.kfoldpredict.html
You are using 'KFold' so you are creating a classification partitioned object and need to use kfoldPredict() instead of predict()
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!