認識貝葉斯方法

R 監督式學習:分類

Brett Lantz

Instructor

機率估計

位置地圖

事件 A 的機率記為 P(A)

  • P(work) = 23 / 40 = 57.5%
  • P(store) = 4 / 40 = 10.0%
R 監督式學習:分類

聯合機率與獨立事件

維恩圖

事件 A 與 B 的聯合機率記為 P(A and B)

  • P(work and evening) = 1%
  • P(work and afternoon) = 20%
R 監督式學習:分類

條件機率與相依事件

維恩圖

事件 A 與 B 的條件機率記為 P(A | B)

  • P(A | B) = P(A and B) / P(B)
  • P(work | evening) = 1 / 25 = 4%
  • P(work | afternoon) = 20 / 25 = 80%
R 監督式學習:分類

使用 Naive Bayes 進行預測

# 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 監督式學習:分類

一起來練習吧!

R 監督式學習:分類

Preparing Video For Download...