Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
疎行列と Jaccard 類似度の高速計算
Search
na-o-ys
March 29, 2017
Programming
1
640
疎行列と Jaccard 類似度の高速計算
na-o-ys
March 29, 2017
Tweet
Share
More Decks by na-o-ys
See All by na-o-ys
IoTと監視
naoys
1
800
RubyとJIT
naoys
0
170
将棋盤を画像認識したかった
naoys
0
1.6k
Rust で乗り換え案内
naoys
0
630
有理数集合の濃度
naoys
2
140
YARVの最適化について調べた
naoys
0
140
転職会議サービスのAWS移行記録
naoys
0
74
Anonymous Recursion in C++
naoys
0
430
入門AlphaGo
naoys
5
3.8k
Other Decks in Programming
See All in Programming
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
320
React Native New Architecture 移行実践報告
taminif
1
130
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
420
目的で駆動する、AI時代のアーキテクチャ設計 / purpose-driven-architecture
minodriven
11
4k
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
140
認証・認可の基本を学ぼう前編
kouyuume
0
170
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
180
Microservices rules: What good looks like
cer
PRO
0
660
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
5
1.6k
connect-python: convenient protobuf RPC for Python
anuraaga
0
360
【CA.ai #3】ワークフローから見直すAIエージェント — 必要な場面と“選ばない”判断
satoaoaka
0
220
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
6
2k
Featured
See All Featured
It's Worth the Effort
3n
187
29k
Rails Girls Zürich Keynote
gr2m
95
14k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
How to Ace a Technical Interview
jacobian
280
24k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Making Projects Easy
brettharned
120
6.5k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
970
The Language of Interfaces
destraynor
162
25k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Transcript
ૄߦྻ ͋Δ͍ Jaccard ྨࣅΛߴͰܭࢉ͢Δํ๏ @na_o_ys
Agenda 1. ૄߦྻͷσʔλߏ 2. Python ͱܭࢉ 3. Python ͱૄߦྻ 4.
Jaccard ྨࣅ
1. ૄߦྻͷσʔλߏ
ૄߦྻͱ ΄ͱΜͲͷཁૉ͕ 0 Ͱ͋Δߦྻ
1. ૄߦྻͷσʔλߏ (1) • ௨ৗͷߦྻ Array • ૄߦྻΛ Array Ͱѻ͏ͱϝϞϦԋࢉແବ
• 0 ϕΫτϧಉ࢜ͷࢉͱ͔໌Β͔ʹແବ
1. ૄߦྻͷσʔλߏ (2) • Compressed Sparse Row (CSR) • CSR
ಉ࢜ͷՃࢉ, ߦྻੵ͕ߴ • ߦϕΫτϧͷऔΓग़͕͠ߴ • ྻϕΫτϧͷऔΓग़͕͠ • (wikipedia)
2. Python ͱܭࢉ
2. Python ͱܭࢉ • ख़ͨ͠ܭࢉϥΠϒϥϦ • NumPy, SciPy • Scikit-learn
ͱ͜ΖͰɺPython ͍ (DEMO)
Python ͍ • 5000 ഒ ࣮ߦ࣌ؒ 1ZUIPO NT Ұ෦/VN1Z NT
શ෦/VN1Z NT
Python-loop is Evil • ߦྻϧʔϓઈରʹॻ͍͍͚ͯͳ͍ • 1 ඵͰऴΘΔͣͷॲཧʹ 2 ͔͔࣌ؒΔ
• ߦϧʔϓ/ྻϧʔϓॻ͔ͳ͍ํ͕ྑ͍ • 1 ඵͰऴΘΔͣͷॲཧʹ 1 ͔͔Δ
3. Python ͱૄߦྻ
3. Python ͱૄߦྻ • scipy.sparse.csr_matrix
ޮతͳߦྻॲཧ • ߦϕΫτϧͷऔΓग़͠ • Ճࢉࢉ, ߦྻੵ • ෦දݱΛ numpy.ndarray ͱͯ͠อ࣋
• औΓग़ͯ͠ૢ࡞Ͱ͖Δ (NumPy ͷੈք Ͱ)
4. Jaccard ྨࣅ
4. Jaccard ྨࣅ • ϕΫτϧಉ࢜ͷྨࣅ • ڠௐϑΟϧλϦϯάͱ͔Ͱ͏ • ϢʔβAͱϢʔβBͲΕ͘Β͍ࣅ͍ͯΔ͔ Jaccard(a,
b) = a・b / (a・a + b・b - a・b)
ࣄͰඞཁʹͳͬͨ͜ͱ • ૄߦྻͷߦϕΫτϧಉ࢜ͷ Jaccard ྨࣅΛ ܭࢉ͍ͨ͠
DEMO
·ͱΊ
·ͱΊ • Python ͍ • ϥΠϒϥϦΛ͏·͘͏ඞཁ͕͋Δ • ϒϩάΛॻ͍ͨ • http://na-o-ys.github.io/others/
2015-11-07-sparse-vector- similarities.html