You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 11_ultima_online/11_ultima_online.jl
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -109,7 +109,7 @@ plot(sol)
109
109
# ╔═╡ 4aff3714-284b-11eb-2047-814ca175e07b
110
110
md"""#### Obtaining the model from the data
111
111
112
-
Back to the terrible case of Ultima Online. Suppose we had data on the population of predators and prey that were in harmony during the game at a given time. If we wanted to venture out and analyze what parameters Garriot and his team used to model their great ecosystem, would it be possible? Of course it is, we just need to add a little Bayesianism.
112
+
Back to the terrible case of Ultima Online. Suppose we had data on the population of predators and prey that were in harmony during the game at a given time. If we wanted to venture out and analyze what parameters Garriott and his team used to model their great ecosystem, would it be possible? Of course it is, we just need to add a little Bayesianism.
Copy file name to clipboardExpand all lines: 12_ultima_continued/12_ultima_continued.jl
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,7 @@ Let´s see how were the system equilibrium that he decided.
102
102
103
103
# ╔═╡ 247a6e7e-5417-11eb-3509-3d349198ec43
104
104
begin
105
-
#The Lotka-Volterra model Garriot define for Ultima Online
105
+
#The Lotka-Volterra model Garriott define for Ultima Online
106
106
107
107
functionlotka_volterra(du,u,p,t)
108
108
prey, pred = u
@@ -132,15 +132,15 @@ md"""So the system seems in complete equilibrium.
132
132
133
133
And finally we arrive at the day when the madness begins.
134
134
135
-
Garriot wakes up early, doesn´t have any breakfast and goes to meet his team. Everything is ready. The countdown start: 3, 2, 1... And the game is online, running.
135
+
Garriott wakes up early, doesn´t have any breakfast and goes to meet his team. Everything is ready. The countdown start: 3, 2, 1... And the game is online, running.
136
136
137
-
After the champagne, hugs and a little celebration Garriot returns to work and starts to analyze the metrics to see if everything is alright, and it does. He relax a little bit until something calls his attention: The curves of carnivorous and herbivorous animals are a little different than they should be. There are still **too few points** (only four hours from the release) to be alarmed, but he decides to do a deeper analysis. Luckily, a few days ago, he had read a paper on the Universal ODEs, so he thinks they can help him in this case.
137
+
After the champagne, hugs and a little celebration Garriott returns to work and starts to analyze the metrics to see if everything is alright, and it does. He relax a little bit until something calls his attention: The curves of carnivorous and herbivorous animals are a little different than they should be. There are still **too few points** (only four hours from the release) to be alarmed, but he decides to do a deeper analysis. Luckily, a few days ago, he had read a paper on the Universal ODEs, so he thinks they can help him in this case.
138
138
"""
139
139
140
140
# ╔═╡ 3bb32294-5423-11eb-1c75-27dc2f242255
141
141
functionlotka_volterra_players(du,u,p,t)
142
142
#Lotka-Volterra function with players that hunt
143
-
#Of course, Garriot doesn´t know about this new players part of the equation.
143
+
#Of course, Garriott doesn´t know about this new players part of the equation.
144
144
#He only saw some differences in the real curve vs the one he expected.
145
145
146
146
birth_prey, mort_prey, birth_pred, mort_pred, players_prey, players_pred = p
@@ -159,7 +159,7 @@ end;
159
159
160
160
# ╔═╡ 8de32f8c-5423-11eb-24c6-5be06370cb3f
161
161
begin
162
-
scatter(solution, alpha =0.25, title="The data Garriot was seeing")
162
+
scatter(solution, alpha =0.25, title="The data Garriott was seeing")
163
163
plot!(solution, alpha =0.5)
164
164
end
165
165
@@ -171,7 +171,7 @@ end;
171
171
172
172
# ╔═╡ 5d5c55a0-5426-11eb-0e93-27e67f42dc8e
173
173
begin
174
-
scatter(expected_solution, alpha =0.25, title="The data Garriot was expecting to see")
174
+
scatter(expected_solution, alpha =0.25, title="The data Garriott was expecting to see")
175
175
plot!(expected_solution, alpha =0.5)
176
176
end
177
177
@@ -204,7 +204,7 @@ end
204
204
205
205
# ╔═╡ a0b0497a-5436-11eb-0bad-f564c6033968
206
206
md"""
207
-
So lets stop for a minute to analize the code that Garriot just propose.
207
+
So lets stop for a minute to analize the code that Garriott just propose.
208
208
209
209
In the first two lines, he just define the Neural Network that is going to learn the missing components of the two equations (one for the dynamics of the Pray and other for the dynamics of the Predator) and fill the variable p with its untrained parameters.
So, as we already know, he is just adding a **function**. Which one? We already know that those are $Prey*players_{prey}$ and $Pred*players_{pred}$ (and $players_{pred}=players_{prey}=0.4$), but Garriot doesn´t, and is exactly what the Neural Network is going to learn for him.
217
+
So, as we already know, he is just adding a **function**. Which one? We already know that those are $Prey*players_{prey}$ and $Pred*players_{pred}$ (and $players_{pred}=players_{prey}=0.4$), but Garriott doesn´t, and is exactly what the Neural Network is going to learn for him.
218
218
219
219
"""
220
220
@@ -286,7 +286,7 @@ plot!(solution.t, X', title="The trained NN have fitted well")
286
286
end
287
287
288
288
# ╔═╡ 58a1294c-544c-11eb-27ca-8512bc3d5461
289
-
md"""Nice! Now that we have our Neural Network already learned the **Input-Output** relation in order to the entire system behave as the data Garriot were seeing in that Infamous morning, we need to transform that Input-Output behaviour into some function. We do this in order to *gain* interpretability of what may be happening and, in a scientific frame, learn the underling model. We do this by creating a [Function Space](https://en.wikipedia.org/wiki/Function_space) in order to the NN learn which function (or linear combination of those) is the best one to describe that Input-Output relation. The loss function to do so is designed in a way that the result will be the least complex one, that is, the answer will be the simplest function that behave like the NN.
289
+
md"""Nice! Now that we have our Neural Network already learned the **Input-Output** relation in order to the entire system behave as the data Garriott were seeing in that Infamous morning, we need to transform that Input-Output behaviour into some function. We do this in order to *gain* interpretability of what may be happening and, in a scientific frame, learn the underling model. We do this by creating a [Function Space](https://en.wikipedia.org/wiki/Function_space) in order to the NN learn which function (or linear combination of those) is the best one to describe that Input-Output relation. The loss function to do so is designed in a way that the result will be the least complex one, that is, the answer will be the simplest function that behave like the NN.
md"So we recover the equations and its parameters with an outstanding acurracy. And that is even more incredible if we remember that we did this with a **minimum** of data."
394
394
395
395
# ╔═╡ e6ec4364-54eb-11eb-1bf6-83db426cd32f
396
-
md"""After seeing that, Garriot took a big deep breath. He immediately understood what was going on. The players were mass killing the animals. He called his team and start planning the strategy to face this, not knowing that already was a lost cause...
396
+
md"""After seeing that, Garriott took a big deep breath. He immediately understood what was going on. The players were mass killing the animals. He called his team and start planning the strategy to face this, not knowing that already was a lost cause...
0 commit comments