zoukankan      html  css  js  c++  java
  • 多项式回归

    Features and Polynomial Regression

    We can improve our features and the form of our hypothesis function in a couple different ways.

    我们可以通过几种不同的方式改进我们的特征和假设函数的形式。

    We can combine multiple features into one. For example, we can combine x1 and x2 into a new feature x3 by taking x1x2.

     我们可以将多个功能合二为一。 例如,我们可以通过取x1⋅x2将x1和x2组合成新的特征x3

    Polynomial Regression

    Our hypothesis function need not be linear (a straight line) if that does not fit the data well.

    如果不能很好地拟合数据,我们的假设函数不必是线性的(直线)。

    We can change the behavior or curve of our hypothesis function by making it a quadratic, cubic or square root function (or any other form).

    我们可以通过使其成为二次,三次或平方根函数(或任何其他形式)来改变我们的假设函数的行为或曲线。

    For example, if our hypothesis function is [{h_ heta }left( x ight) = { heta _0} + { heta _1}{x_1}] then we can create additional features based on x1, to get the quadratic function [{h_ heta }left( x ight) = { heta _0} + { heta _1}{x_1} + { heta _2}x_1^2] or the cubic function [{h_ heta }left( x ight) = { heta _0} + { heta _1}{x_1} + { heta _2}x_1^2 + { heta _3}x_1^3]

    例如,如果我们的假设函数是[{h_ heta }left( x ight) = { heta _0} + { heta _1}{x_1}]那么我们可以基于x1创建其他功能 ,得到二次函数[{h_ heta }left( x ight) = { heta _0} + { heta _1}{x_1} + { heta _2}x_1^2]或三次函数 [{h_ heta }left( x ight) = { heta _0} + { heta _1}{x_1} + { heta _2}x_1^2 + { heta _3}x_1^3]
    In the cubic version, we have created new features x2 and x3 where x2 = (x1)2​  and x3 = (x1)3.

    在立方体版本中,我们创建了新的特征x2和x3,其中x2 =(x1)2和x3 =(x1)3

    To make it a square root function, we could do: [{h_ heta }left( x ight) = { heta _0} + { heta _1}{x_1} + { heta _2}sqrt {{x_1}} ]

    为了使它成为平方根函数,我们可以:[{h_ heta }left( x ight) = { heta _0} + { heta _1}{x_1} + { heta _2}sqrt {{x_1}} ]
    One important thing to keep in mind is, if you choose your features this way then feature scaling becomes very important.

    需要记住的一件重要事情是,如果您以这种方式选择特征,那么特征缩放就变得非常重要。

    eg. if x1 has range 1 - 1000 then range of (x1)2 becomes 1 - 1000000 and that of x3 = (x1)3 becomes 1 - 1000000000

    例如,如果的范围是1-1000,那么(x1)2的范围是1-1000000,x3 = (x1)3的范围是1-1000000000


    对于非线性情况,你可以选择“平方”、“三次方”、“开根号”等的特征

    h(x)可能是下面的情况

    [{h_ heta }left( x ight) = { heta _0} + { heta _1}x + { heta _2}{x^2} + { heta _3}{x^3}]

    这时候需要做的处理是

    [egin{array}{l}
    {x_1} = x\
    {x_2} = {x^2}\
    {x_3} = {x^3}
    end{array}]

    此时

    [{h_ heta }left( x ight) = { heta _0} + { heta _1}{x_1} + { heta _2}{x_2} + { heta _3}{x_3}]

  • 相关阅读:
    C# .NET5.0 平台介绍、演变
    ORA01034/ORA27101解决
    navicat无法连接虚拟机MySQL
    [原创]Windows下Google V8 javascript引擎编译
    CentOS 6.9安装MySQL5.5
    国内yum源
    【转】关于C++程序的编码问题
    VS C4819 编译错误解决方法
    Windows下Vundle安装
    vmware NAT 静态ip配置
  • 原文地址:https://www.cnblogs.com/qkloveslife/p/9839245.html
Copyright © 2011-2022 走看看