吴恩达机器学习笔记(七)–Logistic回归
学习基于:吴恩达机器学习
1. Classification
- The classification problem is just like the regression problem, except that the values we now want to predict take on only a small number of discrete values.
- Linear regression doesn’t work well here because classification is not actually a linear function.
-
classification problems:
- E-mail: spam / Not spam ?
- Online transactions: Fraudulent or not ?
- Tumor: Malignant / Benign ?
2. Hypothesis Representation
We will change the form for our hypotheses ??(x) to satisfy 0≤ ??(x)≤1. These are Sigmoid Function, also called Logistic function.
- h θ ( x ) = g ( θ T x ) h_{\theta}(x) = g(\theta^{T}x) hθ(x)=g(θTx)
- z = θ T x z = \theta^Tx z=θTx
- g ( z ) = 1 1 − e z g(z) = \frac{1}{1-e^z} g(z)=1−ez1
The following image shows us what the sigmoid function looks like:
The function g(z), shown here, maps any real number to the (0, 1) interval, making it useful for transforming an arbitrary-valued function into a function better suited for classification.
??(x) will give us the probability that our output is 1. For example, ??(x)=0.7 gives us a probability of 70% that our output is 1.