用python实现贝叶斯判别_贝叶斯总结及Python实现

基本理论

鉴于网上有很多好的文章理论部分我就不写了,放出下面的参考。可以先看理论。再看代码了解细节。

详细的理论可参考博文;

具体的sklearn使用方式和调参可参考博文

思维导图

Goodnotes

python 实现

import numpy as np

class Bayes(object):

def __init__(self, model = "multinomial",alpha = 1, log = False):

"""

:param model: "multinomial" : Naive Bayes classifier for multinomial models

"gaussian" :Naive Bayes classifier for gaussian model

"bernoulli" : Naive Bayes classifier for bernoulli model

:param alpha: smoothing

if alpha = 0 is no smoothing,

if 0 < alpha < 1 is Lidstone smoothing

if alpha = 1 is Laplace smoothing

:param log: is True

x1 * x2 * x3 to log(x1 * x2 * x3)

"""

se

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值