# Numerical example

hi i am trying to do logistic regression on a small data by hand so that i could understand that how it works like i did linear regression but can’t do it can you share me something that i could read an example numerical because i can’t understand the material from internet . Also i want to know that what is difference between the cost and loss function?

Hi mate, we are learning logistic regression in week 2 and going to continue to use it in further weeks. Could you be more specific about problem you encountered so that we can help you out ?
Loss function is valid for one training example whereas, cost fuction is addition of all loss functions(values) of training data.
I hope this helps.

The loss function is a vector valued function that gives the loss for each input sample individually in the form of a vector. The cost function is a scalar valued function that is the average of the loss function across the samples in the given batch.

i am just asking this question because i wanted to do logistic regression equation by hand with a small dataset of maybe 10 rows to just get understanding of how the equation of logistic regression works behind the code like i did with linear regression but i am unable to do it as there are many equation’s available on the internet and i just can’t figure out which one is to use.
for example the equation of linear regression is y=mx+b so in this case the predicted value will be y^ by using this equation .Now i wanted to do logistic regression also by hand .I hope you understand my question now

The formulas are all given in the notebook. They are:

Z = w^T \cdot X + b
A = sigmoid(Z)
J = -\displaystyle \frac {1}{m} \sum_{i = 1}^{m} \left ( Y_ilog (A_i) + (1 - Y_i) log (1 - A_i) \right )

Of course that only covers forward propagation. The back propagation formulas are given in the notebook as well.