1、Classification
2、Hypothesis Representation
- Python code:
import numpy as np
def sigmoid(z):
return 1 / (1 + np.exp(-z))
- ℎ𝜃 (𝑥) = 𝑃(𝑦 = 1|𝑥; 𝜃)
- ℎ𝜃 (𝑥) = 0.7,表示有 70%的 几率𝑦为正向类,相应地𝑦为负向类的几率为 1-0.7=0.3
3、Decision Boundary
- We can use very complex models to adapt to the decision boundary of very complex shapes
4、Cost Function
import numpy as np
def cost(theta, X, y):
theta = np.matrix(theta)
X = np.matrix(X)
y = np.matrix(y)
first = np.multiply(-y, np.log(sigmoid(X* theta.T)))
second = np.multiply((1 - y), np.log(1 - sigmoid(X* theta.T)))
return np.sum(first - second) / (len(X))
5、Simplified Cost Function and Gradient Descent
6、Advanced Optimization
7、Multi-class Classification_ One-vs-all