## General is an algorithm for binary classification, output either is or isn't ![[CleanShot 2024-06-05 at [email protected]|300]] - model is $\sigma(w^Tx + b) = \hat{y}$ ![[CleanShot 2024-06-05 at [email protected]|300]] - $\sigma(z) = \frac{1}{1 + e^{-z}}$ - Model: Given $x$, we want $\hat{y} = P(y=1|x)$, $x \in \mathbb{R}^{n_x}$ - Parameters: $w \in \mathbb{R}^{n_x}$, $b \in \mathbb{R}$ - $n_x$ is number of input features - [[Linear Regression]] is poor at binary classification, since we need a classification between 0 & 1 for output, not an infinite ranging positive value - so we use logistic regression ## Measuring Success [[Loss Function]]: - measures how close our prediction $\hat{y}$ is to the real labeled output $y$ - we use the [[Binary Cross Entropy Loss|Binary Cross Entropy Loss Function]] - $L(\hat{y},y) = -(y\,log(\hat{y})) + (1 - y)log(1 - \hat{y}))$ - mean squared error doesn't work that well, leads to non-convex optimization problem, so we reach bad local minima [[Cost Function]]: $J(w, b) = - \frac{1}{m} \sum^{m}_{i=1} y^{(i)}log(\hat{y}^{(i)}) + (1 - y^{(i)})log(1 - \hat{y}^{(i)})$