GithubHelp home page GithubHelp logo

chansonz / book-ml-sem Goto Github PK

View Code? Open in Web Editor NEW
180.0 180.0 63.0 27.82 MB

《机器学习:软件工程方法与实现》Method and implementation of machine learning software engineering

License: MIT License

Jupyter Notebook 95.63% Roff 0.03% CSS 0.01% Python 3.78% Dockerfile 0.03% Makefile 0.36% Batchfile 0.15% Shell 0.01%
docker machine-learning python software-engineering

book-ml-sem's People

Contributors

chansonz avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

book-ml-sem's Issues

第一章缩进问题

书本中第一章,页数27,增加先验的注释下,第7行代码self.train()开始到结束,均需要缩进四行。

第一章勘误2有误

def judge(score_dict):
'''二分类'''
keys = self.CAT #list(score_dict.keys())

应该是

def judge(score_dict):
'''二分类'''
keys = EmailClassifier.CAT

第一章 7.预测与验证中的文件路径问题

s = '../data/processed/spam_400/'
h = '../data/processed/ham_1120/'
clf = EmailClassifier(s, h)
clf.train()

请问这里的s和h的路径是哪里来的? 我翻了上下文和仓库里的数据包,都没有找到这个文件路径

第一章 “增加先验” 无法通过单元测试

书中第27页的代码

def score(self, email_file):
    if self.total_count[self.CAT[0]] == 0 or self.total_count[self.CAT[1]] == 0:
        self.train()

    result = self.P.copy()
    for ww in EmailClassifier.get_words_from_file(email_file):
        for cc in self.CAT:
            v = self.training[cc][ww]
            p = (v + 1) / (self.total_count[cc] + 1)
            result[cc] *= p

这段代码无法通过单元测试,存在两个问题,

  1. AssertionError: None is not an instance of <class 'dict'> : Second argument is not a dictionary
  2. AssertionError: {'ham': 0.0034722, 'spam': 0.0019436} != {'ham': 0.003472222222222222, 'spam': 0.0019436345966958213}
  • {'ham': 0.0034722, 'spam': 0.0019436}
  • {'ham': 0.003472222222222222, 'spam': 0.0019436345966958213}
    ? +++++++++++ ++++++++++++

建议修改如下:

def score(self, email_file):
    if self.total_count[self.CAT[0]] == 0 or self.total_count[self.CAT[1]] == 0:
        self.train()

    result = self.P.copy()
    for ww in EmailClassifier.get_words_from_file(email_file):
        for cc in self.CAT:
            v = self.training[cc][ww]
            p = (v + 1) / (self.total_count[cc] + 1)
            result[cc] *= p
            result[cc] = round(result[cc], 7)
    return result

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.