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

5 visualizaciones (últimos 30 días)
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);

Respuesta aceptada

Wookie
Wookie el 22 de Mzo. de 2022
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);

Más respuestas (0)

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by