Giter Site home page Giter Site logo

Comments (4)

SmirkCao avatar SmirkCao commented on August 28, 2024 1

@zhaoxinjie
先回答第一个问题
感知机是二分类,常用的是$y\in \Y ={-1,+1}$,这种情况直接用y就OK
但是还有一种二分类标签用$y\in \Y ={0,1}$,为了兼容用这种标签的数据形式,做了这个操作实现标签从${0,1}$到${-1,+1}的映射。
这样会把$\Y={+1,-1}$映射到$\Y={+1,-3}$,符号没有变化。

from lihang.

SmirkCao avatar SmirkCao commented on August 28, 2024 1

@zhaoxinjie
回答第二个问题
这部分代码写的不好

if wx * yy_ > 0:
    correct_count += 1
    if correct_count > self.max_iter_:
        logger.info(correct_count)
        break
    continue
self.w += self.eta_ * yy_ * xx_
n_iter_ += 1

这里面用了continue会跳过后面的n_iter_累加,所以又加了correct_count来判
我在review03的branch里面push了个新的更新

if wx * yy_ <= 0:
    self.w += self.eta_ * yy_ * xx_
n_iter_ += 1

不知道这样是不是可接受。

大多数算法都用到wx+b,刷参数,无论刷出来是否高效,最后可能都能用。这个就是算法有意思的地方吧。

from lihang.

SmirkCao avatar SmirkCao commented on August 28, 2024 1

哇,原来如此,百思不得其解,被你一语道破,太谢谢了!

其实这个也有点问题,是不是? 相当于有一个方向调整的学习率要大一些。
反正,能用再说,具体问题具体看吧。算法不能离开数据集,和数据在一起才是完整的算法。

from lihang.

zhaoxinjie avatar zhaoxinjie commented on August 28, 2024

哇,原来如此,百思不得其解,被你一语道破,太谢谢了!

from lihang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.