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

(ほぼ)Pythonだけで分析基盤を作った #kwskrb #51

(ほぼ)Pythonだけで分析基盤を作った #kwskrb #51

ScrapyとAirflow,Jupyter(holoviews)で野球データ分析基盤を作りましたというLT.

kawasaki.rb #51 5年目突入LT大会
https://kawasakirb.connpass.com/event/64466/

Shinichi Nakagawa

August 22, 2017
Tweet

More Decks by Shinichi Nakagawa

Other Decks in Programming

Transcript

  1. Who am I ?(͓લ୭Α) • Pythonք۾ͷʮ໺ٿͷਓʯͰ͢ • Shinichi Nakagawa(@shinyorke) •

    Retty.Inc Engineering Manager
 ݉,ڕྉཧ୲౰ • Baseball Scientist/໺ٿσʔλ෼ੳऀ • #Python #SABRmetrics #໺ٿ౷ܭֶ #Agile #Scrum
  2. Starting member(͓͠ͳ͕͖) • Kawasaki.rb5೥໨ಥೖ͓ΊͰͱ͏͍͟͝·͢ • PythonͰͭ͘ΔʮԶʑ໺ٿ෼ੳج൫ʯ • Scrapy(σʔλूΊ) • sabr

    + SQLAlchemy(લॲཧ) • Airflow(λεΫ੍ޚ) • ʲ࣮ફྫʳΧʔϓ͕ڧ͗͢Δཧ༝ΛwRAAͰূ໌͢Δ
  3. ࢲͱ #kwskrb • ॳࢀՃ(2014/8)ɿPyCon JP 2014นଧͪLT • ೋճ໨(2015/9)ɿPyCon JP 2015นଧͪLT(2೥࿈ଓ)

    • ࡾճ໨(2016/8)ɿPyCon JP 2016นଧͪLT(3೥࿈ଓ)
 ※઒࡚Rubyձٞ01 LT • ࢛ճ໨(2016/12)ɿҿΈͨ͞ͱ࿩ͨ͠͞Ͱ๨೥ձࢀՃ • ޒճ໨(2017/8)ɿ PyCon JP 2017นଧͪLT(4೥࿈ଓ)←ΠϚίί
  4. ScrapyʙΫϩʔϥʔFW • WebαΠτͷΫϩʔϧͱεΫϨΠϐϯά,σʔλͷอଘͳ ͲΛҰؾ௨؏ʹߦ͑ΔΫϩʔϥʔFW • ΫϩʔϥʔքͷDjango/Ruby On RailsͱݺΜͰ͍͍ଘࡏ • εέδϡʔϥʔ,UserAgent,HTTP

    Header,μ΢ϯϩʔυͷ λΠϛϯά,Ωϟογϡetc…ඞཁʹͳΔ΋ͷ͕͋Β͔͡Ί ༻ҙ͞Ε͍ͯΔ&ύϥϝʔλͷઃఆͳͲͰ؆୯ʹઃఆՄೳ
  5. લॲཧ(sabr + SQLAlchemy) • ʲ՝୊ʳԿ౓΋ग़ͯ͘ΔηΠόʔϝτϦΫεܭࢉ
 ຖճίʔυॻ͘ͷ΋ΞϨͩͳ͋ • ͱ͍͏Θ͚Ͱ,OPS,RC,wOBA,wRAA,ΞμϜɾμϯ཰etc…
 Λܭࢉ͢ΔΫϥεΛύοέʔδʹͯ͠ެ։ •

    https://github.com/Shinichi-Nakagawa/sabr • εΫϨΠϐϯάͨ݁͠Ռ͔Βࢦඪܭࢉ͢ΔΑ͏ʹͨ͠
 DBૢ࡞͸SQLAlchemy(O/R Mapper)ͰαΫοͱ։ൃ
  6. 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