probability and statistics
play

Probability and Statistics for Computer Science All - PowerPoint PPT Presentation

Probability and Statistics for Computer Science All models are wrong, but some models are useful--- George Box Credit:


  1. Probability ¡and ¡Statistics ¡ ì ¡ for ¡Computer ¡Science ¡ ¡ “All ¡models ¡are ¡wrong, ¡but ¡some ¡ models ¡are ¡useful”-­‑-­‑-­‑ ¡George ¡Box ¡ ¡ ¡ Credit: ¡wikipedia ¡ Hongye ¡Liu, ¡Teaching ¡Assistant ¡Prof, ¡CS361, ¡UIUC, ¡12.10.2019 ¡

  2. Last ¡time ¡ ✺ Linear ¡regression ¡(cont.) ¡ ✺ Modeling ¡non-­‑linear ¡relaRonship ¡with ¡linear ¡ regression ¡ ✺ Outliers ¡and ¡over-­‑fiVng ¡issues ¡ ✺ Regularized ¡linear ¡regression/Ridge ¡regression ¡ ✺ Nearest ¡neighbor ¡regression ¡ ¡

  3. What ¡if ¡the ¡relationship ¡between ¡variables ¡ is ¡non-­‑linear? ¡ ✺ A ¡linear ¡model ¡will ¡ not ¡produce ¡a ¡good ¡ fit ¡if ¡the ¡dependent ¡ variable ¡is ¡ not ¡linear ¡ R 2 ¡= ¡0.1 ¡ combinaRon ¡of ¡the ¡ explanatory ¡variables ¡ ¡ ¡ ¡ ¡

  4. Transforming ¡variables ¡could ¡allow ¡linear ¡ model ¡to ¡model ¡non-­‑linear ¡relationship ¡ ✺ In ¡the ¡word-­‑ ¡frequency ¡ example, ¡log-­‑transforming ¡ both ¡variables ¡would ¡ allow ¡a ¡linear ¡model ¡to ¡fit ¡ the ¡data ¡well. ¡ ¡ ¡ ¡

  5. More ¡example: ¡Data ¡of ¡fish ¡in ¡a ¡Finland ¡ lake ¡ ✺ Perch ¡(a ¡kind ¡of ¡fish) ¡in ¡a ¡ lake ¡in ¡Finland, ¡56 ¡data ¡ observaRons ¡ ¡ ✺ Variables ¡include: ¡Weight, ¡ Length, ¡Height, ¡Width ¡ ✺ In ¡order ¡to ¡illustrate ¡the ¡ point, ¡let’s ¡model ¡ Weight ¡ as ¡the ¡dependent ¡variable ¡ and ¡the ¡ Length ¡as ¡the ¡ explanatory ¡variable. ¡ Yellow ¡Perch ¡ ¡

  6. Is ¡the ¡linear ¡model ¡fine ¡for ¡this ¡data? ¡ ✺ R-­‑squared ¡is ¡0.87 ¡may ¡ suggest ¡the ¡model ¡is ¡ OK ¡ ✺ But ¡the ¡trend ¡of ¡the ¡ data ¡suggests ¡non-­‑ linear ¡relaRonship ¡ ✺ IntuiRon ¡tells ¡us ¡length ¡ is ¡not ¡linear ¡to ¡weight ¡ given ¡fish ¡is ¡3-­‑ dimensional ¡ ✺ We ¡can ¡do ¡befer! ¡

  7. Transforming ¡the ¡explanatory ¡variables ¡

  8. Q. ¡What ¡are ¡the ¡matrix ¡X ¡and ¡ ¡y? ¡ Length 3 ¡ Weight ¡ 1 ¡

  9. Contents ¡ ✺ Markov ¡chain ¡ ✺ MoRvaRon ¡ ✺ DefiniRon ¡of ¡Markov ¡model ¡ ✺ Graph ¡representaRon ¡– ¡Markov ¡chain ¡ ✺ TransiRon ¡probability ¡matrix ¡ ✺ The ¡staRonary ¡Markov ¡chain ¡ ✺ The ¡pageRank ¡algorithm ¡ ¡

  10. Motivation ¡ ✺ So ¡far, ¡the ¡processes ¡we ¡learned ¡such ¡as ¡ Bernoulli ¡and ¡Poisson ¡process ¡are ¡sequences ¡ of ¡ independent ¡trials. ¡ ✺ There ¡are ¡a ¡lot ¡of ¡real ¡world ¡situaRons ¡where ¡ sequences ¡of ¡events ¡are ¡ Not ¡independent ¡In ¡ comparison. ¡ ✺ Markov ¡chain ¡is ¡one ¡type ¡of ¡characterizaRon ¡ of ¡a ¡series ¡of ¡ dependent ¡trials. ¡

  11. An ¡example ¡of ¡dependent ¡events ¡in ¡a ¡ sequence ¡ I ¡had ¡a ¡glass ¡of ¡wine ¡with ¡my ¡grilled ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡

  12. An ¡example ¡of ¡dependent ¡events ¡in ¡a ¡ sequence ¡

  13. An ¡example ¡of ¡dependent ¡events ¡in ¡a ¡ sequence ¡

  14. Markov ¡chain ¡ ✺ Markov ¡chain ¡ is ¡a ¡process ¡ in ¡which ¡outcome ¡of ¡any ¡ trial ¡in ¡a ¡sequence ¡is ¡ condi6oned ¡by ¡the ¡ outcome ¡of ¡the ¡trial ¡ immediately ¡preceding, ¡but ¡ not ¡by ¡earlier ¡ones . ¡ ¡ ✺ Such ¡dependence ¡is ¡called ¡ chain ¡dependence ¡ Andrey ¡Markov ¡(1856-­‑1922) ¡ ¡

  15. Markov ¡chain ¡in ¡terms ¡of ¡probability ¡ ✺ Let ¡ ¡ ¡ ¡ ¡ ¡, ¡ ¡ ¡ ¡ ¡ ¡,… ¡be ¡a ¡sequence ¡of ¡discrete ¡finite-­‑valued ¡ X 0 X 1 random ¡variables ¡ ¡ ✺ The ¡sequence ¡is ¡a ¡Markov ¡chain ¡if ¡the ¡probability ¡ distribuRon ¡ ¡ ¡ ¡ ¡ ¡only ¡depends ¡on ¡the ¡distribuRon ¡of ¡the ¡ X t immediately ¡preceding ¡random ¡variable ¡ X t − 1 P ( X t | X 0 ..., X t − 1 ) = P ( X t | X t − 1 ) ✺ If ¡the ¡condiRonal ¡probabiliRes ¡(transiRon ¡probabiliRes) ¡ do ¡ NOT ¡change ¡with ¡6me , ¡it’s ¡called ¡ constant ¡Markov ¡ chain . ¡ P ( X t | X t − 1 ) = P ( X t − 1 | X t − 2 ) = ... = P ( X 1 | X 0 )

  16. Coin ¡example ¡ ✺ Toss ¡a ¡fair ¡coin ¡unRl ¡you ¡see ¡two ¡heads ¡in ¡a ¡row ¡and ¡ then ¡stop, ¡what ¡is ¡the ¡probability ¡of ¡stopping ¡aker ¡ exactly ¡ n ¡flips? ¡ ¡ ✺ Use ¡a ¡state ¡diagram, ¡which ¡is ¡a ¡ directed ¡graph . ¡ Circles ¡ are ¡the ¡states ¡of ¡likely ¡outcomes. ¡Arrow ¡direcRons ¡show ¡the ¡ direcRon ¡of ¡transiRons. ¡Numbers ¡over ¡the ¡arrows ¡show ¡ transiRon ¡probabiliRes. ¡ 1/2 ¡ 1 ¡-­‑> ¡Start ¡or ¡just ¡had ¡tail/restart ¡ ¡ ¡ 1/2 ¡ 1/2 ¡ 2 ¡-­‑> ¡had ¡one ¡head ¡aJer ¡start/restart ¡ 3 ¡-­‑> ¡2heads ¡in ¡a ¡row/Stop ¡ 3 ¡ 1/2 ¡

  17. Is ¡this ¡a ¡Markov ¡chain? ¡And ¡why? ¡ 1/2 ¡ 1/2 ¡ 1/2 ¡ 3 ¡ 1/2 ¡

  18. Is ¡this ¡a ¡Markov ¡chain? ¡And ¡why? ¡ Yes. ¡Because ¡for ¡each ¡trial, ¡the ¡ probability ¡distribuRon ¡of ¡the ¡ outcomes ¡is ¡only ¡condiRoned ¡on ¡the ¡ previous ¡trial. ¡

  19. The ¡model ¡helps ¡form ¡recurrence ¡formula ¡ ✺ Let ¡ ¡ ¡ ¡ ¡ ¡ ¡be ¡the ¡probability ¡of ¡stopping ¡aker ¡ n ¡flips ¡ ¡ p n p 2 = 1 / 4 p 3 = 1 / 8 p 4 = 1 / 8 … ¡ p 1 = 0 ✺ If ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡there ¡are ¡two ¡ways ¡the ¡sequence ¡starts ¡ n > 2 ✺ Toss ¡T ¡and ¡finish ¡in ¡n-­‑1 ¡tosses ¡ ✺ Or ¡toss ¡HT ¡and ¡finish ¡in ¡n-­‑2 ¡tosses ¡ ✺ So ¡we ¡can ¡derive ¡a ¡recurrence ¡relaRon ¡ 1/2 ¡ p n = 1 2 p n − 1 + 1 1/2 ¡ 4 p n − 2 1/2 ¡ 3 ¡ 1/2 ¡

  20. Transition ¡probability ¡matrix: ¡weather ¡ model ¡ ¡ ✺ Let’s ¡model ¡daily ¡weather ¡as ¡one ¡of ¡the ¡three ¡states ¡ (Sunny, ¡Rainy, ¡and ¡Snowy) ¡with ¡Markov ¡chain ¡that ¡ has ¡the ¡transiRon ¡probabiliRes ¡as ¡shown ¡here. ¡ 0.6 ¡ 0.7 ¡ 0.2 ¡ 0.2 ¡ 0.1 ¡ 0.1 ¡ 0.4 ¡ 0.2 ¡ 0.5 ¡

  21. Transition ¡probability ¡matrix: ¡weather ¡ model ¡ ¡ ✺ Let’s ¡model ¡daily ¡weather ¡as ¡one ¡of ¡the ¡three ¡states ¡ (Sunny, ¡Rainy, ¡and ¡Snowy) ¡with ¡Markov ¡chain ¡that ¡ has ¡the ¡transiRon ¡probabiliRes ¡as ¡shown ¡here. ¡ 0.6 ¡ 0.7 ¡ 0.2 ¡ i , ¡the ¡current ¡state ¡at ¡Rme ¡point ¡t ¡ j , ¡the ¡next ¡state ¡at ¡Rme ¡point ¡t+1 ¡ 2 ¡ 1 ¡ 0.2 ¡ Snowy ¡ Sunny ¡ Rainy ¡ 0.1 ¡ 0.1 ¡   Sunny ¡ 0 . 7 0 . 2 0 . 1 0.4 ¡ 0.2 ¡ 3 ¡ Rainy ¡ P = 0 . 2 0 . 6 0 . 2   0 . 4 0 . 1 0 . 5 Snowy ¡ 0.5 ¡ The ¡transiRon ¡probability ¡matrix ¡

  22. Q: ¡ The ¡transition ¡probabilities ¡for ¡a ¡node ¡sum ¡to ¡1 ¡ A. ¡Yes. ¡ ¡ B. ¡No. ¡

  23. Transition ¡probability ¡matrix ¡properties ¡ ✺ The ¡transiRon ¡probability ¡matrix ¡ ¡ ¡ ¡ ¡is ¡a ¡square ¡matrix ¡ ¡ P with ¡entries ¡ ¡ p ij ✺ Since ¡ ¡ p ij = P ( X t = j | X t − 1 = i ) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ � and ¡ p ij ≥ 0 p ij = 1 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ j Snowy ¡ Sunny ¡ Rainy ¡   Sunny ¡ 0 . 7 0 . 2 0 . 1 Rainy ¡ P = 0 . 2 0 . 6 0 . 2   0 . 4 0 . 1 0 . 5 Snowy ¡ The ¡transiRon ¡probability ¡matrix ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend