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
Oxlint JS plugins
kazupon
1
810
AtCoder Conference 2025
shindannin
0
1k
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
250
MUSUBIXとは
nahisaho
0
130
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
Implementation Patterns
denyspoltorak
0
280
Architectural Extensions
denyspoltorak
0
280
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
CSC307 Lecture 09
javiergs
PRO
1
830
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
970
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
260
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
180
Music & Morning Musume
bryan
47
7.1k
How to train your dragon (web standard)
notwaldorf
97
6.5k
Side Projects
sachag
455
43k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
140
ラッコキーワード サービス紹介資料
rakko
1
2.2M
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
54
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
300
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Designing Powerful Visuals for Engaging Learning
tmiket
0
220
A Tale of Four Properties
chriscoyier
162
24k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
770
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