Skip to content

Commit

Permalink
Update Example weights
Browse files Browse the repository at this point in the history
Better parameters based on dynamic optimization.

Co-authored-by: linuslangenkamp <[email protected]>
  • Loading branch information
phannebohm and linuslangenkamp committed Jan 25, 2025
1 parent 56d9989 commit 04d76e5
Show file tree
Hide file tree
Showing 3 changed files with 507 additions and 506 deletions.
1 change: 1 addition & 0 deletions NeuralNetwork/Examples/HelloWorld.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ model HelloWorld
Placement(transformation(origin = {40, -30}, extent = {{-20, -20}, {20, 20}})));
Real reference = eq.y;
Real prediction = nn.y;
Real error = reference - prediction;
equation
connect(sine.y, eq.u) annotation(
Line(points = {{-38, 0}, {-20, 0}, {-20, 30}, {16, 30}}, color = {0, 0, 127}));
Expand Down
8 changes: 4 additions & 4 deletions NeuralNetwork/Examples/Utilities/SimpleNetwork.mo
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ block SimpleNetwork "Neural Network approximating y = u*u + 0.5*u - 2.0 on inter
) annotation(
Placement(transformation(origin = {50, 0}, extent = {{-30, -30}, {30, 30}})));

parameter Real[2,1] layer_1_weights = {{-0.95248}, {-0.943175}};
parameter Real[2] layer_1_bias = {0.872633, -0.949252};
parameter Real[1,2] layer_2_weights = {{-2.25385, 1.40389}};
parameter Real[1] layer_2_bias = {0.60548};
parameter Real[2,1] layer_1_weights = {{-0.7039596170222842}, {-0.8750912730224503}};
parameter Real[2] layer_1_bias = {1.169784394444224, -1.344723440170712};
parameter Real[1,2] layer_2_weights = {{-4.513856227908402, 2.4932885356708683}};
parameter Real[1] layer_2_bias = {3.897109323824147};
equation
connect(inputLayer.y, outputLayer.u) annotation(
Line(points = {{-48, 0}, {30, 0}}, color = {0, 0, 127}, thickness = 0.5));
Expand Down
Loading

0 comments on commit 04d76e5

Please sign in to comment.