# Regression Models: Logistic Regression

### Definition

- We have a mathematical function which gives a value between
and , and to convert it to a value between (0,1), we need a **Sigmoid**function or a logistic function - We can visualize it as a boundary (the decision boundary) to separate 2 categories on a hyperplane, where each dimension is a variable (a certain type of information)
- The algorithm used is also
*gradient descent*

### Common Questions

- What is a logistic function?

**Answer**:. - What is the range of values of a logistic function?

**Answer**: The values of a logistic function will range from 0 to 1. The values of Z will vary fromto . - What are the cost functions of logistic function?

**Answer**: The popular 2 are**Cross-entropy**or**log loss**. Note that**MSE**is not used as squaring sigmoid violates convexity (cause local extrema to appear).

### Basic Implementation

1 | from sklearn.datasets import load_iris |

### Notes

In fact, logistic regression is simple, but the key thing here is actually on the mathematics behind *gradient descent* and its multi-dimensional variations. I'll discuss about them in future posts.

Regression Models: Logistic Regression

https://criss-wang.github.io/post/blogs/supervised/regressions-2/