本文是学习Andrew Ng的机器学习系列教程的学习笔记。教学视频地址:

https://study.163.com/course/introduction.htm?courseId=1004570029#/courseDetail?tab=1

本文中的白色背景视频截图来自Andrew Ng的视频脚程, 思维导图为原创总结。

ML基础介绍,单变量的线性回归:

AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

  1. Introduce

    ML: grew out of work in AI, new capability for computers;

    Examples:

                -database mining

                            large datasets from growth of automation/web.

                            e.g.: web click data, medical records, biology, engineering

                -Application can’t program by hand.

                            e.g.: autonomous helicopter, handwriting recognition, most of NLP,

     

    Computer Vision

                -self-customizing programs

                            e.g.:, Amazon, Netflix product recommendations

                -Understanding human learning (brain, real AI).

  2. What's ML
     

    Arthur Samuel(1959): learning without being explicitly programmed

    Tom Mitchell(1998): experience E, task T, performance measure P, performance on T, as measured by P, improves with experience E.

    Spam email:

                AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

     

    ML learning algorithms:

    -Major tow: supervised learning/ unsupervised learning

    -Others: reinforcement learning, recommender systems

  3. Introduction supervised learning

    Regression problem 归问题

    Deal continuous value

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

     

    Classification problem 类问题

    Deal with discrete values

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    How to allow computer to deal with an infinite number of features.

  4. Introduction unsupervised learning

    No label data, find some structure, deal clustering

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    just like google news, cluster news topic

    like genes analogy
     

    Used to :

    -organize computing clusters

    -social network analysis

    -market segmentation

    -astronomical data analysis

     

    also used to :

    -cocktail party problem

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

     

    Used to first build algorithm prototype in Octave

    When this algorithm work, will migrate it to C++ or Java

    总结:

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

  5. Linear regression with one variable - model representation

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    some sym:

    m = Number of training examples

    x’s = ‘input’ variable/features

    y’s = ‘output’ variable /’target’ variable

    (x, y) = one training example

    (xi, yi) = the ith training example

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14
     

  6. Linear regression with one variable - Cost function
     

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

     AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    cost function to find the minimize feature.

    The normal cost function is squared error function. MSE – Mean-Square Error
    Others: RMSE MAE R-Squared

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

  7. Linear regression with one variable - Cost function intuition
    首先简化问题,减少特征,图形化假设函数及成本函数

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    try Ø to h Ø (x), and J(Ø)

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14  
    然后看看两个特征量的假设函数和成本函数的图形化分析(碗形图和等高线图):

    Bowl like shape

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    Contour plots

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

  8. Linear regression with one variable - Gradient descent

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14
     

    := assignment, = truth assertion

    ∂ learning rate
    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14
    梯度下降,下降是指将特征的值进行修改,每次修改的大小是学习效率与对成本函数中的特征求偏导的乘积,这样的到的新特征的值带入成本函数,如果能降低成本函数值(即减少偏差),就认为接近我们的目标了。
     

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

     

     AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    can use gradient descent to minimize any cost function J.

    Gradient descent + cost function to get an algorithm for linear regression

    Get partial derivatives of θ0θ1
     

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    Cost function of one variable linear regression is Convex function(bowl shape), have no local optimum and only have global optimum.

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    this gradient descent function called Batch : Each step of gradient descent uses all the training example.

    总结:
    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

  9. Linear Algebra review - Matrices and vectors
    为了将简单的线性回归(一个特征)扩展到多个特征,首先要具备一些线性代数的知识。
    Matrix – Rectangular array of numbers
    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14
     

    张量Tensor

    张量是一组数字,排列在一个规则的网格上,具有不同数量的轴。张量有三个指标,第一个指向行,第二个指向列,第三个指向轴。例如,V232指向第二行,第三列和第二个轴。这指的是右图张量中的值0,如下图所示:
    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14
     

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    Upper case used to refer to a matrix, and lower case used to refer to either numbers or just raw numbers or scalars or vectors.

  10.  

    Linear Algebra review - Addition and scalar multiplication
     

     

    Matrix Addition

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    Scalar multiplication:

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

     

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

  11. Linear Algebra review - Matrix-vector multiplicaation
     

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

     

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    change problem to matrix times vectors

    can use one line in Octave

    can simplify the code and more efficient

  12. Linear Algebar review - matrix-matrix multiplication
    First matrix’s column number = second matrix’s row number
    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14
    Am*n, Bn*o, A*B果是矩Cm*o,即所得矩的行列数量分等于A的行数与B阵的列数
    房价估计问题用矩阵表示会更精炼些:

     

    By constructing these two matrices, can apply three hypotheses to all four house sizes.

    To get all twelve predicted prices output.

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

  13. Linear Algebra review - matrix multiplication properties
    Matrix multiplication is not commutative
     

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    matrix multiplication is associative

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    Identity matrix 位矩 is commutative

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    充:
    1.

    量乘法是可交的,但不是矩乘法。意味着当我乘以7 * 33 * 7相同。但是当我将矩彼此相乘A * BB * A不一

    2.

    量和矩乘法都是关的。意味着量乘35 * 3)与(3 * 53相同并且矩AB * C)与(A * BC相同。

    3.分配

    量和矩乘法也是分布式的。意味着35 + 3)与3 * 5 + 3 * 3相同,并且AB + C)与A * B + A * C相同。

    4.位矩

    位矩是一种特殊的矩,但首先,我需要定什么是位。数字1是一个位,因你与1相乘的所有西都等于它自己。因此,与位矩相乘的每个矩都等于它自己。例如,矩A乘以其位矩等于A.

    你可以通以下事发现单位矩:它沿线有一个,而其他每个零。它也是一个“平方矩”,意思是它的行数与列数相匹配。

  14. Linear Algebra review - inverse and transpose
     

    Inverse 逆运算

    Transpose

    Only square matrices have inverses. Mean rows = columns -> square matrices. Am*mAI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    Matrices that don’t have an inverse are ‘singular’ or ‘degenerate’

    Singular matrix奇异矩

    Degenerate matrix 退化矩

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

    Transpose - flip the matrix along that 45 degree axis

    Aij = Bji

    AI-004: 吴恩达教授(Andrew Ng)的机器学习课程学习笔记1-14

     

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-02-10
  • 2021-08-21
  • 2021-10-28
  • 2021-09-30
  • 2022-12-23
猜你喜欢
  • 2021-10-08
  • 2021-11-01
  • 2021-04-18
  • 2021-06-01
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案