Error using classreg.learning.internal.table2PredictMatrix>makeXMatrix (line 97) Table variable job is not a valid predictor.
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Tejal Mehta
le 6 Déc 2020
Réponse apportée : Aditya Patil
le 22 Déc 2020
I am getting this error while predicting values for cross validated model - Error using classreg.learning.internal.table2PredictMatrix>makeXMatrix (line 97)
Table variable job is not a valid predictor.
Here is my code -
pt = cvpartition(bank_data.y,'holdout',0.35);
bank_Train = bank_data(training(pt),:);
bank_Test = bank_data(test(pt),:);
treeMdlCv= fitctree(bank_Train,'y','KFold',5); % y is the response variable
predictions = predict(treeMdlCv.Trained{2},bank_Test); %above error on running this line of code
CategoricalPredictors: [2 3 4 5 7 8 9 11 16]
I have attached my data file as well.
0 commentaires
Réponse acceptée
Aditya Patil
le 22 Déc 2020
A KFold partitioned model should only be used to predict on the training dataset itself(Using kfoldpredict, for example). Once you are satisfied with the results, it's better to train the same model on the entire dataset, by not giving the KFold parameter. Then use that model for prediction.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dimensionality Reduction and Feature Extraction dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!