野球を科学する技術-Pythonと統計ライブラリと分析基盤 #pyconjp

2c0947c6a28e7f771ebd9859ecf54e5c?s=47 Shinichi Nakagawa
September 08, 2017

野球を科学する技術-Pythonと統計ライブラリと分析基盤 #pyconjp

PyConJP 2017登壇資料

https://pycon.jp/2017/ja/schedule/presentation/15/

#Python #野球統計学 #セイバーメトリクス #Airflow #Scrapy

2c0947c6a28e7f771ebd9859ecf54e5c?s=128

Shinichi Nakagawa

September 08, 2017
Tweet

Transcript

  1. ໺ٿΛՊֶ͢Δٕज़ ʙPythonΛ༻͍ͨ౷ܭϥΠϒϥϦ࡞੒ͱ෼ੳج൫ߏஙʙ Shinichi Nakagawa@shinyorke(໺ٿͷਓ) PyConJP 2017 Talk Session 2017/9/8

  2. ਖ਼૷ = ໺ٿϢχϑΥʔϜʂ ※ࣸਅ෇͖ͰγΣΞ͓ئ͍͠·͢ʂ

  3. Who am I ?(͓લ୭Α) • ໺ٿͷਓͰ͢(PythonΫϥελతʹ͸) • Shinichi Nakagawa(@shinyorke) •

    Retty.Inc Engineer/ڕྉཧ୲౰ • Baseball Scientist(ݸਓ׆ಈ) • Python΋͘΋ࣗ͘शࣨ #rettypy • #Python #SABRmetrics #໺ٿ౷ܭֶ #Agile #Scrum
  4. Starting member(͓͠ͳ͕͖) • Զʑ΍͖͏෼ੳج൫ʮbradfordʯΛPythonͳͲͰ࡞ͬͨ • ෼ੳج൫ͷ͘͠Έ(Scrapy, Airflow, ౷ܭϥΠϒϥϦetc…) • ໺ٿΛՊֶ͢Δٕज़

    • ໺ٿՊֶͷجૅ஌ࣝ(Liner Weights, ಘ఺ظ଴஋,ಘ఺Ձ஋) • ʮ࢛൪ଧऀ͕ফ͑ͨνʔϜʯͷͦͷޙΛ௥͏ • ·ͱΊ
  5. ຊ୊ͷલʹ

  6. PyConJPͱ΍͖͏ͷྺ࢙ • PyConJP 2014ʮPythonͰ͸͡ΊΔ໺ٿϓϩάϥϛϯάʯ
 Infra as a CodeͱWeb Application(Django),ΠϯϓϨʔଧ཰(BABIP) •

    PyConJP 2015ʮ໺ٿHack!ʙPythonΛ༻͍ͨσʔλ෼ੳͱՄࢹԽʯ
 PyDataͱԶʑ෼ੳج൫(Jupyter,matplotlib,Docker),ΞμϜɾμϯ཰ • PyConJP 2016ʮϏοΫσʔλͱPythonͰ͸͡ΊΔ໺ٿͷ౷ܭ෼ੳʯ
 εΫϨΠϐϯάͱύοέʔδԽ(Beautifulsoup4),WHIP,౤ٿ෼ੳ • PyConJP 2017ʮ໺ٿΛՊֶ͢Δٕज़ʯˡNew!(4೥࿈ଓ4ճ໨)
 Զʑ෼ੳج൫(Scrapy, Airflow, Docker, sabr, Redash), Liner Weights, wRAA
  7. ΍Γ͔ͨͬͨ͜ͱ (2೥લͷPyConJP 2015ΑΓ)

  8. ໺ٿHack!~PythonΛ༻͍ͨσʔλ෼ੳͱՄࢹԽ - The Art Of Programming A Baseball Game! -

    Shinichi Nakagawa@shinyorke PyCon JP 2015 Talk Session
  9. ͜Ε͔Βͷ໺ٿHack(ئ๬) • ʮσʔλυϦϒϯ໺ٿղઆʯΛ௨ͯ͡৽͍͠໺ٿͱεϙʔπͷՄೳੑΛઆ͍ͯੜ͖͍ͨʂʂ ˠ΍͖͏ΛΦʔϓϯͳ৘ใج൫ʹʂ • ౦ژޒྠʹ޲͚ͯɺ৽͍͠໺ٿɾεϙʔπͷָ͠ΈํΛ໛ࡧ&Ϧʔυ͍͖͍ͯͨ͠ʂʂʂ

  10. ϫΠʮ΍͖͏෼ੳج൫Λ࡞ͬͨϯΰʯ #ࠓ೥ͷൃදςʔϚ

  11. ʮԶʑ෼ੳج൫ʯߏஙϧʔϧ • ʮؾܰʹ࡞ͬͯյͯ͠·ͨ࡞Δʯ։ൃ
 ओཁՕॴ͸ςετॻ͘,ϛυϧ΢ΣΞ͸DockerͰ࠶ݱੑ୲อ. • ࢖͍͍ͨɾࢼ͍ͨ͠ϥΠϒϥϦ͸ੵۃ׆༻
 ࣗ෼ͰϑϧεΫϥον։ൃ͸μϧ͍ͷͰۃྗճආ.
 
 ੈͷதͰ࢖͑ͦ͏ͳϞϊ͸OSSԽͯ͠ެ։
 ໺ٿϥΠϒϥϦΛPyPIʹ,Airflow

    ServerΛDocker Imageʹ.
  12. Զʑ΍͖͏෼ੳج൫ʮbradfordʯ ηΠόʔϝτϦΫε͕ݟ͚ͭͨαϒϚϦφʔʮνϟυɾϒϥουϑΥʔυʯ͕༝དྷ. ৄ͍͠Τϐιʔυ͸໊ஶʮϚωʔɾϘʔϧʯΛνΣοΫʂ

  13. Զʑ΍͖͏෼ੳج൫(શମ૾)

  14. ͜͜ʹ໺ٿσʔλΛूΊΔ Զʑ΍͖͏෼ੳج൫(શମ૾)

  15. ᶃ4DSBQZ εΫϨΠϐϯά  બख੒੷Λ୳ͯ͠อଘ ͜͜ʹ໺ٿσʔλΛूΊΔ Զʑ΍͖͏෼ੳج൫(શମ૾)

  16. ᶃ4DSBQZ εΫϨΠϐϯά  બख੒੷Λ୳ͯ͠อଘ ͜͜ʹ໺ٿσʔλΛूΊΔ ᶄલॲཧ 4"#3NFUSJDT  ࢦඪ஋ܭࢉσʔλߋ৽ Զʑ΍͖͏෼ੳج൫(શମ૾)

  17. ᶃ4DSBQZ εΫϨΠϐϯά  બख੒੷Λ୳ͯ͠อଘ ͜͜ʹ໺ٿσʔλΛूΊΔ ᶄલॲཧ 4"#3NFUSJDT  ࢦඪ஋ܭࢉσʔλߋ৽ ᶅ"JSqPX

    +0#؅ཧ  4DSBQZ ᶃ ͱલॲཧ ᶄ Λఆظ࣮ߦ Զʑ΍͖͏෼ੳج൫(શମ૾)
  18. ᶃ4DSBQZ εΫϨΠϐϯά  બख੒੷Λ୳ͯ͠อଘ ͜͜ʹ໺ٿσʔλΛूΊΔ ᶄલॲཧ 4"#3NFUSJDT  ࢦඪ஋ܭࢉσʔλߋ৽ ᶅ"JSqPX

    +0#؅ཧ  4DSBQZ ᶃ ͱલॲཧ ᶄ Λఆظ࣮ߦ ᶆ෼ੳՄࢹԽ 3FEBTI  ܾ·ͬͨϝτϦΫεΛݟΔ Զʑ΍͖͏෼ੳج൫(શମ૾)
  19. ᶃ4DSBQZ εΫϨΠϐϯά  બख੒੷Λ୳ͯ͠อଘ ͜͜ʹ໺ٿσʔλΛूΊΔ ᶄલॲཧ 4"#3NFUSJDT  ࢦඪ஋ܭࢉσʔλߋ৽ ᶅ"JSqPX

    +0#؅ཧ  4DSBQZ ᶃ ͱલॲཧ ᶄ Λఆظ࣮ߦ ᶇ෼ੳՄࢹԽ +VQZUFS  ԾઆΛܾΊ࣮ͯݧతͳ෼ੳ Զʑ΍͖͏෼ੳج൫(શମ૾) ᶆ෼ੳՄࢹԽ 3FEBTI  ܾ·ͬͨϝτϦΫεΛݟΔ
  20. ΍͖͏෼ੳج൫Λࢧ͑Δٕज़ 1. Scrapy(εΫϨΠϐϯά) 2. લॲཧ(SABRmetrics) 3. Airflow(JOB؅ཧ) 4. ෼ੳ&ՄࢹԽ(Redash) 5.

    ෼ੳ&ՄࢹԽ(Jupyter)
  21. ScrapyʙΫϩʔϥʔFW • WebαΠτͷΫϩʔϧͱεΫϨΠϐϯά,σʔλͷอଘͳ ͲΛҰؾ௨؏ʹߦ͑ΔΫϩʔϥʔFW • ΫϩʔϥʔքͷDjango/Ruby On RailsͱݺΜͰ͍͍ଘࡏ • εέδϡʔϥʔ,UserAgent,HTTP

    Header,μ΢ϯϩʔυͷ λΠϛϯά,Ωϟογϡetc…ඞཁʹͳΔ΋ͷ͕͋Β͔͡Ί ༻ҙ͞Ε͍ͯΔ&ύϥϝʔλͷઃఆͳͲͰ؆୯ʹઃఆՄೳ
  22. Scrapyͷશମ૾ https://doc.scrapy.org/en/latest/topics/architecture.html

  23. Scrapyͷશମ૾(໾ׂ) https://doc.scrapy.org/en/latest/topics/architecture.html ɾItemΛValidate ɾσʔλͱͯ͠อଘ ScrapyͷػೳΛ׆༻ ։ൃऀ͕ઃܭɾ࣮૷ ίϯϙʔωϯτؒΛ੍ޚ ɾεΫϨΠϐϯά ɾ݁ՌΛItemʹอଘ ΩϡʔʹஷΊΔ&࣮ߦ

    αΠτΛμ΢ϯϩʔυ
  24. ScrapyͷΑ͍ͱ͜Ζ • εΫϨΠϐϯάͱσʔλอଘͷ࣮૷ʹूதͰ͖Δ
 ςϯϓϨ௨Γʹ࡞Δ,σʔλอଘ͸޷͖ͳํ๏Ͱ
 ˞σʔλ͸CSV,JSON,DBͳΜͰ΋OK • ൥Θ͍͠νϡʔχϯά͸͢΂ͯScrapy͕୅ߦ
 ϦΫΤετͷ࣮ߦִؒ,Ωϟογϡ੍ޚetc…
 settings.pyͷઃఆΛνϡʔχϯάͰࣄ͕଍ΓΔ

  25. ScrapyͰͷ։ൃͰ஫ҙ͢Δ͜ͱ • settings.pyΛσϑΥϧτઃఆͰ࢖Θͳ͍
 σϑΥϧτ͸μ΢ϯϩʔυִؒθϩඵ,ฒߦϦΫΤετ ਺16,Ωϟογϡແޮͱ͔ͳΓϩοΫͳ࢓༷(਒͑੠)
 ͜ͷ··࢖͏ͱαΠτΛ౗ͪ͠Ό͏͔΋ͳͷͰΩέϯʂ • ϖʔδ͸߄ͯͣʮʹΜ͛ΜΒ͘͠ʯεΫϨΠϐϯά
 εΫϨΠϐϯά͢ΔωλͰϦΞϧλΠϜੑΛٻΊΔ͜ͱ ͸جຊແ͍ͱࢥ͏ͷͰ,αΠτʹ͸΍͘͞͠઀͢Δ.

  26. ΍͖͏෼ੳج൫Scrapyઃఆ(ൈਮ) • robots.txtʹै͏ • ROBOTSTXT_OBEY=True • ಉ࣌ϦΫΤετ਺ɿ4 • CONCURRENT_REQUESTS=4 •

    ϦΫΤετִؒɿ60ඵ • DOWNLOAD_DELAY=60 • Ωϟογϡɿ൒೔ؒอ࣋(΍Γ௚͕͠ޮ͘Α͏ʹ) • HTTPCACHE_ENABLED = True • HTTPCACHE_EXPIRATION_SECS = 60 * 60 * 12 • ࢓༷: https://doc.scrapy.org/en/latest/topics/settings.html?highlight=settings.py#settings
  27. αΠτ(ͱਓʹ)΍͘͞͠͠Α͏ʂ αΠτʹౖΒΕͳ͍Α͏ʹ͠Α͏(&έϯΧ͸΍Ίͯ)

  28. લॲཧ(SABRmetrics) • औಘݩαΠτʹແ͍ηΠόʔϝτϦΫε(SABRmetrics)ࢦඪ • wOBA,wRAA(ޙ΄Ͳ঺հ) • ಘ఺૑ग़ೳྗ(Run Create,௨শRC) • xx/9(HR/9,BB/9,etc…౤खͷ҆ఆײɾ࣮ྗΛଌΔܥͷࢦඪ)

    • ScrapyͰItemอଘ࣌or͢΂ͯͷσʔλΛऔಘޙʹܭࢉͷඞཁ͕ • ʲ݁࿦ʳηΠόʔϝτϦΫεࢦඪܭࢉ༻ͷύοέʔδΛ࡞ͬͨ
  29. SABR(໺ٿ౷ܭֶϥΠϒϥϦ) • GithubΛάάͬͯ΋ແ͔ͬͨͷͰࣗ࡞ͯ͠PyPIʹެ։ • OPS,RC,wOBA,wRAA,ΞμϜɾμϯ཰ͳͲΛܭࢉ͢Δ ΫϥεΛύοέʔδԽͨ͠ • https://github.com/Shinichi-Nakagawa/sabr • SABR͸΋ͪΖΜʮSABRmetricsʯͷ͜ͱ


    ୭΋࢖ͬͯͳ͔ͬͨͷͰಊʑͱొ࿥͠·ͨ͠w
  30. SABR(Example) $ pip install sabr $ python >>> import sabr

    >>> from sabr.stats import Stats >>> Stats.hr9(26, 209.7) # Yu Darvish(2013) HR/9 1.1
  31. Airflow(JOB؅ཧ)

  32. AirflowʙJOB؅ཧ • ຖ೔ܾ·ͬͨ࣌ؒʹΫϩʔϦϯά&εΫϨΠϐϯά͍ͨ͠ • ͨ·ͬͨσʔλʹରͯ͠લॲཧ΋͍ͨ͠ • ͱ͍͏༁Ͱ,Airbnbۘ੡ͷʮAirflow(ؾྲྀ)ʯΛར༻
 https://airflow.incubator.apache.org/ • ݱࡏ͸ApacheͷϓϩδΣΫτʹ,࢖ͬͯΔॴ΋ଟ͍

    • ͪͳΈʹRettyͰ΋Ұ෦ϓϩμΫτ(όοΫΤϯυ)ͰAirflowΛར༻
  33. Airflowͷ௕ॴ • ͔ͳΓߴػೳ.
 scheduler,workerʹ؅ཧը໘GUI·Ͱॆ࣮ • ΄΅͢΂ͯPythonͰ࣮૷.
 PythonΛ஌͍ͬͯΕ͹อक&։ൃ΋ΠέΔ • ࠷ۙࣄྫ͕૿͍͑ͯΔ,ίϛϡχςΟ΋ݩؾͬΆ͍

  34. AirflowͷਏΈ • ઃఆ͕͔ͳΓ൥ࡶ
 airflow.cfgʹू໿ͯ͠Δ΋ͷͷ,݁ߏΫη͋Δ • ґଘϥΠϒϥϦ͕େਿ಺
 ֦ுػೳΛશ෦ͷͤͰ100Λ௒͑Δ(ߴػೳͳ෼ͷ୅ঈ?) • ͪΐͬͱͨ͠ઃఆมߋͰ͙͢ಈ͔ͳ͘ͳΔ
 λεΫΛ௥Ճ,ઃఆมߋΛͪΐΖͬͱ͢Δ͚ͩͰ,


    ઃఆͷ࡞Γ௚͕͠ൃੜ&࠶౓migrationΛཁٻ͞ΕΔ(ਏΈ
  35. ʲ൵ใʳAirflow(ؾྲྀ)͸ ͪΐͬͱͨ͠ΞϨͰෆػݏʹͳΔ Turbulence(ཚؾྲྀ)ͩͬͨ #ֶͼ

  36. AirflowͷਏΈ͔ΒಀΕΔ • Docker Imageʹͯ͠ެ։ͨ͠(docker pull shinyorke/airflow)
 ܁Γฦ͠࡞ͬͯյ͢ͳΒDockerͰ͠ΐʂ
 ͱ͍͏͜ͱͰ৭ʑࢼͭͭ͠,҆ఆ൛ΛDocker ImageԽͨ͠
 https://hub.docker.com/r/shinyorke/airflow/

    • ݁Ռ,ؾܰʹ࡞ͬͯյͤΔ,ߏ੒Λ࿔ΕΔ؀ڥʹ
 ཚؾྲྀʹΑΔཚΕ͸ଟগϚγʹͳͬͨ(Ұ෦όάͬΆ͍ͷ͸͋Δ͕) • ৄࡉ͸ϒϩάʹॻ͖·ͨ͠&Contribute͓଴͍ͪͯ͠·͢
 http://shinyorke.hatenablog.com/entry/airflow-docker
  37. ෼ੳͱՄࢹԽʹ͍ͭͯ ʙJupyterͱRedashΛ࢖͍෼͚Δʙ

  38. ෼ੳͱՄࢹԽͷצͲ͜Ζ • ʮఆظతʹݟΔʯ͔ʮԾઆʹج͖࣮ͮݧʯ͢Δ͔Ͱ,
 ࢖͏ಓ۩Λ੾Γସ͑Δʢ͔ͳΓॏཁʣ. • ఆظతʹSQLΛୟ͍ͯάϥϑΛඳ͘ͳΒRedash • ڽͬͨՄࢹԽ΍࣮ݧతͳωλͰ͋Ε͹Jupyter • ཁ͸దࡐదॴ,μϧ͍ͷͰָ͢Δ෦෼͸ָ͠·͠ΐ͏.

  39. ࠓޙͷ΍͖͏ج൫։ൃܭը 1. Productionӡ༻(k8s+GCP,ࠓγʔζϯؒʹ߹Θͣ) 2. σʔληοτΛ૿΍͢(ࢼ߹,౤ٿ,ϝδϟʔϦʔά) 3. SABRͷpandas൛Λͭ͘Δ(ͩͬͯpandasศར͡ΌΜ?) 4. ෼ੳ݁ՌΛఆظతʹൃ৴͢ΔϝσΟΞ(ϒϩά)ެ։ 5.

    σʔλͷఏڙݩΛΈ͚ͭΔ(εΫϨΠϐϯάͭΒ͍)
  40. (PythonͬΆ͍τʔΫ͸) ͜͜·Ͱʂ ͜ͷઌ͸օ͞Μ͓଴͔ͪͶ…

  41. ΍͖͏ͷ࣌ؒͩ͋͋͋ʂʂʂ

  42. ໺ٿΛՊֶ͢Δٕज़ • Liner Weights(LWTS) • ಘ఺ظ଴஋(Run Expectancy) • ಘ఺Ձ஋(Run Value)

    • ಘ఺Ձ஋Λݩʹͨ͠ηΠόʔϝτϦΫεࢦඪ • wOBA(Weighted On-Base Average, ॏΈ෇͖ग़ྥ཰) • wRAA(Weighted Runs Above Average, ଧܸߩݙ౓)
  43. Liner Weights(LWTS) #ͱ͸ • ໺ٿͷϓϨʔΛಘ఺ʹஔ͖׵͑ͯධՁ͢ΔͨΊͷख๏ • ༷ʑͳঢ়گ(Ξ΢τΧ΢ϯτ,ϥϯφʔͷ਺etc…)ຖʹϓϨʔ Λه࿥,ฏۉԽͨ͠਺஋ΛݩʹʮϓϨʔͷՁ஋ʯΛଌΔ • ۩ମతͳ֓೦ͱͯ͠ʮಘ఺ظ଴஋ʯʮಘ఺Ձ஋ʯΛ༻͍Δ

    • ৄ͘͠஌Γ͍ͨํ͸WikipediaͷղઆΛͲ͏ͧ
 https://ja.wikipedia.org/wiki/Linear_Weights
  44. ಘ఺ظ଴஋ͱಘ఺Ձ஋ • ϥϯφʔͷ਺(8௨Γ)×Ξ΢τΧ΢ϯτ(3௨Γ)=24௨Γͷ ঢ়گΛ෼ྨ,͔ͦ͜Β3Ξ΢τऔΒΕΔ·Ͱʹ֫ಘͰ͖Δ (ͱࢥΘΕΔ)ฏۉతͳಘ఺Λʮಘ఺ظ଴஋(Run Expectancy)ʯͱݺͿ. • ϓϨʔ(ώοτ,૸ྥ,etc…)ʹΑͬͯ,ಘ఺ظ଴஋Λ্͛ͨ ͔(·ͨ͸Լ͔͛ͨ)ΛੵΈॏͶͯબखΛධՁ͢Δ.
 ͜ΕΛʮಘ఺Ձ஋(Run

    Value)ʯͱݺͿ.
  45. wOBA #ͱ͸ • ಘ఺Ձ஋Λݩʹࢉग़ͨ͠ग़ྥ཰(ಘ఺ʹد༩ͨ͠཰) • Weighted On-Base Average(ॏΈ෇͖ग़ྥ཰)ͷུ • ʮଧऀ͕1ଧ੮͋ͨΓʹͲΕ͚ͩνʔϜͷಘ఺૿Ճʹ

    ߩݙ͔ͨ͠ʯΛද͢ • MLB/NPBڞʹ࠷΋ϝδϟʔͳηΠόʔϝτϦΫεࢦඪ ͱͯ͠࢖ΘΕ͍ͯΔ
  46. wOBAͷ਺ࣜͱ࣮૷(sabrΑΓ) def woba_npb(cls, bb, hbp, _1b, _2b, _3b, hr, ab,

    sf, ibb=0, e_bb=0): """ Weighted on-base average for NPB(wOBA) http://1point02.jp/ :param bb: base on ball :param hbp: hit by pitch :param _1b: single :param _2b: double :param _3b: triple :param hr: home run :param ab: at bat :param sf: sacrifice fly :param ibb: intentional base on balls(default:0) :param e_bb: base on ball for error(default:0) :return: (float) wOBA """ u_bb = round(0.692 * float(bb-ibb), 3) u_hbp = round(float(0.73 * hbp), 3) u_e_bb = round(0.966 * float(e_bb), 3) u_h = round(0.865 * float(_1b), 3) + round(1.334 * float(_2b), 3)\ + round(1.725 * (_3b), 3) + round(2.065 * float(hr), 3) u_pa = round(float(ab + bb - ibb + hbp + sf), 3) return round((u_bb + u_hbp + u_e_bb + u_h) / u_pa, 3)
  47. wRAA #ͱ͸ • wOBAΛಘ఺ʹ߹Θͤͯscaleͨ͠ࢦඪ • Weighted Runs Above Average(ଧऀͷଧܸߩݙ౓)ͷུ •

    ʮฏۉతͳଧऀ͕ಉ͡ଧ੮਺ཱͬͨ৔߹ʹൺ΂ͯ૿΍͠ ͨಘ఺ʯΛΠϝʔδ • wRAA=(ଧऀͷwOBA-ϦʔάwOBA) / wOBAscale * ଧ ੮਺
  48. wRAAͷ਺ࣜͱ࣮૷(sabrΑΓ) def wraa(cls, woba, lg_woba, pa, woba_scale=1.24): """ Weighted Runs

    Above Average(wRAA) http://1point02.jp/ :param woba: weighted on-base average :param lg_woba: weighted on-base average(league average) :param pa: plate appearance :param woba_scale: weighted on-base average scale(default:1.24) :return: (float) wRAA """ return round(((woba - lg_woba) / woba_scale) * float(pa), 1)
  49. ʮ೉͗͢͠Δϯΰʂ͍͍͔͛Μʹ͠Ζʂʂʯ έϯΧμϝθολΠ(ຊ೔ೋճ໨)

  50. ͔ͨ͠ʹ೉͍͠ͷͰ ࠷ۙͷϓϩ໺ٿͷࣄ݅Λ έʔεελσΟͱͯ͠ղઆ

  51. ͋Δ೔(8/23)ͷ޿ౡελϝϯ

  52. ޿ౡ౦༸Χʔϓͷελϝϯ(8/23) 1.(༡)ాத 2.(ೋ)٠஑ 3.(த)ؙ 4.(ӈ)ླ໦ 5.(ࠨ)দࢁ 6.(ࡾ)੢઒ 7.(Ұ)҆෦ 8.(ั)။ᖒ 9.(౤)େ੉ྑ

    ରDeNAઓ https://baseball.yahoo.co.jp/npb/game/2017082302/stats
  53. ϑΝʔʔʔʂʁʂʁ(਒͑) 1.(༡)ాத 2.(ೋ)٠஑ 3.(த)ؙ 4.(ӈ)ླ໦ →(ӈ)ؠຊ 5.(ࠨ)দࢁ 6.(ࡾ)੢઒ 7.(Ұ)҆෦ 8.(ั)။ᖒ

    9.(౤)େ੉ྑ ରDeNAઓ https://baseball.yahoo.co.jp/npb/game/2017082302/stats
  54. ʲ൵ใʳ࢛൪ླ໦,ফ͑Δ(ࠓقઈ๬) ޿ౡླ໦੣໵͕ӈ଍टࠎં൑໌ʂ௧͗͢Δ̐൪ͷ཭୤ https://www.nikkansports.com/baseball/news/1876605.html

  55. ࠷ۙ(9/3)ͷ޿ౡελϝϯ

  56. ޿ౡ౦༸Χʔϓͷελϝϯ(9/3) 1.(༡)ాத 2.(ೋ)٠஑ 3.(த)ؙ 4.(ࠨ)দࢁ 5.(ࡾ)੢઒ 6.(Ұ)҆෦ 7.(ั)။ᖒ 8.(ӈ)໺ؒ 9.(౤)Ԭా

    ରϠΫϧτઓ https://baseball.yahoo.co.jp/npb/game/2017090301/stats
  57. ʮOUT:ླ໦ɹ, IN:໺ؒɹ ͕Ұिؒଓ͍ͨ৔߹, ಘ఺ྗ͸Ͳ͏มԽ͢Δ͔?ʯ …ͱ͍͏໰୊ΛwRAAͰղ͘
 
 ˞࣮ࡍ͸ϥΠτ೔ସΘΓͰ͢

  58. ධՁํ๏ • ླ໦͕ൈ͚Δલ(8/17-8/23)ͷσʔλͱ
 ླ໦͕ൈ͚ͨޙ(8/28-9/3)ͷσʔλΛൺֱ • ླ໦͕ൈ͚ͨ݀Λ(ॹํతʹҰํతʹ)໺ؒͰ୅ೖ͢Δ
 #伱͋Β͹໺ؒ #ͳΜJ • ൺֱͷࢦඪ͸wRAAΛ࢖͏,200ଧ੮Ҏ্ग़৔ͷબखͰੵΈ্͛


    ͳ͓໺ؒ͸200ଧ੮ະຬ͕ͩಛผʹೖΕͨ #伱͖͋Β͹໺ؒ • खҧ͍Ͱ8/30ͷΈσʔλൈ͚·ͨྃ͠͝ঝΛm(_ _)m
  59. RedashͰՄࢹԽ

  60. RedashͰՄࢹԽ ླ໦੣໵཭୤લ   X3""߹ܭɿ

  61. RedashͰՄࢹԽ ླ໦੣໵཭୤લ   X3""߹ܭɿ ໺ؒ*/ͨ͠ޙ X3""߹ܭɿͪΐ͍

  62. ಉ͡ՄࢹԽΛJupyterͰ

  63. Jupyter+holoviews

  64. Jupyter+holoviews "ɿླ໦੣໵཭୤લ X3""߹ܭ஋͕͙Β͍

  65. Jupyter+holoviews "ɿླ໦੣໵཭୤લ X3""߹ܭ஋͕͙Β͍ #ɿ཭୤ޙ X3""߹ܭͪΐͬͱ

  66. ݁࿦ • ૯߹ܭͰ໿30%νʔϜͷwRAA͕௿Լͨ͜͠ͱ͕൑໌ • ϚΠφεཁҼ • ࢛൪ଧऀ͕ফ͑ͨ #ͦΒͦ͏Α • ໺͕ؒॱௐʹwRAAͰϚΠφε

    #ͦΒͦ͏Α • ࠓճͷՄࢹԽ͸Redashͷํ͕΍Γ΍͔ͬͨ͢ • Jupyterͱ͍͏͔Holoviews࢖͍͜ͳ͍ͨ͠ #͓ؾ࣋ͪ
  67. ʲ౴ʳ ླ໦੣໵཭୤Ͱ
 ಘ఺ྗ͕໿30%௿Լ͢Δ (ཧ࿦্͸)

  68. ࣮ࡍͷ޿ౡ͸... ※9/7࣌఺ • 8/23-9/7ͷ੒੷ • 9উ5ഊɹ˞6࿈উத • ಘࣦ఺ࠩ +20 ※70ಘ఺,

    50ࣦ఺ • উ཰.642, ϐλΰϥεউ཰.662 • 30%ͷಘ఺ྗ௿ԼΛாফ͠ʹͨ͠ଧऀ͕͍ΔͬΆ͍
  69. ʲਤʳ8/23-9/7ͷwOBAਪҠ

  70. ʲਤʳ8/23-9/7ͷwOBAਪҠ ɾদࢁཽฏ ϨϑτɾϥΠτ  ɾ҆෦༑༟ ϑΝʔετ  ɾ။ᖒཌྷ Ωϟονϟʔ 

    ͷX0#"͕վળˠಘ఺ྗ૿Ճ ॾʑͷϚΠφεΛվળ
  71. ݁ͼ

  72. (੣໵͕ൈ͚ͨΒ)ͦΒͦ͏Α

  73. ݁ͼ • ͦΒ(ླ໦੣໵ൈ͚ͨΒಘ఺͕େ෯ʹݮΔʹ)
 ͦ͏Α(ܾ·ͬͯΔ͡Όͳ͍͔) • ໺ٿͷՊֶ(ηΠόʔϝτϦΫε)ͱ
 σʔλʹڧ͍PythonͰ٬؍త͔ͭࢹ֮తʹઆ໌Ͱ͖·͢Αͱ • 30%ͷಘ఺ྗ௿ԼΛແࢹͯ͠ϚδοΫΛݮΒ͠ଓ͚ΔΧʔϓͷා͞ •

    ΍͖͏෼ੳج൫Ͱ໘ന͍͜ͱ͕Ͱ͖ͦ͏ͳͷͰҾ͖ଓ͖։ൃ΍Δͧʂ • Python΋໺ٿ΋,͜ͷωλ͕ʮ͓΋Ζ͍ʂʯͱࢥͬͨΒਅࣅͯ͠΄͍͠
  74. ʮਅࣅΛ͢Δ͜ͱʯ is OUTPUT & FOLLOW #ࢲͳΓͷ݁࿦

  75. Special Thanks …ͱ,ձ৔ͷօ͞·ʂ ͝ڠྗ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂʂ

  76. ήʔϜηοτʂʂʂ ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠&Ҿ͖ଓ͖PyConJP 2017Λָ͠Έ·͠ΐ͏! Shinichi Nakagawa(Twitter/Facebook/etc… @shinyorke)