Neural network construction where different outputs have different dependencies on the inputs
1 view (last 30 days)
Show older comments
I want to construct a neural network for a system which is described by the image below. The arrows in the images shows the dependencies of the variables in the system (e.g.,
is dependent on
). I have two inputs
and
and
outputs
and
,
,...,
,
. Three intermediate variables
,
and
connect the inputs and outputs together, while the outputs
,
,...,
,
have dependencies sequentially and
is dependent on all the
. How can I construct a neural network where the inputs are
and
and the outputs are
and
,
,...,
,
?
is dependent on
and
,
. Three intermediate variables
,
and
connect the inputs and outputs together, while the outputs
,
have dependencies sequentially and
and the outputs are
,
?
1 Comment
Ben
on 9 Apr 2024
The diagram suggests
depends on
and
depend on
(via
). Could you clarify how the simultaneous dependency should be handled?
One way might be a recurrent style network - all the variables are actually time series, and
depends on
, while
depend on
. You would hook up a neural network with the
and
as outputs and write code to feed the
back into the network at the next time step.
Answers (1)
Jayanti
on 3 Oct 2024
Hi Xuming,
You can start by defining all the layer component with appropriate size. Let’s assume you have input layer
of size 10 (you can choose according to your requirement).
x_A = featureInputLayer(10, 'Name', 'x_a');
Similarly, you can create another input layer
.
Now you can create intermediate layer
of (suppose) size=20.
I_1 = fullyConnectedLayer(20, 'Name', 'I_1');
Similarly create other two layers
and
.
For explanation, I am assuming n=3 that is we have three layers which is referred as
,
and
. You can extend this to any value of n. Below code will create layer
with size=10.
y_B1 = fullyConnectedLayer(10, 'Name', 'y_b1');
Similarly define for other layers like
and
,
.
Now you need to connect all the layers according to your need. I am attaching the code for your reference.
layers = connectLayers(layers, 'x_a', 'I_1');
layers = connectLayers(layers, 'I_1', 'I_2');
layers = connectLayers(layers, 'I_2', 'I_3');
layers = connectLayers(layers, 'x_b', 'y_b1');
layers = connectLayers(layers, 'x_b', 'y_b2');
layers = connectLayers(layers, 'x_b', 'y_b3');
layers = connectLayers(layers, 'I_3', 'y_b1');
layers = connectLayers(layers, 'y_b1', 'y_a/in1');
layers = connectLayers(layers, 'y_b2', 'y_a/in2');
layers = connectLayers(layers, 'y_b3', 'y_a/in3');
layers = connectLayers(layers, 'y_a', 'I_3');
Also I am attaching the documentation link for various layers for your reference:
Hope this helps!
0 Comments
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!