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
140
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
[FEConf 2025] 모노레포 절망편, 14개 레포로 부활하기까지 걸린 1년
mmmaxkim
0
1.6k
「待たせ上手」なスケルトンスクリーン、 そのUXの裏側
teamlab
PRO
0
510
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
430
print("Hello, World")
eddie
2
530
はじめてのMaterial3 Expressive
ym223
2
310
testingを眺める
matumoto
1
140
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
250830 IaCの選定~AWS SAMのLambdaをECSに乗り換えたときの備忘録~
east_takumi
0
390
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
690
MCPとデザインシステムに立脚したデザインと実装の融合
yukukotani
4
1.4k
Amazon RDS 向けに提供されている MCP Server と仕組みを調べてみた/jawsug-okayama-2025-aurora-mcp
takahashiikki
1
110
Android 16 × Jetpack Composeで縦書きテキストエディタを作ろう / Vertical Text Editor with Compose on Android 16
cc4966
1
200
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
It's Worth the Effort
3n
187
28k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.5k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Designing Experiences People Love
moore
142
24k
Visualization
eitanlees
148
16k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
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