AI-007: 吳恩達教授(Andrew Ng)的機器學習課程學習筆記27-33
本文是學習Andrew Ng的機器學習系列教程的學習筆記。教學視訊地址:
分類問題思維導圖:
27. Logistic Regression - Classification
Example:
It is not good to use linear regression to solve classification problem.
Threshold閾值
28. Logistic Regression - Hypothesis representation
通過邏輯函式將線性變化轉變為狀態變化,只有0、1兩個結果,假設函式就是獲得這兩個結果的概率,且概率和為1。
Logistic regression is a classify problem.
Sigmoid function = Logistic function:
29. Logic Regression - Decision boundary
The decision boundary is a property of the hypothesis, including the parameters θ1 θ2 θ3
No data the decision boundary is also there
根據訓練資料分佈,估計擬合函式圖形,比如橢圓:x^2+^2 = 1
Long as we’ve given my parameter vector θ, that defines the decision boundary which is the circle.
The training set no use to decide the decision boundary, it may used to fit the parameters θ.
If I have even higher order polynomial terms, I Can get very complex decision boundaries.
Higher order polynomial terms
Decision boundary 決策邊界
30. Logistic Regression - Cost function
通過引入更復雜函式,構造凹函式作為成本函式。
Problem:
superscript 上標
Cost function in linear regression:
used in logistic regression will get non-convex function, try to find a convex function:
non-convex 非凸函式
Cost function in Logistic regression:
31. Logistic Regression - Simplified cost function and gradient descent
Both cost function show in one:
有了成本函式,就可以通過求成本函式的最小值來確定引數。
maximum likelihood estimation極大似然估計法
32. Logistic Regression - Advanced optimization
In octave create cost function:
set options and run fminunc:
33. Logistic regression - Mult-class classification: One-vs-allWhat is multi-class classification problem?
change multi to one, and use more classifiers h(x):
Do prediction: just put x in each classifier, and pick the most confident or most enthusiastically
Train a logistic regression classifier for each class i to predict the probability that y = i.
On a new input x, to make a prediction, pick the class I that maximizes.