贝叶斯决策理论:选择具有最高概率的决策。
条件概率:
p(gray|bucketB)表示:在已知石头出自B桶的条件下,取出灰色石头的概率。
p(gray|bucketB) = p(gray and bucketB) / p(bucketB)
贝叶斯准则:
p(c|x) = p(x|c) * p(c) / p(x)
条件概率:
p(gray|bucketB)表示:在已知石头出自B桶的条件下,取出灰色石头的概率。
p(gray|bucketB) = p(gray and bucketB) / p(bucketB)
贝叶斯准则:
p(c|x) = p(x|c) * p(c) / p(x)
import numpy as np
def loadDataSet():
postingList =[["my", "dog", "has", "flea", "problems", "help", "please"],
["maybe", "not", "take", "him", "to", "dog", "park", "stupid"],
["my", "dalmation", "is", "so", "cute", "I", "love", "him"],
["stop", "posting", "stupid", "worthless", "garbage"],
["mr", "licks", "ate", "my", "steak", "how", "to", &#