TrisZaska's Machine Learning Blog

Intuition about Unit Step function

1. Introduction
2. History and Overview about Artificial Neural Network
3. Single neural network
4. Multi-layer neural network
5. Install and using Multi-layer Neural Network to classify MNIST data
6. Summary
7. References

Unit Step function

Before going to deeper about Unit step function, let take a look the perceptron's image above where Unit step function used to make activation function, there are many activation functions we will also discuss later. So, why we call it activation function? As we mentioned before, the idea behind Perceptron is that try to mimic the brain neuron, its mean that when the net input \(z\) if \(g(z)\) reached to the predefined threshold \(\theta\) it "fire" the output value 1, otherwise its return -1.
Okay, it will be clear if we define \(z\), \(g(z)\), right? So, look at image above, where \(z\) is the net input and calculated by the net input function and basically, it just a linear combination of input and weight with the formula:
\( z = w_0x_0 + w_1x_1 + w_2x_2 + ... + w_mx_m = \sum_{j = 0}^{m} w_jx_j \hspace{1cm}(1)\)
In this formula, we see extra \(w_0x_0\), it's the bias term we will disccuss later, too.
For simplicity, we assume \(\theta = 0\), so the activation function \(g(z)\), where:
\( \begin{equation} g({\mathbf{z}}) =\begin{cases} 1 & \text{if } \mathbf{z} \ge 0\\ -1 & \text{otherwise}. \end{cases} \end{equation} %]]> \)
Equation \((1)\) can be written as
\((1) \Leftrightarrow \mathbf{w}^T\mathbf{x}\)
Where \(\mathbf{w}\) is features vector and \(\mathbf{x}\) is sample vector,
\(\mathbf{w} = \begin{bmatrix} w_{1} \\ \vdots \\ w_{m} \end{bmatrix} \quad \mathbf{x} = \begin{bmatrix} x_{1} \\ \vdots \\ x_{m} \end{bmatrix}\)
Why we convert this equation to vector-matrix representation? Because of the convenient of vector-matrix when we actually implement by Python code. Instead of writing expensive loop and nested-loop to calculate this equation, we can use the definition of vector-matrix not only represent data easily and readily but also improve the computation efficiently. And from now, it can be done with Pandas library that we will use throughout this tutorial.

No comments :

Post a Comment

Leave a Comment...