필터 지우기
필터 지우기

Multiple Inputs for Neural Network binary classification (Error Input/Target of different numbers of samples)

조회 수: 5 (최근 30일)
Hi,
I cannot seem to get the following code to run with 3 matrix inputs (IN_1, IN_2, IN_3) and binary output (0, 1). Each of the input matrix is 30,000 x 2,000 where the row is my input/signal. Below is what I have:
x = 3 x 1 cell of 30,000 x 2000
t = 1 x 30,000
Error using network/train (line 347)
Inputs and targets have different numbers of samples.
[net,tr] = train(net,x,t);
Below is what I have:
% Solve a Pattern Recognition Problem with a Neural Network
% Script generated by Neural Pattern Recognition app
inputData = {IN_1, IN_2, IN_3};
x = inputData';
t = target';
% Choose a Training Function
% For a list of all training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'traincgf'; % Scaled conjugate gradient backpropagation. traincgf
% Create a Pattern Recognition Network
hiddenLayerSize = 50;
net = patternnet(hiddenLayerSize, trainFcn);
net.numinputs = 3;
net = configure(net,x);
net.inputConnect = [1 1 1; 0 0 0];
% Train the Network
[net,tr] = train(net,x,t);

채택된 답변

Wookie
Wookie 2022년 3월 22일
inputData = {IN_1'; IN_2'; IN_3'};
x = inputData';
t = target';
trainFcn = 'traincgf';
% Create a Pattern Recognition Network
hiddenLayerSize = 50;
net = patternnet(hiddenLayerSize, trainFcn);
net.numinputs = 3;
net = configure(net,x);
net.inputConnect = [1 1 1; 0 0 0];
% Train the Network
[net,tr] = train(net,x,t);

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by