zoukankan      html  css  js  c++  java
  • 【stanford】二、supervised learning:Linear Regression

    supervised learning

    image

    learn a function h : X → Y

    h is called a hypothesis.

    一、Linear Regression

    image

    例子中,x是二维向量,x1代表living area,x2代表bedrooms

    functions/hypotheses h

    image

    设x0 = 1,变换得

    image

    Now, given a training set, how do we pick, or learn, the parameters θ?现在变为求参数θ

    One reasonable method seems to be to make h(x) close to y,

    We define the cost function:定义损失函数:

    image   要让这个函数值最小

    1、LMS algorithm:Least mean square

    We want to choose θ so as to minimize J(θ).

    gradient descent algorithm

    image

    α is called the learning rate.

    image

    image  LMS update rule

    image

    called batch gradient descent

    算法:

    image

    每次循环中每个θ,比如θj都要更新m次,i=1,2,…m,m为训练集元素个数。

    如果m太大,则这个算法会很慢,改用随机梯度下降法

  • 相关阅读:
    nginx php-fpm 输出php错误日志
    图解phpstorm常用快捷键
    Mysq性能分析 —— Genral log(普通日志)与 Slow log(慢速日式)
    Mac Terminal
    Git安装与配置
    Linux ulimit
    tcpdump
    Linux 基础
    TCP
    HTTP
  • 原文地址:https://www.cnblogs.com/549294286/p/2817282.html
Copyright © 2011-2022 走看看