What is causing the error from matlab predict function? Also, how to format data to use in classifier validation?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Using MATLAB 2015a Classification Learner App, I've trained a Cubic SVM model. I'd like to validate a new data point with this model, but on attempt the following error is produced:
Variables have been created in the base workspace.
To use the exported classifier 'trainedClassifier1' to make predictions on new data, T, use
yfit = predict(trainedClassifier1, T{:,trainedClassifier1.PredictorNames})
If your new data contains any integer variables, then preprocess the data to doubles like this:
X = table2array(varfun(@double, T(:,trainedClassifier1.PredictorNames)));
yfit = predict(trainedClassifier1, X)
>> T = featureMatrix(:,7);
>> yfit = predict(trainedClassifier1, T{:,trainedClassifier1.PredictorNames})
Error using numel
Bad subscripting index.
What is causing this error?
Also, my training data was 4629x8, where the eighth column was the label (response). For the new data, the eighth column has been removed, i.e., 433x7, since the label column should not be needed (or in practice is not known). Is this the correct data format?
0 comentarios
Respuestas (2)
Brendan Hamm
el 22 de Mayo de 2015
Given the error it seems that maybe your data contains values which are not doubles (i.e. integers) which need to first be cast to doubles. The error even suggests to you how to do this. If you provide your code this would make it much easier to figure out what is going on, as otherwise I am guessing based on the error.
2 comentarios
MEENU SAINI
el 10 de Mayo de 2018
Editada: Walter Roberson
el 30 de En. de 2025 a las 5:12
0 comentarios
Ver también
Categorías
Más información sobre Get Started with Statistics and Machine Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!