diff --git a/AI/Neural Networks/MLP.md b/AI/Neural Networks/MLP.md index 7d548b3..6ad7ac1 100644 --- a/AI/Neural Networks/MLP.md +++ b/AI/Neural Networks/MLP.md @@ -12,4 +12,11 @@ A finite feed-forward MLP with 1 hidden layer can in theory approximate any math - In practice not trainable with [[Back-Propagation|BP]] ![[activation-function.png]] -![[mlp-arch-diagram.png]] \ No newline at end of file +![[mlp-arch-diagram.png]] +## Weight Matrix +- Use matrix multiplication for layer output +- TLU is hard limiter +![[tlu.png]] +- $o_1$ to $o_4$ must all be one to overcome -3.5 bias and force output to 1 +![[mlp-non-linear-decision.png]] +- Can generate a non-linear decision boundary \ No newline at end of file diff --git a/AI/Neural Networks/MLP/Activation Functions.md b/AI/Neural Networks/MLP/Activation Functions.md index e69de29..4d73fb6 100644 --- a/AI/Neural Networks/MLP/Activation Functions.md +++ b/AI/Neural Networks/MLP/Activation Functions.md @@ -0,0 +1,32 @@ +## Sigmoid +- Logistic function +- Normalises +- Introduces non-linearity +- Easy to take derivative +$$\frac d {dx} \sigma(x)= +\frac d {dx} \left[ +\frac 1 {1+e^{-x}} +\right] +=\sigma(x)\cdot(1-\sigma(x))$$ + +![[sigmoid.png]] +### Derivative + +$$y_j(n)=\varphi_j(v_j(n))= +\frac 1 {1+e^{-v_j(n)}}$$ +$$\frac{\partial y_j(n)}{\partial v_j(n)}= +\varphi_j'(v_j(n))= +\frac{e^{-v_j(n)}}{(1+e^{-v_j(n)})^2}= +y_j(n)(1-y_j(n))$$ +- Nice derivative +- Max value of $\varphi_j'(v_j(n))$ occurs when $y_j(n)=0.5$ +- Min value of 0 when $y_j=0$ or $1$ +- Initial weights chosen so not saturated at 0 or 1 + +If $y=\frac u v$ +Where $u$ and $v$ are differential functions + +$$\frac{dy}{dx}=\frac d {dx}\left(\frac u v\right)$$ + +$$\frac{dy}{dx}= +\frac {v \frac d {dx}(u) - u\frac d {dx}(v)} {v^2}$$ \ No newline at end of file diff --git a/AI/Neural Networks/MLP/Back-Propagation.md b/AI/Neural Networks/MLP/Back-Propagation.md index a4035e7..06844e7 100644 --- a/AI/Neural Networks/MLP/Back-Propagation.md +++ b/AI/Neural Networks/MLP/Back-Propagation.md @@ -103,4 +103,5 @@ $$\Delta w_{ji}(n)=\eta\cdot\delta_j(n)\cdot y_i(n)$$ - Proportional to the change in weights last iteration - Can shoot past local minima if descending quickly -![[mlp-global-minimum.png]] \ No newline at end of file +![[mlp-global-minimum.png]] + diff --git a/AI/Neural Networks/MLP/Decision Boundary.md b/AI/Neural Networks/MLP/Decision Boundary.md new file mode 100644 index 0000000..d0e18f1 --- /dev/null +++ b/AI/Neural Networks/MLP/Decision Boundary.md @@ -0,0 +1,4 @@ +![[hidden-neuron-decision.png]] +![[mlp-xor.png]] + +![[mlp-xor-2.png]] \ No newline at end of file diff --git a/img/hidden-neuron-decision.png b/img/hidden-neuron-decision.png new file mode 100644 index 0000000..fd2d51d Binary files /dev/null and b/img/hidden-neuron-decision.png differ diff --git a/img/mlp-non-linear-decision.png b/img/mlp-non-linear-decision.png new file mode 100644 index 0000000..c1ce7a1 Binary files /dev/null and b/img/mlp-non-linear-decision.png differ diff --git a/img/mlp-xor-2.png b/img/mlp-xor-2.png new file mode 100644 index 0000000..d3576d2 Binary files /dev/null and b/img/mlp-xor-2.png differ diff --git a/img/mlp-xor.png b/img/mlp-xor.png new file mode 100644 index 0000000..e4d2646 Binary files /dev/null and b/img/mlp-xor.png differ diff --git a/img/sigmoid.png b/img/sigmoid.png new file mode 100644 index 0000000..4e66650 Binary files /dev/null and b/img/sigmoid.png differ diff --git a/img/tlu.png b/img/tlu.png new file mode 100644 index 0000000..15e3db9 Binary files /dev/null and b/img/tlu.png differ