How to create a fitnet neural network with multiple hidden layers?
70 ビュー (過去 30 日間)
古いコメントを表示
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
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)
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File 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!