02 Multivariate Linear Regression

  1. h(x)
    \[
    \begin{align*}h_\theta(x) =\begin{bmatrix}\theta_0 \hspace{2em} \theta_1 \hspace{2em} ... \hspace{2em} \theta_n\end{bmatrix}\begin{bmatrix}x_0 \newline x_1 \newline \vdots \newline x_n\end{bmatrix}= \theta^T x\end{align*}, x_0^{(i)} = 1
    \]
  2. Gradient descent equation
    \[
    \begin{align*}& \text{repeat until convergence:} \; \lbrace \newline \; & \theta_j := \theta_j - \alpha \frac{1}{m} \sum\limits_{i=1}^{m} (h_\theta(x^{(i)}) - y^{(i)}) \cdot x_j^{(i)} \; & \text{for j := 0...n}\newline \rbrace\end{align*}
    \]
  3. 当不同特征的值差距过大\((>10^5)\)时,需要特征缩放(Feature Scaling)

    \[
    x_i := \frac{x_i - \mu_i}{s_i}
    \]
    Where \(\mu_i\) is the average of all the values for feature(i) and \(s_i\) is the range of values(max - min), or \(s_i\) is the standard deviation.

  4. Learning Rate
    In automatic convergence test, declare convergence if \(J(\theta)\) decreases by less than \(1-^{-3}\) in one iteration.
  5. Features and Polynomial Regression
    可以将不同的特征值组合来更好的拟合数据,同时因为数据的组合,更加需要特征缩放来加快几何提高精度
  6. Normal Equation 正规方程 不需要特征缩放
    \[
    \theta = (X^TX)^{-1}X^Ty
    \]
  7. Comparation
    Gradient Descent Normal Equation
    need to choose \(\alpha\) No need to choose \(\alpha\)
    Needs many iterations Don’t need to iterate
    Works well even when n is large (\(>10^4\)) Need to compute \((X^TX)^{-1}\)
    \(O(kn^2)\) Slow if n is very large \(O(n^3)\)
  8. If \(X^TX\) is noninvertible, the common causes might be having :
    • Redundant features, where two features are very closely related (i.e. they are linearly dependent)
    • Too many features (e.g. m ≤ n). In this case, delete some features or use "regularization" (to be explained in a later lesson).

原文地址:https://www.cnblogs.com/QQ-1615160629/p/02-Multivariate-Linear-Regression.html

时间: 2024-11-09 17:11:23

02 Multivariate Linear Regression的相关文章

Machine Learning - week 2 - Multivariate Linear Regression

Gradient Descent in Practice - Feature Scaling Make sure features are on a similar scale. Features 的范围越小,总的可能性就越小,计算速度就能加快. Dividing by the range 通过 feature/range 使每个 feature 大概在 [-1, 1] 的范围内 下题是一个例子: Mean normalization 将值变为接近 0.除了 x0,因为 x0 的值为 1. mu

Andrew Ng Machine Learning 专题【Linear Regression】

此文是斯坦福大学,机器学习界 superstar - Andrew Ng 所开设的 Coursera 课程:Machine Learning 的课程笔记. 力求简洁,仅代表本人观点,不足之处希望大家探讨. 课程网址:https://www.coursera.org/learn/machine-learning/home/welcome Week 3: Logistic Regression & Regularization 笔记:http://blog.csdn.net/ironyoung/ar

【转】Derivation of the Normal Equation for linear regression

I was going through the Coursera "Machine Learning" course, and in the section on multivariate linear regression something caught my eye. Andrew Ng presented the Normal Equation as an analytical solution to the linear regression problem with a l

CheeseZH: Stanford University: Machine Learning Ex1:Linear Regression

(1) How to comput the Cost function in Univirate/Multivariate Linear Regression; (2) How to comput the Batch Gradient Descent function in Univirate/Multivariate Linear Regression; (3) How to scale features by mean value and standard deviation; (4) Ho

Machine Learning - IV. Linear Regression with Multiple Variables (Week 2)

http://blog.csdn.net/pipisorry/article/details/43529845 机器学习Machine Learning - Andrew NG courses学习笔记 multivariate linear regression多变量线性规划 (linear regression works with multiple variables or with multiple features) Multiple Features(variables)多特征(变量)

机器学习---线性回归(Machine Learning Linear Regression)

线性回归是机器学习中最基础的模型,掌握了线性回归模型,有利于以后更容易地理解其它复杂的模型. 线性回归看似简单,但是其中包含了线性代数,微积分,概率等诸多方面的知识.让我们先从最简单的形式开始. 一元线性回归(Simple Linear Regression): 假设只有一个自变量x(independent variable,也可称为输入input, 特征feature),其与因变量y(dependent variable,也可称为响应response, 目标target)之间呈线性关系,当然x

Multivariate Adaptive Regression Splines (MARSplines)

Introductory Overview Regression Problems Multivariate Adaptive Regression Splines Model Selection and Pruning Applications Technical Notes: The MARSplines Algorithm Technical Notes: The MARSplines Model Introductory Overview Multivariate Adaptive Re

flink 批量梯度下降算法线性回归参数求解(Linear Regression with BGD(batch gradient descent) )

1.线性回归 假设线性函数如下: 假设我们有10个样本x1,y1),(x2,y2).....(x10,y10),求解目标就是根据多个样本求解theta0和theta1的最优值. 什么样的θ最好的呢?最能反映这些样本数据之间的规律呢? 为了解决这个问题,我们需要引入误差分析预测值与真实值之间的误差为最小. 2.梯度下降算法 梯度下降的场景: 梯度下降法的基本思想可以类比为一个下山的过程.假设这样一个场景:一个人被困在山上,需要从山上下来(i.e. 找到山的最低点,也就是山谷). 但此时山上的浓雾很

Spark MLlib Linear Regression线性回归算法

1.Spark MLlib Linear Regression线性回归算法 1.1 线性回归算法 1.1.1 基础理论 在统计学中,线性回归(Linear Regression)是利用称为线性回归方程的最小平方函数对一个或多个自变量和因变量之间关系进行建模的一种回归分析.这种函数是一个或多个称为回归系数的模型参数的线性组合. 回归分析中,只包括一个自变量和一个因变量,且二者的关系可用一条直线近似表示,这种回归分析称为一元线性回归分析.如果回归分析中包括两个或两个以上的自变量,且因变量和自变量之间