https://github.com/raphsenn/logistic-regression-model-py
Simple logistic regression model using raw python and numpy.
https://github.com/raphsenn/logistic-regression-model-py
Last synced: 11 months ago
JSON representation
Simple logistic regression model using raw python and numpy.
- Host: GitHub
- URL: https://github.com/raphsenn/logistic-regression-model-py
- Owner: raphsenn
- License: mit
- Created: 2024-06-11T09:33:45.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-27T07:30:49.000Z (over 1 year ago)
- Last Synced: 2025-01-21T13:09:53.258Z (over 1 year ago)
- Language: Python
- Size: 184 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# logistic-regression-model-py
Simple logistic regression model using raw python and numpy.
## Logistic Regression in a nutshell.

### Forward propagation
For one training example $x = (x_1, ..., x_n)$ of dimension n, the forward propgation is:
$z = dot(w, x) + b$
$a = sigmoid(z)$
$L = -(ylog(a) + (1-y)log(1-a))$
### Backpropagation
Training the model means updating the weights and biases, W and b, using the gradient of the
loss with respect to these parameters.
At each step, we need to calcualate:
#### $\frac{dL}{dw} $, $ \frac{dL}{db}$
We can use the cain rule:
#### Chain rule
Let $u(x)$ and $v(x)$ be two function.
We want the derivative of the product of u and v:
$\frac{dvu}{dx} $ = $\frac{dv}{dx} u + \frac{du}{dx} $ v
in another notation:
$(v(x)*u(x))'$ = $v'(x) * u(x) + v(x) * u'(x)$