Upgrade to Pro — share decks privately, control downloads, hide ads and more …

投球を可視化する技術〜Analyzing Pitching Data With Python

投球を可視化する技術〜Analyzing Pitching Data With Python

MLBの一球速報データを使った投球データの可視化をPython他でやってみました.

BPStudy #103 2016/3/22 発表資料

Shinichi Nakagawa

March 22, 2016
Tweet

More Decks by Shinichi Nakagawa

Other Decks in Research

Transcript

  1. Who am I? • Shinichi Nakagawa(@shinyorke) • Pythonista/Agile Software Development/Baseball

    Analyst • visasQ(ϏβεΫ) Python Engineer/Scrum Master • ๺ւಓ೔ຊϋϜϑΝΠλʔζ/Oakland Athletics • ιχʔɾάϨΠ(OAK)ͷαΠϠϯά৆ड৆
 &Ԭ޿ւ(೔ϋϜ)ͷελϝϯୣऔΛ৴͍ͯ͡·͢.
  2. ࠓγʔζϯݟͲ͜Ζ ݟͲ͜Ζ ੈؒͷ෩ை த઒ͷݟղ ༏উνʔϜ ɾιϑτόϯΫ ɾϠΫϧτ ɾ೔ϋϜ ɾڊਓPS޿ౡ τϦϓϧεϦʔ

    ɾ༄ా༔ذ ೥࿈ଓ  ɾࢁా఩ਓ ೥࿈ଓ ࢁా఩ਓ ೥࿈ଓ  Ϊʔλ͸ࡾףͲ͏ͧ ΰʔϧσϯάϥϒ৆ ɾ༄ా༔ذ $'  ɾௗ୩ܟ 44 ɾೋਓڞ຅ऩ ɾγϣʔτ͸୭͕ʁ ۙ౻݈հ ೔ϋϜ ɾׂຊ͍͚ΔͰʂ ɾࢦ໊ଧऀPSϥΠτ ۙ౻ ࢦcӈcัcࡾc༡  ˠॅॴෆఆʹͳΔ
  3. Starting Member • ໺ٿHack!2015೥ৼΓฦΓ • MLBҰٿ଎ใσʔλͱ໺ٿHack • MLBҰٿ଎ใσʔλΛPythonͰHackͯ͠ΈΔ
 ʙpitchpxͱJupyter +

    pandas + matplotlibʙ • ར༻ྫʙؠ۾ٱࢤϊʔώοτϊʔϥϯ • ݁ͼʙࠓޙͷ໺ٿHack(PyCon JP 2016ʹ޲͚ͯ) • ʲΦϚέʳ2016೥ϓϩ໺ٿେ༧૝
  4. ໺ٿHack!1.0(PyCon JP 2015) • MLBͷࢼ߹͝ͱͷଧ੮σʔλΛHack! • ࢄาʢ࢛ٿʣͷ਺ʢΠονVSϘοτʣ • ϐονϟʔͷ݄ผউͪ੕ʢδϣϯɾϨελʔʣ •

    ຖ೔ຖࢼ߹ͷσʔλΛऔಘ&෼ੳ • ΞμϜɾμϯ཰ʢଧऀʣ • ඃΞμϜɾμϯ཰ʢ౤खʣ • ৄ͘͠͸εϥΠυΛޚཡ͍ͩ͘͞ or ʮ໺ٿ PythonʯͰάάΖ͏
  5. Analyzing Baseball Data with R • MLBͷΦʔϓϯσʔλʮRetrosheetʯ,
 MLB at BAT଎ใσʔλΛ༻͍ͨσʔλ෼ੳɾՄࢹ

    Խʹ͍ͭͯॻ͔Ε͍ͯΔॻ੶ʢӳޠʣ • RݴޠΛ࢖ͬͨ෼ੳͱՄࢹԽͷωλ͕ϝΠϯ • ʮpitchRxʯͱ͍͏ɺRݴޠͷϥΠϒϥϦΛ༻͍ͯ
 at BATσʔλΛऔಘ&ՄࢹԽ
  6. pitchpx - Getting MLB dataset • MLB at BATͷҰٿ଎ใσʔλΛऔಘ&εΫϨΠϐϯάͯ͠ CSVσʔληοτʹམͱ͢PythonϥΠϒϥϦ.

    • pitchRx(R)ͳͲΛࢀߟʹࢲ͕։ൃ͠·ͨ͠. • ίϚϯυϥΠϯπʔϧͰ͢. • Python 3.3.xҎ্ઐ༻ˡڧ͍ͩ͜ΘΓ • PyPIͰެ։͍ͯ͠·͢ʂʂʂʢ୭Ͱ΋࢖͑Δʣ
  7. ࢖͍ํ $ # Python 3.3Ҏ্(ਪ঑Python 3.4Ҏ্)͕ಈ͘؀ڥͰ΍ͬͯͶ $ pip install pitchpx

    $ # ྫɿ2015/8/1-8/12·Ͱͷࢼ߹݁ՌΛऔಘ͢Δ $ pitchpx -s 20150801 -e 20150812 -o .
  8. ݁ͼʙ2016೥ͷ໺ٿHack! • ͦΒʢࠓ೔͸౤ٿσʔλͷՄࢹԽ͔ͩΒʣ
 ͦ͏ʢͭ͗͸कඋσʔλͷՄࢹԽʹʣ
 Αɹʢܾ·͍ͬͯΔ͡Όͳ͍͔ʣ • PyCon JP 2016(9/21,22)͸ɺ
 ʮAnalyzing

    Baseball Data With Pythonʯ
 ͱ͔ͦΜͳλΠτϧͰ΋ͬͱ໘ന͍࿩͕Ͱ͖Δϋζ. • ຊ೔ެ։ͨ͠ωλ͸ੋඇ༡ΜͰΈͯʂ
 ˠػցֶशͷ୊ࡐͱ͔ʹΠέΔΜ͡Όͳ͍ʁ