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