理解贝叶斯方法

R 中的监督学习:分类

Brett Lantz

Instructor

估计概率

位置地图

事件 A 的概率记为 P(A)

  • P(work) = 23 / 40 = 57.5%
  • P(store) = 4 / 40 = 10.0%
R 中的监督学习:分类

联合概率与独立事件

维恩图

联合概率记为 P(A 且 B)

  • P(work 且 evening) = 1%
  • P(work 且 afternoon) = 20%
R 中的监督学习:分类

条件概率与相关事件

维恩图

条件概率记为 P(A | B)

  • P(A | B) = P(A 且 B) / P(B)
  • P(work | evening) = 1 / 25 = 4%
  • P(work | afternoon) = 20 / 25 = 80%
R 中的监督学习:分类

用朴素贝叶斯进行预测

# building a Naive Bayes model
library(naivebayes)
m <- naive_bayes(location ~ time_of_day, data = location_history)
# making predictions with Naive Bayes
future_location <- predict(m, future_conditions)
R 中的监督学习:分类

Passons à la pratique !

R 中的监督学习:分类

Preparing Video For Download...