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
Polarsを活用した機械学習ジョブの高速化
Search
Yudai Hayashi
February 22, 2024
460
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Polarsを活用した機械学習ジョブの高速化
Yudai Hayashi
February 22, 2024
More Decks by Yudai Hayashi
See All by Yudai Hayashi
技術キャッチアップ効率化を実現する記事推薦システムの構築
yudai00
4
390
Off-Policy Evaluation and Learning for Matching Markets
yudai00
0
180
ジョブマッチングプラットフォームにおける推薦アルゴリズムの活用事例
yudai00
0
210
ユーザーのプロフィールデータを活用した推薦精度向上の取り組み
yudai00
0
790
MCP Clientを活用するための設計と実装上の工夫
yudai00
1
1.4k
人とシゴトのマッチングを実現するための機械学習技術
yudai00
1
140
MCPを理解する
yudai00
18
16k
データバリデーションによるFeature Storeデータ品質の担保
yudai00
1
300
「仮説行動」で学んだ、仮説を深め ていくための方法
yudai00
8
2.1k
Featured
See All Featured
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
290
Balancing Empowerment & Direction
lara
6
1.3k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
A better future with KSS
kneath
240
18k
YesSQL, Process and Tooling at Scale
rocio
174
15k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
930
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
390
Amusing Abliteration
ianozsvald
1
320
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
540
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Skip the Path - Find Your Career Trail
mkilby
1
240
Transcript
© 2024 Wantedly, Inc. Polarsを活用した機械学習ジョブの 高速化 みんなのPython勉強会#101 Jan. 22 2024
- Yudai Hayashi
© 2024 Wantedly, Inc. INTERNAL ONLY 自己紹介 林 悠大 • 経歴:
◦ 東京大学工学系研究科でPh.D取得 ◦ 2022年にウォンテッドリーにデータサイ エンティストとして新卒入社。推薦シス テムの開発を行う • X: @python_walker • 趣味: ◦ 読書 ◦ 音楽聴くこと ◦ ウイスキー
© 2024 Wantedly, Inc. INTERNAL ONLY ジョブを高速化するモチベーション 実験 評価 改善
機械学習のPDCAサイクル • 機械学習ジョブの実行には長い時間が かかることが多い • ジョブの待ち時間を減らしてサイクルを 高速に回したい ここではpolarsを使ってテーブルデータの処理を高速化する手法を紹介 実験設計 > 1 h
© 2024 Wantedly, Inc. INTERNAL ONLY PolarsとPandas 主にPython Rust シングルコア
マルチコア 実装 処理 データの 持ち方 行指向 列指向 インメモリ インメモリ、遅延評価 polarsはpandasと同様、テーブルデータの処理をするためのライブラリ データ型 DataFrame, Series DataFrame, Series 10万 x 100 のDataFrameどうし のinner joinにかかる時間
© 2024 Wantedly, Inc. INTERNAL ONLY 実務におけるpolarsによる高速化の効果 日付をintに変換して差を計算 欠損時には欠損を残す when構文を使って条件分岐
結果を格納するカラム名を指定 Pandas Polars • 50 min → 1 min に 実行時間が短縮 • applyが不要になった ことで改善幅が大きく なった
© 2024 Wantedly, Inc. INTERNAL ONLY 遅延評価によるさらなる高速化・メモリ節約 公式ドキュメントより “...in the
lazy API the query is only evaluated once it is 'needed'.” Eager API ここで評価される Lazy API • 評価を遅らせることで処理速度を最適化 (↑の例だと6 %高速化(10万x100の大 きさのデータ)) • 必要なデータだけを読み込むので大規模データを扱う際にも有用 上から順番に処理
© 2024 Wantedly, Inc. INTERNAL ONLY まとめ • テーブルデータの処理にPolarsを使うことで高速化する手法を紹介 •
Pandasでapplyを使う必要がある処理はPolarsによる高速化の恩恵が大 きくなる可能性 • 遅延評価によって大規模データも効率的に扱える