Error using trainNetwork (line 154) Unable to perform assignment because the size of the left side is 56-by-1 and the size of the right side is 56-by-2571.

1 visualización (últimos 30 días)
i have a keystroke dataset of 71 features, 56 classes and 2857 records. when training i keep seeing "error during training" i need help.....
%Importing the keystroke data.
filename = "MobileKSD2016.csv";
data = readtable(filename);
head(data)
%Convert the labels in the class column of the table to categorical
data.class = categorical(data.class);
f = figure;
f.Position(3) = 1.5*f.Position(3);
h = histogram(data.class);
xlabel("Class")
ylabel("Frequency")
title("Class Distribution")
%Partition the data into a training partition and a held-out test set. Specify the holdout percentage to be 10%.
cvp = cvpartition(data.class,'Holdout',0.1);
dataTrain = data(training(cvp),:);
dataTest = data(test(cvp),:);
textDataTrain = dataTrain.Pressure;
textDataTest = dataTest.Pressure;
YTrain = dataTrain.class;
YTest = dataTest.class;
XTrain = ([1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]');
inputSize = 71;
outputSize = 180;
numClasses = numel(categories(YTrain));
layers = [ ...
sequenceInputLayer(inputSize)
lstmLayer(outputSize,'OutputMode','sequence')
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer]
options = trainingOptions('adam', ...
'GradientThreshold',1, ...
'InitialLearnRate',0.01, ...
'Plots','training-progress', ...
'Verbose',0);
net = trainNetwork(XTrain,YTrain,layers,options);...this line gives the error
YPred = classify(net,YTest);
accuracy = sum(YPred == YTest)/numel(YPred)

Respuestas (0)

Categorías

Más información sobre Electrophysiology 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!

Translated by