Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Jupyter Notebook (jupyterhub)で ruby とグラフ / k-ru...
Search
Koichi Shimozono
April 11, 2018
Programming
0
150
Jupyter Notebook (jupyterhub)で ruby とグラフ / k-ruby 20th
2018/04/11 の第20回 k-ruby の資料です。
Koichi Shimozono
April 11, 2018
Tweet
Share
More Decks by Koichi Shimozono
See All by Koichi Shimozono
CentOS 8 での Ruby 環境
simozono
0
240
Serverspecを使用したサーバ設定テストの実例 / かごもく No8
simozono
0
290
Other Decks in Programming
See All in Programming
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
0
240
はじめてのカスタムエージェント【GitHub Copilot Agent Mode編】
satoshi256kbyte
0
140
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
160
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
160
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
210
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.5k
愛される翻訳の秘訣
kishikawakatsumi
3
370
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
310
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
460
Basic Architectures
denyspoltorak
0
160
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
300
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
2k
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
1
220
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
Discover your Explorer Soul
emna__ayadi
2
1k
Docker and Python
trallard
47
3.7k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
54
Speed Design
sergeychernyshev
33
1.5k
4 Signs Your Business is Dying
shpigford
187
22k
Typedesign – Prime Four
hannesfritz
42
2.9k
Building the Perfect Custom Keyboard
takai
2
670
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
200
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
180
Transcript
Jupyter Notebook (jupyterhub)で rubyとグラフ 鹿児島大学学術情報基盤センター 下園幸一
[email protected]
2018/04/11 第20回 K-Ruby
1
Jupyter Notebook 概説(1) ジュパイターでもジュピターでもいいみたい ◦ http://youglish.com/search/Jupyter 経緯 ◦
元々は IPython Notebook ◦ その後、Python だけでなく、Julia , Rにも対応 Julia + Python + R = Jupyter ◦ 現在は、Ruby, Haskell, Scala, node.js 等にも対応 ◦ 7つの言語の Juputer Notebook を作る https://matsubara0507.github.io/posts/2017-04-24-create- jupyter-for-seven-lang-part1.html Project Jupyter が開発元 ( http://jupyter.org ) 2018/04/11 第20回 K-Ruby 2
Jupyter Notebook概説(2)何ができるの? 一言で言うと「Web上でのPython等言語の対 話的実行環境」 ◦ http://techlife.cookpad.com/entry/write-once- share-anywhare ◦ コードと実行結果と説明文(Markdown)を同時に扱
う ◦ コードとグラフを同一画面で扱う ◦ コードの改変、再実行可能 ◦ 全てWeb(ブラウザ)上で ◦ github 等を用いて notebook を共有 データサイエンス界隈で利用者多数 ◦ python + pandas + scipy + matplotlob ◦ 語の分散表現(word2vec)関連では + gensim 2018/04/11 第20回 K-Ruby 3
Jupyter Notebook概説(3)デモ 非公開 ◦ github(gist)に notebookの本体( .ipynb)を push すると、きれいに表示してくれる
◦ GitLab(CE)でも、それなりに表示してくれる 私が構築した GitLab(CE)では、グラフが表示されない ◦ nbviewer というのを利用すると github 等を利 用しなくてもきれいに表示してくれるらしいが 使ったことない 2018/04/11 第20回 K-Ruby 4
Jupyter Notebook Architecture http://jupyter.readthedocs.io/en/latest/architecture/how_jupyter_ipyth on_work.html より 2018/04/11 第20回 K-Ruby
5
Jupyter Notebook概説(5) 導入 Anaconda で、python を含め全て入る ◦ Windows/Mac/Linux ◦
データ分析に必要な python パッケージも入る ◦ パッケージ管理もできる ◦ https://www.anaconda.com/download/ Anaconda を利用しなくても導入はできる が For new users, we highly recommend installing Anaconda. (Jupyter Documentation より) 2018/04/11 第20回 K-Ruby 6
Jupyter Notebook概説(6) 今後 Jupyter Notebook から JupyterLab に進化 ◦
2014年に Jupyter Notebook になる ◦ 2016年から次世代版 Jupyter Notebook として JupyterLab プレ ビュー公開 ◦ 2018/02 ベータ版公開 ◦ 正式版は2018年内か? 操作性向上 csv, json がきれいに表示されるらしい https://news.mynavi.jp/article/20180221-587178/ 2018/04/11 第20回 K-Ruby 7
Jupyterhub Jupyterlab-hub について Jupyter Notebook や JupyterLab は、一人で使用することを想定 ◦
サーバに導入して、複数で利用したい(教育環境等) Jupyterhub Jupyterlab-hub はユーザ認証機能を付けたもの ◦ サーバのローカルユーザ作成されていれば導入はそこそこ難しくない ◦ LDAP等の場合は… 試していないのでわからない 2018/04/11 第20回 K-Ruby 8
Jupyter Notebook で ruby 基本的には iruby という Jupyter Notebook
用 ruby kernel を導入すればよい ◦ http://devopspy.com/linux/ruby-kernel-jupyter- notebook/ ◦ https://qiita.com/kozo2/items/8e0cf0d1f5672ac 2f745 「The Ruby kernel requires ZeroMQ, hence it’s C and Ruby bindings」で、OS標準のパッ ケージとバージョンがあわないとかでさんざん 苦労したような気がするが…忘れた デモ 2018/04/11 第20回 K-Ruby 9
jupyter notebook の ruby でグラフ(1) 数種類の方法がある ◦ nyaplot
動かなかった。ここ数年メンテナンスされていない ◦ rbplotly 動く ◦ gnuplot 動く ◦ daru + numo-gnuplot 動く ◦ daru + daru-plotly 動く daru とは ◦ ruby で DataFrame を扱うもの Python の pandas みたいなもの 2018/04/11 第20回 K-Ruby 10
jupyter notebook の ruby でグラフ(2) rbploty ◦ plotly を
ruby で使うために必要 ◦ plotly データ可視化プラットフォーム (https://plot.ly/) ◦ plotly の作図方法 APIを叩くもの (plotlyのサーバと通信) 頻繁な場合は有料 plotly.js を利用する plotly.js はオープンソース化されていて無料 ◦ rbploty がどちらを使っているかは知らない どちらにも対応しているみたいだが。 2018/04/11 第20回 K-Ruby 11
jupyter notebook の ruby でグラフ(3) 2018/04/11 第20回 K-Ruby 12 require
'rbplotly' trace1 = { x: ['a',2,3,4,5,6], y: [100,200,300,400,500,600] } trace2 = { x: ['a',2,3,4,5,6], y: [600,500,400,300,200,100] } traces = [trace1, trace2] pl = Plotly::Plot.new(data: traces) pl.show これくらいのコードで、以下のグラフが描ける
jupyter notebook の ruby でグラフ(2) daru + daru-plotly を業務で使用
◦ 「eduroam利用回数」 ログから eduroam(無線LAN)のアクセス解析 面倒だった点 ◦ 2つの値と1つの値で値域が大きく異なる 2軸のグラフにしたい ◦ これを実装したいためplotly のドキュメントをよ みまくる https://plot.ly/python/ あたりの Python 用APIドキュ メントを見ながら Python での dict を ruby の Hash だと考えていろいろやった。 2018/04/11 第20回 K-Ruby 13