- There is no object property named "myNet" for the above shallow neural network net. For information on properties of neural networks, refer to Neural Network Object Properties & Neural Network Subobject Properties.
- The function classify cannot be used on the above net object since it is a Shallow neural network and not a SeriesNetwork object or a DAGNetwork object. Refer to classify.
plot confusion for backpropagation output
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello im trying to plot confusion matrix for all where i can see accuracy of each class
as shown in
unfortunellty im getting constant error
SWITCH expression must be a scalar or a character vector.
code is below
%PREPROCESSING
%load data
Tb = readtable('train1.csv','PreserveVariableNames',true);
Tbv = readtable('test1.csv','PreserveVariableNames',true);
%merge both datasets they can be splitted to train target later via dynamic
%parameter
Tbt = union(Tb, Tbv)
%split into train target
TrainSet = Tbt(:,(1:562))%data.simplefitInputs';
TargetSet = Tbt(:,(563:563));%data.simplefitTargets';
TargetSet= table2array(TargetSet)
%make some noise
TrainSetArray = table2array(TrainSet)
noiseSignal = cos(5 * pi * 100 * TrainSetArray)+sqrt(5) * randn(size(TrainSetArray));
%TRAINING
x = TrainSetArray';
%x = noiseSignal';
t = TargetSet';
%t = categorical(Tb(:,(563:563)));FAILING DURING TRAINING
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize,trainFcn);
% Create a Fitting Network
hiddenLayerSize = 1;
net = fitnet(hiddenLayerSize,trainFcn);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,x,t);
%get output
y = net(x);
%get test set
testX = x(:,tr.testInd);
testT = t(:,tr.testInd);
testY = net(testX);
%PLOTTING CONFUSION MATRIXacorss classes as
% https://uk.mathworks.com/help/deeplearning/ref/plotconfusion.html
YPredicted = classify(net.myNet,testX)%Line Causing error SWITCH expression must be a scalar or a character vector.
plotconfusion(testy,YPredicted)
0 commentaires
Réponses (1)
Srivardhan Gadila
le 28 Mar 2020
The error is caused due to the input argument "net.myNet" in the classify function above.
The following are the errors in the above code:
4 commentaires
Srivardhan Gadila
le 28 Mar 2020
The fitnet is used for regression. The confusion matrix is used for classification problems.
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!