# Binary Classification

Here x is a feature vector of all pixels detected in a particular image , y is output whether image is a cat or not
X is a vector containing pixels of all training examples, while Y is output of all examples
x<sup>(i)</sup> is the set of i'th training example
# Logistic regression

y hat is the probablity of the image being an cat if there is an input of an image.
We calculate this probablity with the help of a sigmoid function.
The parameters of logical regression are W , an n<sub>x </sub> dimensional vector and b, a real number
# Loss and Cost Function
Loss function gives an idea of how much the output is deviated from actual result/ error in output.

Loss function is for a single training example.
Cost function is average of the loss function over the entire training set

# Gradient Descent
If we plot J(w,b) with w and b in 3D, we have to find a minima in the space such that J is smallest. We use gradient descent method for this.
We will repeatedly apply the following formula :

and

where : means updating the value of w or b as. We will gradually reach the minimum.
# Computational Graph

Here, the blue arrows indicate forward computation or forward propogation while red arrows indicate backward propogation or computation.
For e.g. in forward propogation, next step is the derivative of previous step
The coding convention dvar represents derivative of final output variable with respect to various intermediate quantities


# Vectorisation
Performing a for loop to calculate z takes more time

Instead we use vectorisation as follows :



# Broadcasting in Python
Sum of elements of array vertically is axis = 0
"" horizontally is axis = 1

Broadcasting can be understood as follows :


'*' indicates element wise multiplication, not matrix multiplication, np.dot() indicates matrix multiplication
In a neural network we use superscript [] to denote layer.
Back calculation can be done as follows :

A neural network looks as follows :

The activations of hidden layer are represented by the following matrix:

When there is a hidden layer present, we can vectorise the activation and z as follows :