# Machine Learning Week1

## Linear Regression and Algebra

Posted by yellowDog on 2018-07-10

## What is Machine Learning?

Two definitions of Machine Learning are offered. Arthur Samuel described it as: “the field of study that gives computers the ability to learn without being explicitly programmed.” This is an older, informal definition.

Tom Mitchell provides a more modern definition: “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.”

Example: playing checkers.

• E = the experience of playing many games of checkers

• T = the task of playing checkers.

• P = the probability that the program will win the next game.

In general, any machine learning problem can be assigned to one of two broad classifications:

• Supervised learning
• Unsupervised learning

### Supervised Learning(监督学习)

• Regression 回归问题 -> 给出正确答案
• Classification 分类问题 -> 给出离散值

• 聚类算法
• 鸡尾酒宴算法

## Model

#### 线性回归(linear regression)

训练集
m = number of training example
x = input variable / features
y = output variable / target variable
(x,y) 训练样本
h(hypothesis假设) -> 表示函数 $${ h }{ \theta }\left( x \right) \quad =\quad { \theta }{ 0 }+{ \theta }_{ 1 }(x)$$

#### Cost Function(代价函数)

also called Squared error function #### Gradient descent(梯度下降算法) -> 找到 Min(J)

:= 赋值运算符

= 相等操作符 ##### 梯度下降来最小化平方误差代价函数 ## Linear Algebra

### Matrices and Vectors(矩阵和矢量)

• Dimension: rows * columns

• Vector: n * 1 matrix

1-indexed(数学中使用多) or 0-indexed(应用问题/编程语言) 索引从哪里开始

• Matrix Addition 相同维度才能运算

• Scalar Multiplication 实数的乘法

• Identity Matrix 单位矩阵

For any matrix A
AI = IA = A

• 乘法不满足交换律

• Inverse(逆)
$${ AA }^{ -1 }\quad =\quad { A }^{ -1 }A\quad =\quad I$$

其中 A 为 n*n Materix

• Transpose(转置)

$${ A }{ ij }^{ T }\quad =\quad { A }{ ji }$$

#### 在 Octave 中打印 