why inputs and targets have diffrent sampels?

6 Ansichten (letzte 30 Tage)
Narges Sedre
Narges Sedre am 25 Nov. 2018
Beantwortet: Greg Heath am 25 Nov. 2018
why do i get this error? iam trying to train a neural network.80%of my data is training data and the rest is test.
Error using network/train (line 340)
Inputs and targets have different numbers of samples.
Error in Untitled3 (line 20)
net= train(net,set',t');
this is my code.
clc
clear all
close all
filename='FIFA2.xlsx';
A =xlsread(filename);
[m,n]=size(A);
T=A(:,1);
data=A(:,(2:end));
[m,n]=size(A);
rows=int32(floor(0.8 * m));
set=A(1:rows,:);
testset=A(rows+1:end,2:n);
t=set(1:rows);
t_test=testset(rows:end);
net= newff(set',t');
y=sim(net,set');
% net.trainParam.epoch=20;
net= train(net,set',t');
y=sim(net,set');
hardlims(y);

Akzeptierte Antwort

Greg Heath
Greg Heath am 25 Nov. 2018
For I-dimensional "I"nputs and O-dimensional "O"utput targets
After reading in inputs and targets
ALWAYS CHECK THE DIMENSIONS !!!
[ I Ni ] = size(input)
[ O Nt ] = size(target)
if Nt == Ni
N = Ni
else
error
end
Hope this helps
Thank you for formally accepting my answer
Greg

Weitere Antworten (0)

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by