필터 지우기
필터 지우기

why inputs and targets have diffrent sampels?

조회 수: 2 (최근 30일)
Narges Sedre
Narges Sedre 2018년 11월 25일
답변: Greg Heath 2018년 11월 25일
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);

채택된 답변

Greg Heath
Greg Heath 2018년 11월 25일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by