# Logistic Regression with a Neural Network Mindset

1. Logistic Regression
2. Approaching Logistic Regression with Neural Network mindset

# Logistic Regression

Logistic Regression is an algorithm for binary classification. In a binary classification problem the input (X) will be a feature vector of 1-D dimension and the output (Y) label will be a 1 or 0

## Derivative or Slope

Before understanding the gradient descent, lets try to understand what an derivative is.

Gradient ascent and descent are very simple first-order optimization algorithms based on the derivative of an optimization function. We use gradient ascent and descent to find the local minimum/maximum of a function.

# Approaching Logistic Regression with Neural Network mindset

In this exercise, you will build a Logistic Regression, using a Neural Network mindset. The following Figure explains why Logistic Regression is actually a very simple Neural Network!

1. Initialize the model’s parameters W and B
2. Loop: Forward and Backward propagation
• Calculate current loss (forward propagation) L
• Calculate current gradient (backward propagation) J
• Update parameters (gradient descent) θ
`W -- initialized vector of shape (dim, 1)B -- initialized scalar (corresponds to the bias)`
`# compute cost (Forward Propagation)cost = -(1/m) * np.sum(Y.T * np.log(A) + (1 - Y.T) * (np.log(1-A)) )#where A is the sigmoid Activation ,A = sigmoid(np.dot(X.T,w) + b)#Gradients of loss with respect to W and B:(Backward Propagation)dw = (1/m) * np.dot(X,(A-Y.T))db = (1/m) * np.sum(A-Y.T)`
`W = W- learning_rate * dwB = B- learning_rate * db`

# Summary

Logistic Regression is a simple Neural Network. The main objective of a Logistic regression algorithm is to find the updated parameters by minimizing the cost function J, where cost function J measures how well you’re doing an entire training set.

--

-- ## BoT

Bay of Tech : ”Affordable technology solutions to everyone” |BoT provides solutions in Industry 4.0 | This space is the perspective page of BoT