机器学习-吴恩达

Kaleido Lv4

Chapter 1

监督学习 Supervised Learning

  • 回归问题:连续值(预测波士顿房价)
  • 分类问题:离散值(推测乳腺癌良性与否)

无监督学习 Unsupervised Learning

  • 监督学习:数据有标签
  • 无监督学习:数据没有标签

单变量线性回归 Linear Regression with One Variable

hypothesis:

代价函数 Cost Function

梯度下降 Gradient Descent

gradient descent algorithm:

: learning rate(控制更新参数的幅度)

Chapter 4

正规方程的 python 实现:

1
2
3
4
5
import numpy as np

def normalEquation(X, y):
theta = np.linalg.inv(X.T@X)@X.T@Y # X.T@X等价于X.T.dot(X) @等价于.dot
return theta

training examples, features:
梯度下降 Gradient Descent:

  • need to choose
  • need many iterations
  • works well even when is large

正规方程 Normal Equation:

  • no need to choose
  • don’t need many iterations
  • need to compute
  • slow if is very large
  • 由于需要计算 ,当特征数量 较大时运算代价较大(时间复杂度为),当 小于 10000 时还是可接受的

Chapter 6

Logistic Regression(实际上是分类问题):

代价函数 Cost Function

线性回归中的代价函数:

如果直接使用线性回归中的代价函数(即误差平方和),得到的函数将会是个非凸函数(有很多局部最优值),无法保证梯度下降法可以收敛到全局最优值。

因而重新定义逻辑回归的代价函数:
$$\operatorname{Cost}\left(h_{\theta}(x), y\right)=\left{\right.$$

  • 欠拟合(underfit):对训练样本的一般性质尚未学好
  • 过拟合(overfit):学习器把训练样本学得“太好”了,很可能已经把训练样本自身的一些特点当作了所有潜在样本都会具有的一般性质,导致泛化性能下降
  • Title: 机器学习-吴恩达
  • Author: Kaleido
  • Created at : 2024-02-28 21:37:28
  • Updated at : 2024-03-04 23:31:11
  • Link: https://redefine.ohevan.com/2024/02/28/机器学习-吴恩达/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments