/ 20220404 Week 1 - 2 /


Chapter 1 - Introduction

1.1 Definition

  • Arthur Samuel

    The field of study that gives computers the ability to learn without being explicitly programmed.
  • Tom Mitchell

    A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E.

1.2 Concepts

1.2.1 Classification of Machine Learning

  • Supervised Learning 监督学习:given a labeled data set; already know what a correct output/result should look like

    • Regression 回归:continuous output
    • Classification 分类:discrete output
  • Unsupervised Learning 无监督学习:given an unlabeled data set or an data set with the same labels; group the data by ourselves
    • Clustering 聚类:group the data into different clusters
    • Non-Clustering 非聚类
  • Others: Reinforcement Learning, Recommender Systems...

1.2.2 Model Representation

  • Training Set 训练集

    \[\begin{matrix}
    x^{(1)}_1&x^{(1)}_2&\cdots&x^{(1)}_n&&y^{(1)}\\
    x^{(2)}_1&x^{(2)}_2&\cdots&x^{(2)}_n&&y^{(2)}\\
    \vdots&\vdots&\ddots&\vdots&&\vdots\\
    x^{(m)}_1&x^{(m)}_2&\cdots&x^{(m)}_n&&y^{(m)}
    \end{matrix}\]
  • 符号说明

    \(m=\) the number of training examples 训练样本的数量 - 行数

    \(n=\) the number of features 特征数量 - 列数

    \(x=\) input variable/feature 输入变量/特征

    \(y=\) output variable/target variable 输出变量/目标变量

    \((x^{(i)}_j,y^{(i)})\) :第\(j\)个特征的第 \(i\) 个训练样本,其中 \(i=1, ..., m\),\(j=1, ..., n\)

1.2.3 Cost Function 代价函数

1.2.4 Gradient Descent 梯度下降

Chapter 2 - Linear Regression 线性回归

\[\begin{matrix}
x_0&x^{(1)}_1&x^{(1)}_2&\cdots&x^{(1)}_n&&y^{(1)}\\
x_0&x^{(2)}_1&x^{(2)}_2&\cdots&x^{(2)}_n&&y^{(2)}\\
\vdots&\vdots&\vdots&\ddots&\vdots&&\vdots\\
x_0&x^{(m)}_1&x^{(m)}_2&\cdots&x^{(m)}_n&&y^{(m)}\\
\\
\theta_0&\theta_1&\theta_2&\cdots&\theta_n&&
\end{matrix}\]

2.1 Linear Regression with One Variable 单元线性回归

  • Hypothesis Function

    \[h_{\theta}(x)=\theta_0+\theta_1x
    \]
  • Cost Function - Square Error Cost Function 平方误差代价函数

\[J(\theta_0,\theta_1)=\frac{1}{2m}\displaystyle\sum_{i=1}^m(h_{\theta}(x^{(i)})-y^{(i)})^2
\]
  • Goal

    \[\min_{(\theta_0,\theta_1)}J(\theta_0,\theta_1)
    \]

2.2 Multivariate Linear Regression 多元线性回归

  • Hypothesis Function

    \[\theta=
    \left[
    \begin{matrix}
    \theta_0\\
    \theta_1\\
    \vdots\\
    \theta_n
    \end{matrix}
    \right],\
    x=
    \left[
    \begin{matrix}
    x_0\\
    x_1\\
    \vdots\\
    x_n
    \end{matrix}
    \right]\]
    \[\begin{aligned}h_\theta(x)&=\theta_0+\theta_1x_1+\theta_2x_2+\cdots+\theta_nx_n\\
    &=\theta^Tx
    \end{aligned}\]
  • Cost Function

    \[J(\theta^T)=\frac{1}{2m}\displaystyle\sum_{i=1}^m(h_{\theta}(x^{(i)})-y^{(i)})^2
    \]
  • Goal

    \[\min_{\theta^T}J(\theta^T)
    \]

2.3 Algorithm Optimization

2.3.1 Gradient Descent 梯度下降法

  • 算法过程

    Repeat until convergence(simultaneous update for each \(j=1, ..., n\))
\[\begin{aligned}
\theta_j
&:=\theta_j-\alpha{\partial\over\partial\theta_j}J(\theta^T)\\
&:=\theta_j-\alpha{1\over{m}}\displaystyle\sum_{i=1}^m(h_{\theta}(x^{(i)})-y^{(i)})x^{(i)}_j
\end{aligned}\]
  • Feature Scaling 特征缩放

    对每个特征 \(x_j\) 有$$x_j={{x_j-\mu_j}\over{s_j}}$$

    其中 \(\mu_j\) 为 \(m\) 个特征 \(x_j\) 的平均值,\(s_j\) 为 \(m\) 个特征 \(x_j\) 的范围(最大值与最小值之差)或标准差。
  • Learning Rate 学习率

2.3.2 Normal Equation(s) 正规方程(组)

\[X=\left[
\begin{matrix}
x_0&x^{(1)}_1&x^{(1)}_2&\cdots&x^{(1)}_n\\
x_0&x^{(2)}_1&x^{(2)}_2&\cdots&x^{(2)}_n\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
x_0&x^{(m)}_1&x^{(m)}_2&\cdots&x^{(m)}_n\\
\end{matrix}
\right],\
y=\left[
\begin{matrix}
y^{(1)}\\
y^{(2)}\\
\vdots\\
y^{(m)}\\
\end{matrix}
\right]\]

其中 \(X\) 为 \(m\times(n+1)\) 维矩阵,\(y\) 为 \(m\) 维的列向量。则

\[\theta=(X^TX)^{-1}X^Ty
\]

如果 \(X^TX\) 不可逆(noninvertible),可能是因为:

  1. Redundant features 冗余特征:存在线性相关的两个特征,需要删除其中一个;
  2. 特征过多,如 \(m\leq n\):需要删除一些特征,或对其进行正规化(regularization)处理。

2.4 Polynomial Regression 多项式回归

If a linear \(h_\theta(x)\) can't fit the data well, we can change the behavior or curve of \(h_\theta(x)\) by making it a quadratic, cubic or square root function(or any other form).

e.g.

  • \(h_{\theta}(x)=\theta_0+\theta_1x_1+\theta_2x_1^2,\ x_2=x_1^2\)

  • \(h_{\theta}(x)=\theta_0+\theta_1x_1+\theta_2x_1^2+\theta_3x_1^3,\ x_2=x_1^2,\ x_3=x_1^3\)

  • \(h_{\theta}(x)=\theta_0+\theta_1x_1+\theta_2\sqrt{x_1},\ x_2=\sqrt{x_1}\)


Coursera 学习笔记|Machine Learning by Standford University - 吴恩达的更多相关文章

  1. Github | 吴恩达新书《Machine Learning Yearning》完整中文版开源

    最近开源了周志华老师的西瓜书<机器学习>纯手推笔记: 博士笔记 | 周志华<机器学习>手推笔记第一章思维导图 [博士笔记 | 周志华<机器学习>手推笔记第二章&qu ...

  2. 吴恩达课后作业学习1-week4-homework-two-hidden-layer -1

    参考:https://blog.csdn.net/u013733326/article/details/79767169 希望大家直接到上面的网址去查看代码,下面是本人的笔记 两层神经网络,和吴恩达课 ...

  3. Coursera课程《Machine Learning》学习笔记(week1)

    这是Coursera上比较火的一门机器学习课程,主讲教师为Andrew Ng.在自己看神经网络的过程中也的确发现自己有基础不牢.一些基本概念没搞清楚的问题,因此想借这门课程来个查漏补缺.目前的计划是先 ...

  4. Coursera课程《Machine Learning》吴恩达课堂笔记

    强烈安利吴恩达老师的<Machine Learning>课程,讲得非常好懂,基本上算是无基础就可以学习的课程. 课程地址 强烈建议在线学习,而不是把视频下载下来看.视频中间可能会有一些问题 ...

  5. 【Deeplearning.ai 】吴恩达深度学习笔记及课后作业目录

    吴恩达深度学习课程的课堂笔记以及课后作业 代码下载:https://github.com/douzujun/Deep-Learning-Coursera 吴恩达推荐笔记:https://mp.weix ...

  6. 我在 B 站学机器学习(Machine Learning)- 吴恩达(Andrew Ng)【中英双语】

    我在 B 站学机器学习(Machine Learning)- 吴恩达(Andrew Ng)[中英双语] 视频地址:https://www.bilibili.com/video/av9912938/ t ...

  7. 吴恩达deepLearning.ai循环神经网络RNN学习笔记_看图就懂了!!!(理论篇)

    前言 目录: RNN提出的背景 - 一个问题 - 为什么不用标准神经网络 - RNN模型怎么解决这个问题 - RNN模型适用的数据特征 - RNN几种类型 RNN模型结构 - RNN block - ...

  8. 吴恩达deepLearning.ai循环神经网络RNN学习笔记_没有复杂数学公式,看图就懂了!!!(理论篇)

    本篇文章被Google中国社区组织人转发,评价: 条理清晰,写的很详细! 被阿里算法工程师点在看! 所以很值得一看! 前言 目录: RNN提出的背景 - 一个问题 - 为什么不用标准神经网络 - RN ...

  9. 吴恩达(Andrew Ng)——机器学习笔记1

    之前经学长推荐,开始在B站上看Andrew Ng的机器学习课程.其实已经看了1/3了吧,今天把学习笔记补上吧. 吴恩达老师的Machine learning课程共有113节(B站上的版本https:/ ...

随机推荐

  1. ubuntu目录结构

    /:根目录,一般根目录下只存放目录,不要存放文件,/etc./bin./dev./lib./sbin应该和根目录放置在一个分区中 /bin:/usr/bin:可执行二进制文件的目录,如常用的命令ls. ...

  2. 31 面向对象编程 接口 普通类:只有具体实现 声明类的关键字是class,声明接口关键字是interface 接口的作用

    接口 概念 普通类:只有具体实现 抽象类:具体实现和规范(抽象方法)都有! 接口:只有规范!自己无法写方法!专业的约束!约束和实现分离:面向接口编程~ 接口就是规范,定义的是一组规则,体现了现实世界中 ...

  3. 02 基础 卸载JDK 安装JDK Java程序运行机制

    基础 JDK:Java Development Kit(Java开发者工具 包含JRE和JVM) JRE:Java Runtime Environment(java运行时环境,包含JVM) JVM:J ...

  4. 一比一还原axios源码(四)—— Axios类

    axios源码的分析,到目前为止,算上第0章已经四章了,但是实际上,还都没有进入axios真正的主线,我们来简单回顾下.最开始我们构建了get请求,写了重要的buildURL方法,然后我们处理请求体请 ...

  5. LGP2233题解

    题目大意 求环上走 \(n\) 步从指定点到达另一指定点,到达指定点后 不得继续移动. 大家都做过P1057传球游戏吧?还记得这道题的思路吗? 设 \(dp[i][j]\) 表示传 \(i\) 次求传 ...

  6. ffmpeg修改视频文件的分辨率

    在本文中,我们将展示如何调整任何视频文件的大小. 这种方法是在Linux系统(几乎任何发行版)中调整视频文件大小的最佳方法之一,也是Windows和Mac用户的绝佳替代方案. 更改视频文件的分辨率将是 ...

  7. Vmware安装Ubuntu16.4的过程及出现问题的解决

    镜像下载.域名解析.时间同步请点击 阿里云开源镜像站 1.下载Ubuntu镜像文件 Ubuntu16.4镜像文件下载地址:https://mirrors.aliyun.com/ubuntu-relea ...

  8. idea创建web项目以及配置Tomcat

    废话不多说,直接上干活: 1.在project中现创建好module,也就是java web项目 2.把路径名写清楚就行了 3.创建在WEB-INF上右击创建classes和lib以存储class编译 ...

  9. ModSecurity的规则

    一.ModSecurity的规则 基本格式 SecRule VARIABLES OPERATOR ACTIONS SecRule:ModSecurity主要的指令,用于创建安全规则. VARIABLE ...

  10. webdriver原理及操作

    webdriver原理: 1. WebDriver 启动目标浏览器,并绑定到指定端口.该启动的浏览器实例,做为 webdriver 的 remote server. 2. Client 端通过 Com ...