trainNetwork error- categorical responses

3 visualizzazioni (ultimi 30 giorni)
Marianna Kocturova
Marianna Kocturova il 21 Ott 2020
Risposto: Srivardhan Gadila il 28 Ott 2020
Hi, I am not able to resolve the problem with my Neural network
I tried my network on example data set: Breast Cancer
inputs: cancerInputs 9x699
targets: cancerTargets 2x699
I change targets in categorical, but there is still the same error:
>> c = categorical(cancerTargets);
>> net = trainNetwork(cancerInputs,c,layers_4,options)
Error using trainNetwork (line 170)
Invalid training data. Responses must be a vector of categorical responses, or a cell array of categorical response sequences.

Risposte (1)

Srivardhan Gadila
Srivardhan Gadila il 28 Ott 2020
You can refer to the docoumenatation of trainNetwork.
As per your syntax of trainNetwork: net = trainNetwork(X,Y,layers,options), Y i.e., c in your question should be a N-by-1 categorical vector of labels, where N is the number of observations(=699 in your question). Make sure that the data format of your training data cancerInputs & c is according to the data format mentioned in the docoumenatation of trainNetwork.

Community Treasure Hunt

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

Start Hunting!

Translated by