Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Jupyter Notebook (jupyterhub)で ruby とグラフ / k-ru...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Koichi Shimozono
April 11, 2018
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Jupyter Notebook (jupyterhub)で ruby とグラフ / k-ruby 20th
2018/04/11 の第20回 k-ruby の資料です。
Koichi Shimozono
April 11, 2018
More Decks by Koichi Shimozono
See All by Koichi Shimozono
CentOS 8 での Ruby 環境
simozono
0
260
Serverspecを使用したサーバ設定テストの実例 / かごもく No8
simozono
0
300
Other Decks in Programming
See All in Programming
Next.js: The final boss of Web Performance
guaca
0
390
まずはコードより業務と向き合う:テーブル解体のためにPdMを呼んだ話
sakawe_ee
0
180
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
1
300
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2.2k
Seven New Principles of Software Engineering
yegor256
0
470
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
330
GraphQL の onError と Nullability のこれから
quramy
0
210
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
290
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
160
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
160
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
300
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
1.8k
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
We Have a Design System, Now What?
morganepeng
55
8.4k
The SEO Collaboration Effect
kristinabergwall1
1
620
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.8k
Designing for Timeless Needs
cassininazir
1
550
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
980
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
Git: the NoSQL Database
bkeepers
PRO
433
67k
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