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

Charty on Rails - Railsdm 2019

Charty on Rails - Railsdm 2019

Charty on Rails - Railsdm 2019

秒速284km

March 23, 2019
Tweet

More Decks by 秒速284km

Other Decks in Programming

Transcript

  1. What is Charty ? Charty is an open-source Ruby library

    for visualizing your data in a simple way. https://github.com/red-data-tools/charty
  2. In Charty, you need to write very few lines of

    code for representing what you want to do. It lets you focus on your analysis of data, instead of plotting. i.e. We aim at convenience. What Charty is focusing on
  3. Abstraction Layer - Data Abstraction Layer - Input (Data Structure)

    - Plotting Abstraction Layer - Output (Plotting Library)
  4. Plotting Library - Matplotlib - Python ੡ͷϥΠϒϥϦɻଟػೳɻҰ൪ଟ͘ͷάϥϑͷछྨΛϓϩοτՄೳɻ - Gruff -

    Ruby ੡ͷ plotting libraryɻRMagic (Imagimagic ʹґଘ͍ͯ͠Δ) - Mac Λ࢖͍ͬͯΔํ͸ default Ͱ Imagemagic 7 ͕ install ͞ΕΔ͚Ͳ RMagic ͕ ରԠ͍ͯ͠ͳ͍ɻ - Watson ͞Μ͕͜ͷลΓͷ։ൃΛਐΊͯ͘Ε͍ͯΔɻWatson ͞Μ͋Γ͕ͱ͏
  5. Plotting Library - rubyplot - GSoC 2018 Ͱ࠾୒͞ΕͨϓϩδΣΫτͰɺܧଓͯ͠։ൃதͷ Plotting Library

    - Charty ͱ rubyplot ͷ࿈ܞΛ͢Δ·Ͱʹ͸ɺSciRuby ͷϑΥʔϥϜͰձ࿩Λͨ͠ ΓɺRed Data Tools ͷ։ൃͷू·Γʹ࡞ऀͷ Sameer ͕དྷͯ͘ΕͨΓͱɺͦ͏͍ ͏ڠྗ͕͋ͬͨΓͨ͠ͷ͸͓΋͠Ζ͔ͬͨͰ͢ɻ͓΋͠Ζ͔͚ͬͨͩ͡Όͳ͘ ͯɺ࣮ࡍ͜͏͍͏ྲྀΕΛগͣͭࣗ͠෼͕ͨͪ࡞͍ͬͯ͘ͱ͍͏ͷ͸େࣄͩͱࢥ ͏ΜͰ͢ΑͶɻେࣄͩͱࢥ͏͔Βɺࣗ෼ʹͰ͖ͦ͏ͳػձ͕໨ͷલʹ͋ͬͨͷ Ͱ΍ͬͯΈ·ͨ͠ɻ
  6. ࢀߟʹͨ͠ϥΠϒϥϦͳͲ - holoviews (Python) - Gadfly.jl (Julia) - ggplot2 (R)

    - Julia Package GR (GR Framework) - Python Package GR (GR Framework) - PyCall Λհͯ͠࢖͏ϥΠϒϥϦͷ࣮૷ (matplotlib.rb, matplotlib, pyplot ͱ͔) - ଞʹ΋͍Ζ͍Ζ……
  7. োนͷ 2 ͭ໨͸ɺ࢓ࣄͰػցֶश΍౷ܭ෼ੳΛ ΍͍ͬͯΔਓͷଟ͕͘࢓ࣄͰ Python ΍ R Λ࢖ͬ ͍ͯͯɺRuby ͷͨΊʹࣗ෼Ͱ࡞ͬͨ΋ͷΛ࢓

    ࣄͰ࢖͑Δػձ͕΄ͱΜͲແ͍͜ͱͰ͢ɻ ϓϥ ΠϕʔτͰػցֶश΍౷ܭ෼ੳΛ΍Δػձ͕͋ Δͱͯ͠΋ɺ࢓ࣄͰ࢖͍׳Ε͍ͯΔ؀ڥΛ࢖͏ ํ͕ྑ͍ͱߟ͑Δਓ͸ଟ͍Ͱ͠ΐ͏ɻ
  8. Red Data Tools ͷϙϦγʔ https://red-data-tools.github.io/ja/ 1. RubyίϛϡχςΟʔΛ௒͑ͯڠྗ͢Δ 2. ඇ೉͢Δ͜ͱΑΓ΋खΛಈ͔͢͜ͱ͕େࣄ 3.

    Ұճ͚ͩͷ׆ൃͳ׆ಈΑΓ΋খͯ͘͞΋͍͍ͷͰܧଓతʹ׆ಈ͢Δ͜ͱ͕େࣄ 4. ݱ࣌఺Ͱͷ஌ࣝෆ଍͸໰୊Ͱ͸ͳ͍ 5. ෦֎ऀ͔Βͷඇ೉͸ؾʹ͠ͳ͍ 6. ָ͘͠΍Ζ͏ʂ
  9. Red Data Tools ͷϙϦγʔ https://red-data-tools.github.io/ja/ 1. RubyίϛϡχςΟʔΛ௒͑ͯڠྗ͢Δ 2. ඇ೉͢Δ͜ͱΑΓ΋खΛಈ͔͢͜ͱ͕େࣄ 3.

    Ұճ͚ͩͷ׆ൃͳ׆ಈΑΓ΋খͯ͘͞΋͍͍ͷͰܧଓతʹ׆ಈ͢Δ͜ͱ͕େࣄ 4. ݱ࣌఺Ͱͷ஌ࣝෆ଍͸໰୊Ͱ͸ͳ͍ 5. ෦֎ऀ͔Βͷඇ೉͸ؾʹ͠ͳ͍ 6. ָ͘͠΍Ζ͏ʂ ·͋ɺίʔυ͕ޙ͔Βग़ͯ͘Δ͔ ΒͦΕͰ͍͍͔…ɻͱ͸ࢥ͍ͬͯ ͚ͨͲɺ ͦͷ࣌ظ͸ 2, 5 ͋ͨΓΛؾΛ͚ͭ ͯ͸͍·ͨ͠Ͷɻ ࣗ෼ͷϞνϕʔγϣϯΛԼ͛ͳ͍ ͜ͱΛԿΑΓ͍ͩ͡ʹͨ͠ɻ
  10. ݁ہ๻͸ԿΛࢥͬͯ׆ಈ͍ͯ͠Δͷ͔ͳ https://red-data-tools.github.io/ja/ 1. RubyίϛϡχςΟʔΛ௒͑ͯڠྗ͢Δ 2. ඇ೉͢Δ͜ͱΑΓ΋खΛಈ͔͢͜ͱ͕େࣄ 3. Ұճ͚ͩͷ׆ൃͳ׆ಈΑΓ΋খͯ͘͞΋͍͍ͷͰܧଓతʹ׆ಈ͢Δ͜ͱ͕େࣄ 4. ݱ࣌఺Ͱͷ஌ࣝෆ଍͸໰୊Ͱ͸ͳ͍

    5. ෦֎ऀ͔Βͷඇ೉͸ؾʹ͠ͳ͍ 6. ָ͘͠΍Ζ͏ʂ ·͋ɺίʔυ͕ޙ͔Βग़ͯ͘Δ͔ ΒͦΕ͍͍͔…ɻͱ͸ࢥ͍ͬͯͨ ͚Ͳɺ ͦͷ࣌ظ͸ 2, 5 ͋ͨΓΛؾΛ͚ͭ ͯ͸͍·ͨ͠Ͷɻ ࣗ෼ͷϞνϕʔγϣϯΛԼ͛ͳ͍ ͜ͱΛԿΑΓ͍ͩ͡ʹͨ͠ɻ ๻͸લʹਐΈ͍ͨͷͰ͋ͬͯɺͦͷͨΊʹ͸ͻͱͭͣͭੵΈ͋͛Δ ͔͠ͳ͍ͱࢥ͏ɻ Ͳ͏ͨ͠ΒੵΈ্͛ΒΕΔ͔ͬͯݴ͏ͱɺ࣮ߦͯ͠ɺվળͯ͠ɺ࣮ ߦͯ͠ɺͷ܁Γฦ͠ɻ ͦͷઌָ͕͠ΈͩͬͨΓɺ৴͡ΒΕΔͳΒͦΕΛࢭΊͨ͘͸ͳ͍ ͨͩͦ͏͍͏͜ͱ͚ͩΛେ੾ʹͯ͠ɺ޾͍ͳ͜ͱʹɺࠓ͸ಉ͡Α͏ ͳ͜ͱΛߟ࣮͑ߦ͢Δਓୡͱڠྗͯ͠ઌʹਐΊΔ͜ͱ͕ग़དྷ͍ͯΔ
  11. ਐΊํʹ޻෉͕ඞཁͩͬͨ͜ͱ - Plotting Library ͔Β࣮૷Λ͸͡Ίͨ - ͜Ε͸ɺCharty ͷҰ൪ຊ࣭తͳಈ࡞͸ɺάϥϑΛඳը͢Δ͜ͱ͔ͩΒ - ݁Ռ(੒Ռ)

    ͱͯ͠Ұ൪Θ͔Γқ͍ͱ͜Ζ͔ΒͲʔΜͱ࡞ͬͯখ͘͞ػೳ௥Ճ(վળ) ͍ͯ͘͠ɻͱ͍͏ͷ͸ࣗ෼ͷ Ϟνϕʔγϣϯҡ࣋ͷͨΊʹ΋େࣄ - Ұ೔ͷ࡞ۀ࣌ؒ͸ݶΒΕ͍ͯͯɺࡉ੾Εͷ࣌ؒͰ࡞ۀ͢Δ͜ͱ΋͋Δɻ - ࡞ۀ࠶։ͷෛՙΛԼ͛ɺͳΔ΂͘୹࣌ؒͰऴΘΔ୯ҐͷλεΫʹ෼ղͯ͠࡞ۀͷϦζϜΛ࡞Γ΍͘͢͢Δɻࣗ෼ ΛϊηΔɻϞνϕʔγϣϯΛͳΔ΂͘Լ͛ͳ͍ɺͰ͖Ε͹্͛Δɻࣗ෼Λὃͯ͠Ϟνϕʔγϣϯ͕΋্͕͠ΔͳΒ͖ͬ ͱ੒Ռ΋ग़ΔͩΖ͏͔Βὃͪ͠Ό͙͑Β͍ͷؾ࣋ͪɻͦΕ͙Β͍Ϟνϕʔγϣϯͱ͍͏΋ͷ͸େࣄͩͱײ͍ͯ͡Δɻ - ॱ൪తʹɺॲཧϑϩʔͷऴΘΓ (άϥϑඳը) ͔Β٧Ί͍ͯͬͨํ͕ޙ໭Γ͕গͳ͍ͩΖ͏͔Βɻ(data abstraction layer, plotting abstraction layer ͲͪΒ΋ɺख୳ΓͰਐΊΔͱ͍͏ελʔτΛ੾͍ͬͯΔͷͰ) - σʔλߏ଄͕มΘ͔ͬͨΒϓϩοτํ๏ʹ΋Өڹͪ͠Ό͍·ͨ͠ɻͱ͍͏ͷ͸͋ΓಘΔ͡Όͳ͍Ͱ͔͢ɻ
  12. ͲͷΑ͏ʹਐΊ͔ͨ - Matplotlib ΛϦϑΝϨϯε࣮૷ͱͯ͠࠷ॳʹ࣮૷ͨ͠ - ͜Ε͸࣮͸ɺҰ൪࠷ॳ͸ rubyplot ͔Β࣮૷Λ͸͡Ίͯޙ໭ΓΛͯ͠ɺMatplotlib ͔ Β࠶࣮૷͍ͯ͠Δɻ

    - rubyplot ͕ Plotting Library ͱͯ͠αϙʔτ͍ͯ͠Δ backend Ͱ͋Δ GR Framework ͕ ັྗతͰ࢖͍͍ͨɻͱ͍͏ͷ͕ɺCharty Λ࣮૷͠͸͡Ίͨ࣌ʹɺ࠷ॳʹඳ͍ͨΑͦ͞ ͏ͳ Charty ͷࡏΓํͩͬͨɻ͔ͩΒ rubyplot ͷίʔυ΋શ෦ಡΜͰɺrubyplot ͷ։ൃʹ ΋ඞཁͳΒՃΘΔؾͰ͍ͨɻ࣮ࡍɺPR ΋ग़͠͸͡Ί͍ͯͨɻ - Charty ͸ Charty ͱͯ͠ɺബ͍ϥούʔͱͯ͋͠Δ΂͖ͱߟ͑௚͠ɺ͜ͷลΓ͔Β holoviews ͷΑ͏ͳࡏΓํΛҙࣝ࢝͠Ίͨɻ
  13. ๻͕࿩͢ҙຯ͕͋Γͦ͏ͳ͜ͱ Data Visualization ʹ͍ͭͯɺϩΫʹ஌Βͳ͍ঢ়ଶ͔Βελʔτͯ͠ɺ࣮૷·ͰͨͲΓண͍ͨͱ͍͏ ͜ͱ (Red Data Tools ͷϙϦγʔͷ 4.

    Ͱ͢Ͷɻଟ͘ͷਓʹॿ͚ͯ΋Β͍΋ͨ͠) ࠷ۙ਎ͷճΓͰΑ͘ฉ͘ͷ͚ͩΕͲɺ੒Ռ͕ग़ͤΔࣗ਎͕ແ͍͔Βߦ͖͍͚ͨͲࢀՃ͠ͳ͍બ୒Λ ͢Δͱ͔ɺ΍ΕΔΑ͏ʹͳΓ͍͚ͨΕͲɺ࢝ΊΒΕΔ΋ͷ͕·ͩແ͍͔ΒࢀՃͰ͖ͳ͍Ͱ͍Δɻͱ ͔ɻ ͜ΕΒ͸΋͍ͬͨͳ͍ɻࣦഊ͕͋ͬͯ΋Α͍͠ɺيಓʹ৐Δ·Ͱʹ͕͔͔࣌ؒͬͯ΋·͋ྑ͍ͷͰ ͸ɻࣗ෼ʹ߹Θͳ͔ͬͨΓɺͭ·Βͳ͍ͱײ͡ΔͳΒ΍Ίͯ͠·͑͹Α͍͠ɺͦΕΒΛ࢝Ίͳ͍ཧ ༝ʹͯ͠͠·͏ͷ͸΋͍ͬͨͳ͍ɻ΍ͬͯΈͨ࣌ʹ͚ͩɺͦͷઌ͕ݟ͑ΔՄೳੑ͕͋Δͷ͔ͩΒɻ ϋʔυϧΛΊ͍ͬͺ͍Լ͛ͯɺͬ͞ͱ࣮ߦͯ͠ɺͦͷ࣌΋͏Ұ౓ɺͪΐͬͱਖ਼֬ʹͳͬͨঢ়ଶͷ൑ அΛ͢Ε͹͍͍Μ͡Όͳ͍͔ͳɻ
  14. ๻͕࿩͢ҙຯ͕͋Γͦ͏ͳ͜ͱ ࣗ෼͸ɺࣗ෼ͷίʔυͰͳ͍(ଞਓͷ;ΜͲ͠Ͱ) ൃද͢Δ͜ͱΛ(ͦΕ͔͠ग़དྷͳ͍͜ͱ Λ)Ͳ͏ʹ͔͍ͨ͠ͱͣͬͱࢥ͍ͬͯͨɻ ͦ͏Ͱͳ͍ͱɺൃද͢ΔՁ஋͕ͳ͍ͷͰ͸ͳ͍͔ͱɺؾʹ͍ͯͨ࣌͠ظ͕͋ͬͨɻ (ଞͷਓ͕ൃද͢Δ࣌͸ɺͦ͏͍͏ͷ͸શવؾʹ͍ͯ͠ͳ͔͚ͬͨΕͲ) ͦ͏Ͱ͸ͳ͍ɻͱ͍͏͜ͱʹ΍ͬͱࣗ਎Λ࣋ͭ͜ͱ͕ग़དྷ͖ͯͨɻͨͱ͑͹ɺ Ruby Grant 2017

    ͷ k0kubun ͞Μͷ࠷ऴใࠂॻͰɺ๻ͷ ԭೄRubyձٞ02 Ͱͷࢿྉ͕ࢀর͞ Ε͍ͯΔɻ( https://www.ruby.or.jp/assets/images/ja/news/20180501.data/kokubun.pdf ) ΋͠ Charty ͩͬͨΓɺࣗ෼ͷॻ͍ͨػೳΛࢼͯ͘͠ΕͯɺͦΕʹ͍ͭͯॻ͖࢒ͯ͘͠Εͨ ΓɺͲ͔͜Ͱൃදͯ͘͠ΕͨΓ͍ͯͨ͠Β͏Ε͍͠ɻ ͔ͩΒ͋Ε͸ྑ͔ͬͨΜͩɻͱࢥ͑ΔΑ͏ʹͳͬͨɻ
  15. Future Plans - Data Abstraction Layer - Support NMatrix(࣮૷ͨ͠) -

    Support Red::Arrow - Support benchmark_driver (ϕϯνϚʔΫ݁ՌͷՄࢹԽ)(ॳظ࣮૷͸Ͱ͖ͨͷͰɺվળ͢Δ) - Plotting Abstraction Layer - ग़ྗՄೳͳάϥϑͷ௥Ճ - Support rubydown (https://github.com/sciruby-jp/rubydown) ࠓޙɺ΋ͬͱָʹ࢖͑Δঢ়ଶʹ͍ͨ͠ɻ(·ͩͪΐͬͱ͕Μ͹Βͳ͍ͱ࢖͑ͳ͍ͱ͍͏ೝࣝͳͷͰ)
  16. Thanks a lot for having me Railsdm ʹฏ໺͞Μ͕ؔΘΔͷ͕࠷ޙͱฉ͍͍ͯ·͢ɻ ๻͸ Railsdm

    ʹ͸৭ʑͳؔΘΓํΛ͖ͯ͠·͕ͨ͠ɺ Railsdm Λ ௨ͯ͡੒௕ͨ͠ϥϯΩϯάͰ͚ͬ͜͏্Ґʹ͘Δͱࢥ͏ͷͰ͢Ͷɻ 2017, 2018, 2019 ೥ͱ͍͏ظؒΛΑΓָ͘͠ա͢͜͝ͱ͕Ͱ͖·͠ ͨɻ ͦΕ͸ฏ໺͞Μ͕ Railsdm Λଓ͚ͯ͘Ε͔ͨΒͰ͢ɻ ͋Γ͕ͱ͏͍͟͝·͢ɻ