ICCS Summer school 2023
\[y = mx + c\]
\[\frac{dy}{dx} = m\]
\[y = x\]
\[\frac{dy}{dx} = 1\]
\[-\frac{dy}{dx}\]
\(x_{i}\) | \(y_{i}\) |
---|---|
1.0 | 2.1 |
2.0 | 3.9 |
3.0 | 6.2 |
\[L_{\text{MSE}} = \frac{1}{n}\sum_{i=1}^{n}\left(y_{i} - f(x_{i})\right)^{2}\]
Model: \(f(x) = mx + c\)
Data: \(\{x_{i}, y_{i}\}\)
Loss: \(\frac{1}{n}\sum_{i=1}^{n}(y_{i} - x_{i})^{2}\)
\[ \begin{align} L_{\text{MSE}} &= \frac{1}{n}\sum_{i=1}^{n}(y_{i} - f(x_{i}))^{2}\\ &= \frac{1}{n}\sum_{i=1}^{n}(y_{i} - mx_{i} + c)^{2} \end{align} \]
\[m_{n + 1} = -m_{n}\frac{dL}{dm} \cdot l_{r}\]
\[c_{n + 1} = -c_{n}\frac{dL}{dm} \cdot l_{r}\]
To fit a model we need:
All in all, ’tis quite simple.
\[a_{l+1} = \sigma \left( W_{l}a_{l} + b_{l} \right)\]
Image source: 3Blue1Brown
pandas
data frame).Advantages over simple ANNs:
Image source: Machine Learning Mastery ::: {.column width=10%}
:::
Some other points:
See the torch.nn.Conv1d
docs
torch.nn.Conv2d
docs.torch.nn.AdaptiveAvgPool2d
torch.nn.AdaptiveMaxPool2d
torchvision.models
docs.Image source: npmjs.com
In this exercise, we’ll train a CNN to estimate the centre \((x_{\text{c}}, y_{\text{c}})\) and the \(x\) and \(y\) radii of an ellipse defined by \[ \frac{(x - x_{\text{c}})^{2}}{r_{x}^{2}} + \frac{(y - y_{\text{c}})^{2}}{r_{y}^{2}} = 1 \]
The ellipse, and its background, will have random colours chosen uniformly on \(\left[0,\ 255\right]^{3}\).
In short, the model must learn to estimate \(x_{\text{c}}\), \(y_{\text{c}}\), \(r_{x}\) and \(r_{y}\).
These slides can be viewed at:
https://cambridge-iccs.github.io/slides/ml-training/slides.html
The html and source can be found on GitHub.
For more information we can be reached at:
You can also contact the ICCS, make a resource allocation request, or visit us at the Summer School RSE Helpdesk.