Skip to content
Snippets Groups Projects
Commit 96bbb9ee authored by JuanPi Carbajal's avatar JuanPi Carbajal
Browse files

session 1: iterated map applets

parent 6e505ddb
No related branches found
No related tags found
No related merge requests found
......@@ -52,13 +52,49 @@
}
\end{frame}
\begin{frame}{Filtering and smoothing}
\end{frame}
\begin{frame}{Bayesian inference}
Overview of the bayesian setup: prior, model, posterior
\end{frame}
\begin{frame}{Representing our understading of the process}
Explain what types of models we can use we the tools we are going to learn
Explain what types of models we can use with the tools we are going to learn
\end{frame}
\interludeframe{\textbf{\large Coffee break: 20 minutes}}
\section{Iterated maps}
\begin{frame}{1D Example}
\only<1>{
\[
x_k = x_{k-1}
\]
}
\only<2>{
\[
x_k = x_{k-1} + \epsilon \quad \epsilon \gaussian(0, \sigma^2)
\]
}
\end{frame}
\begin{frame}{2D Example}
\only<1>{
\begin{align*}
\bm{x}_k = A \bm{x}_{k-1}\\
A = \alpha \begin{bmatrix} 0 & -1 \\ 1 & 0\end{bmatrix} \quad 0 < \alpha < 1
\end{align*}
}
\only<2>{
\begin{align*}
\bm{x}_k = A \bm{x}_{k-1} + \begin{bmatrix}0 \\ \epsilon \end{bmatrix} \quad \epsilon \gaussian(0, \sigma^2)\\
A = \alpha \begin{bmatrix} 0 & -1 \\ 1 & 0\end{bmatrix} \quad 0 < \alpha < 1
\end{align*}
}
\end{frame}
\section{Ordinary differential equations}
......@@ -70,7 +106,7 @@
\section{Gaussian Distribution}
% Gaussian distribution in 1D
% Gaussian distribution in 2D
% Gaussian distribution in 2D: applet
% Gaussian distribution in more dimensions
% Linear transformation in 1D: analytic and visual
% Nonlinear transformation in 1D: visual
......
## Copyright (C) 2021 - Juan Pablo Carbajal
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## Author: Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
pkg load statistics
noise_std = 0.0;
steps = 200;
x0 = 0;
replicas = 10;
function y = map(x, sd=0)
y = x + normrnd(0, sd);
endfunction
figure()
for rep=1:replicas
x = zeros(steps+1, 1);
x(1) = x0;
for i=2:steps+1
x(i) = map(x(i-1), noise_std);
endfor
hold on;
plot(x, 'o', 'markersize', 2)
endfor
grid
xlabel('iteration')
ylabel('x')
axis tight
## Copyright (C) 2021 - Juan Pablo Carbajal
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
## Author: Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
pkg load statistics
noise_std = 0.01;
steps = 200;
x0 = [0 0.1];
replicas = 3;
function y = map(x, sd=0)
A = [0 -1; 1 0] * 0.05;
y = x + x * A;
y(2) += normrnd(0, sd);
endfunction
figure ()
ax1 = subplot (2, 2, [2, 4]);
axis(ax1, "equal")
hold(ax1, 'on')
ax2 = subplot (2, 2, 1);
hold(ax2, 'on')
ax3 = subplot (2, 2, 3);
hold(ax3, 'on')
for rep = 1:replicas
x = zeros(steps+1, 2);
x(1, :) = x0;
for i=2:steps+1
x(i, :) = map (x(i-1, :), noise_std);
endfor
plot(ax1, x(:,1), x(:,2), 'o', 'markersize', 2)
plot(ax2, x(:,1), 'o', 'markersize', 2)
plot(ax3, x(:,2), 'o', 'markersize', 2)
endfor
grid(ax1)
grid(ax2)
grid(ax3)
xlabel(ax1, 'x_1')
ylabel(ax1, 'x_2')
ylabel(ax2, 'x_1')
xlabel(ax3, 'iteration')
ylabel(ax3, 'x_2')
axis(ax1, "tight")
axis(ax2, "tight")
axis(ax3, "tight")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment