Why I can't load data to Classification Learner App

5 visualizaciones (últimos 30 días)
Raihan Khalil
Raihan Khalil el 30 de Nov. de 2024
Respondida: Drew el 9 de Dic. de 2024
After selecting the trainData I cannot select response.
Screenshot
trainData is prepared like this
Last column is the label.
  3 comentarios
Subhajyoti
Subhajyoti el 30 de Nov. de 2024
I tried to reproduce the error you are facing using the ' Train Decision Trees Using Classification Learner App' example and the 'Response' select options are active.
fishertable = readtable("fisheriris.csv")
fishertable = 150x5 table
SepalLength SepalWidth PetalLength PetalWidth Species ___________ __________ ___________ __________ __________ 5.1 3.5 1.4 0.2 {'setosa'} 4.9 3 1.4 0.2 {'setosa'} 4.7 3.2 1.3 0.2 {'setosa'} 4.6 3.1 1.5 0.2 {'setosa'} 5 3.6 1.4 0.2 {'setosa'} 5.4 3.9 1.7 0.4 {'setosa'} 4.6 3.4 1.4 0.3 {'setosa'} 5 3.4 1.5 0.2 {'setosa'} 4.4 2.9 1.4 0.2 {'setosa'} 4.9 3.1 1.5 0.1 {'setosa'} 5.4 3.7 1.5 0.2 {'setosa'} 4.8 3.4 1.6 0.2 {'setosa'} 4.8 3 1.4 0.1 {'setosa'} 4.3 3 1.1 0.1 {'setosa'} 5.8 4 1.2 0.2 {'setosa'} 5.7 4.4 1.5 0.4 {'setosa'}
% Convert the cell array to a categorical array
categoryCategorical = categorical(fishertable.Species);
% Convert the categorical array to a double array
categoryDouble = double(categoryCategorical);
fishertable.Species = categoryDouble;
trainData = table2array(fishertable)
trainData = 150×5
5.1000 3.5000 1.4000 0.2000 1.0000 4.9000 3.0000 1.4000 0.2000 1.0000 4.7000 3.2000 1.3000 0.2000 1.0000 4.6000 3.1000 1.5000 0.2000 1.0000 5.0000 3.6000 1.4000 0.2000 1.0000 5.4000 3.9000 1.7000 0.4000 1.0000 4.6000 3.4000 1.4000 0.3000 1.0000 5.0000 3.4000 1.5000 0.2000 1.0000 4.4000 2.9000 1.4000 0.2000 1.0000 4.9000 3.1000 1.5000 0.1000 1.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Cris LaPierre
Cris LaPierre el 30 de Nov. de 2024
Editada: Cris LaPierre el 30 de Nov. de 2024
Just a thought, but I think you have too many unique response values.
  • Predictor and response variables can be numeric, categorical, string, or logical vectors, cell arrays of character vectors, or character arrays. The response variable cannot contain more than 500 unique class labels. (ref)
Confirm that you want to perform classification. If so, select a subset of your data (<500 rows) and load that into the Classification Learner App. Let us know if that fixes the problem.

Iniciar sesión para comentar.

Respuestas (1)

Drew
Drew el 9 de Dic. de 2024
Since all of the data is of type "double", perhaps you had intended to use Regression Learner app?
If classification is intended, how many unique values (classes) are there for the response variable?

Community Treasure Hunt

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

Start Hunting!

Translated by