필터 지우기
필터 지우기

How to create a fitnet neural network with multiple hidden layers?

조회 수: 89 (최근 30일)
Robert Roos
Robert Roos 2019년 2월 19일
이동: KSSV 2022년 10월 17일
I am new to using the machine learning toolboxes of MATLAB (but loving it so far!)
From a large data set I want to fit a neural network, to approximate the underlying unknown function. I have used the "Neural Net Fitting" app and generated a script with it which builds and trains my network. It all works, however the results are not good enough. I think the network is not complex enough to cover the non-linearities. So, I figued I'd add another hidden layer, but I can't get it to work.
The current code to produce the network is the following (which is the default):
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize, trainFcn);
How would I modify this to add more hidden layers?
I am looking to get the classical Multi-Layer Perceptron (MLP) network, with potentially even more hidden layers:
  댓글 수: 2
Junior Barrera
Junior Barrera 2020년 9월 13일
Dear friends,
I would like to design a network, that I will call net_R similar to this one, but with the following charactersitics:
Design a basic module with four neurons:
w1x1 + w2x2 + k1<= 0
w1x1 + w2x2 + k2 > =0
-(1/w1)x1 + w2x2 + k3 <= 0
-(1/w1)x1 + w2x2 + k4 >=0
that is, net_R(x1,x2) = 1 <=> (x1,x2) is insided the rectangle nearned from a sample. Not that this 4 perceptrons network depends just of four parameters: (w1,w2,k1,k2,k3,k4). This should imply in less data due to the sharp
modeling that imply in smaller VC-dimension.
ii-design the netowork Net-4 that integrates 4 net_R(x1,x2) by the OR connective, that is,
Net-4(x1,x2) = 1 <=> net_R(y)(x1,x2)=1 for y=1,2,3 or 4,
y being the indides of the rectangle networks.
Thank you very much
Junior Barrera (Univrsity of SP - Brazil)
Robert Roos
Robert Roos 2020년 9월 14일
I don't think this is related to the original question. I think you'd better start a new question.

댓글을 달려면 로그인하십시오.

채택된 답변

Patel Mounika
Patel Mounika 2019년 2월 22일
You can add more hidden layers as shown below:
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
% Create a Fitting Network
hiddenLayer1Size = 10;
hiddenLayer2Size = 10;
net = fitnet([hiddenLayer1Size hiddenLayer2Size], trainFcn);
This creates network of 2 hidden layers of size 10 each.
Hope this helps.
  댓글 수: 5
CARLOS MAURICIO RUIZ DIAZ
CARLOS MAURICIO RUIZ DIAZ 2022년 2월 20일
Thanks mi friend, I had the same question!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by