zoukankan      html  css  js  c++  java
  • Linear classification

    Classification, to find out which bounder side of a point or get the bounder to separate the dataset. This article is mainly about Linear Classification, using one hyper plane to separate the dataset.

     

    as for the signed distance y

     

    here comes the neuron:

     

    the function f is a transfer function, used to prevent y from changing too much by aliens or noise. f can be step function, linear step function or tanh. As usual the error defined as:

    E=0.5*(z-t)^2, z is the output of the neuron and t is the class of the points, so that the 1st order derivate is:

    update each vi as vi(t + 1) = vi(t) + ∆vi(t)

    refference:

    http://www.marmakoide.org/download/teaching/dm/dm-perceptron-1.pdf

    Note that the linear classification can’t separate data with a non-linear frontier, neither a dataset with multidimensional data. For some dataset, a better initialization is needed, set the Vector C be the median of the data, the Vector V be one unit vector. Use MLP to get a better separation.

    <view code>

    result:

    eta= 0.5 iteration=3
    0.07076422200317212 0.08188117302023934
    eta= 0.01 iteration=2
    -0.6969402564832946 0.7171348353723
    eta= 0.001 iteration=255
    -0.6648463748271787 0.6683932978172582
    test 2: ==========================
    no Optimization:
     too much time 。。。
    use median to do the optimization
    100.5 100.5
    eta= 0.5 iteration=6
    eta= 0.01 iteration=115
    100.49434892035956 100.50567408374293
    test 3: ==========================
    seperate the dataset into 30% testing part and 70% training part,
    using the percentage to determine when to stop the learning
    iteration= 300
     percentage: 0.88 test: 0.9083333333333333  train: 0.8678571428571429
    -353.0333900061246 -763.5366403901546 -251.38913455734232
    Vector write with cluster_id finished

    some samples && linear classify:

  • 相关阅读:
    解决GIT可视化工具Sourcetree拉取失败问题
    记录常用Git命令
    vue开发移动端使用rem的适配方案
    使用HBuilderX实现打包vue项目成app
    使用vue+webpack从零搭建项目
    整理最近面试问道的问题
    模块化之seaJs学习和使用
    理解Object.defineProperty的作用
    vue生命周期
    使用gulp编译sass
  • 原文地址:https://www.cnblogs.com/sunshinewill/p/3013747.html
Copyright © 2011-2022 走看看