Computing Probabilities With R
mining the patterns in lottery
Chia-Chi@MLDM Monday20160912
Sample Codeshttps://github.com/c3h3/mldm20120912
ETL in R%>% + dplyr + tidyr
你買彩卷時 ... 不知道當年度最常出現的號碼的 ?
一向都用電腦選號的 ?
對於,不相信的朋友 ...
是驗證過,嘗試過,發現沒有 pattern,才不相信?
還是是沒驗證過,沒嘗試過,直接不相信?
瘋險的種類 ?● 猜錯行情 (Prediction)
○ 在該下注時,不下
○ 再不該下時,拼命下
● 下注數量控制失衡 (Position Sizing)○ 輸的時候,下注過大
○ 贏得時候,下注太小
● 陷入負期望值,而未自覺
瘋險控管的核心(1) 套利 Versus 套損(2) 勝率 Versus 賠率
市場上有兩種 TraderBuy-Side / Sell-Side
Trend Follower / Mean Reversionhigh p, low WLR / low p, High WLR
兩種 Traders:● Type I (Trend Follower)
○ 順勢操作,追高殺低
○ 低勝率,高報酬
● Type II (Mean Reversion)○ 逆勢操作,買黑賣紅
○ 高勝率,低報酬
套損 Versus 套利E = pW - (1-p)L - T > 0
套損 Versus 套利假設 T = 0, WLR = W/L
p > 1 / (1+WLR)
你相信 ... 投擲硬幣正面和反面的機率是平均的 ?
你覺得 ... 投擲硬幣正面和反面的機率是多少呢 ?
這些機率,受到什模影響呢 ?
大家覺得 ... P(H) = ? and P(T) = ?
P(H| ?? ) = ? and P(T | ??) = ?
tidyr:: gather -> <- spread
Avoid OverfittingWalk Forward Analysis
樂透的時間 pattern各個號碼出現的 Stopping Time ?
怎樣才是 ... 正確的週期 ?正確的時間尺度 ?
來看空間的 pattern !
進擊的條件機率進行預測P(DISTt | DISTt-1)
詳情請搜尋Learning by Hacking 粉絲團課程說明:
http://goo.gl/CTR7nk
dplyr 101df %>% group_by(...) %>% summerize(...)
tidyr 101df %>% spread(key,value)
df %>% gather(key,value,...)
gather -> <- spread
Longformat
Wideformat
Before go into ggplot2Please make sure that your data.frame is
in the long format !