Azzera filtri
Azzera filtri

why inputs and targets have diffrent sampels?

2 visualizzazioni (ultimi 30 giorni)
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);

Risposta accettata

Greg Heath
Greg Heath il 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

Più risposte (0)

Categorie

Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by