shu*_*910 1 python bayesian redis
我在python中使用redisbayes库来实现朴素的贝叶斯分类.但是当我写作 -
rb = redisbayes.RedisBayes(redis=redis.Redis())
rb.train('good', 'sunshine drugs love sex lobster sloth')
Run Code Online (Sandbox Code Playgroud)
它给出以下错误 -
ConnectionError: Error 10061 connecting localhost:6379.
No connection could be made because the target machine actively refused it.
Run Code Online (Sandbox Code Playgroud)
我试过这样做 -
pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
rb = redisbayes.RedisBayes(redis=redis.Redis(connection_pool=pool))
Run Code Online (Sandbox Code Playgroud)
但它给出了同样的错误.我无法找到解决方案.如何使用python建立与redis的连接,或者使用MySQL的训练数据以任何其他方式在python中进行naive bayes分类?
| 归档时间: |
|
| 查看次数: |
1767 次 |
| 最近记录: |