Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Sparse Modeling for Software En...
Search
Hacarus Inc.
October 13, 2018
Technology
1
120
Introduction to Sparse Modeling for Software Engineers
Presentation slides at GDG DevFest Philippines 2018
*
https://devfest.gdgph.org/
Hacarus Inc.
October 13, 2018
Tweet
Share
More Decks by Hacarus Inc.
See All by Hacarus Inc.
GitLab CI/CD で C#/WPFアプリケーションのテストとインストーラーのビルド・デプロイを自動化する
hacarus
0
940
QA4AIに則ったMLOpsツールの活用
hacarus
0
620
0から協働ロボット外観検査システムを3ヵ月で具現化した軌跡
hacarus
0
180
ワンちゃんの健康を願う皆様に送る 犬心電図AI解析プロダクト紹介_AWS DevDay2022
hacarus
0
140
犬の心電AI解析プロダクト開発奮闘記 _クラウドからハード開発までてんこ盛り
hacarus
0
1.5k
ExplainableAIの概要とAmazon SageMaker Clarifyでの実装例
hacarus
0
790
AWS Step Functions を用いた非同期学習処理の例
hacarus
0
880
Dashでmyダッシュボードを作ろう ーpytrendsで見るコロナの感染拡大時期ー
hacarus
0
1.2k
Interpretable Machine Learning: モデル非依存な解釈手法の紹介
hacarus
0
900
Other Decks in Technology
See All in Technology
Kubernetes だけじゃない!Amazon ECS で実現するクラウドネイティブな GitHub Actions セルフホストランナー / CNDW2024
ponkio_o
PRO
6
410
4年で17倍に成長したエンジニア組織を支えるアーキテクチャの過去と未来
sansantech
PRO
1
4.7k
徹底解説!Microsoft 365 Copilot の拡張機能 / Complete guide to Microsoft 365 Copilot extensions
karamem0
1
1.5k
PFN Company Deck
pfn
PRO
2
140
iOS 18 から追加された SwiftUI の傾向について調べてみる
swiftty
2
110
データカタログを自作したけど 運用しなかった話@Findy Lunch LT「データカタログ 事例から学ぶメタデータ管理の実態」
ryo_suzuki
2
410
プルリクが全てじゃない!実は喜ばれるOSS貢献の方法8選
tkikuc
16
2.1k
共創するアーキテクチャ ~チーム全体で築く持続可能な開発エコシステム~ / Co-Creating Architecture - A Sustainable Development Ecosystem Built by the Entire Team
bitkey
PRO
1
3.9k
.NET のUnified AI Building Blocks 入門...!
okazuki
0
140
2024/11/29_失敗談から学ぶ! エンジニア向けre:Invent攻略アンチパターン集
hiashisan
0
230
Nutanixにいらっしゃいませ。Moveと仮想マシン移行のポイント紹介
shadowhat
0
240
Bytebaseで実現する データベース管理の効率化
shogo452
1
280
Featured
See All Featured
Happy Clients
brianwarren
98
6.7k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
24k
Adopting Sorbet at Scale
ufuk
73
9.1k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Code Reviewing Like a Champion
maltzj
520
39k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
What's in a price? How to price your products and services
michaelherold
243
12k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Transcript
,8 0 0 2 1 , 1 0 2 00
3 0 0 3 88 0
5BLBTIJ4PNFEB !ULTNE • $50BU)BDBSVT *OD • .BTUFS`TEFHSFFPG*OGPSNBUJPO4DJFODFBU ,ZPUP6OJWFSTJUZ • )PTUTEBUBTDJFOUJTUDPNNVOJUZJO,"/4"*
• IUUQTNMNLBOTBJDPOOQBTTDPN
"CPVU)BDBSVT • 5BDLMFNFEJDBM JOEVTUSJBMJTTVFTCZ"* • 'PDVTPO4QBSTF.PEFMJOH • 4VQQPSUFECZQSPGFTTPST • .S.BTBZVLJ0I[FLJ
GSPN5PIPLV6OJWFSTJUZ • .S,BPSV,BXBNPUPGSPN4IJHB6OJWFSTJUZ
"MJUUMFNPSFBCPVUVT
5BLFBXBZT • (FUCBTJDDPODFQUPG4QBSTF.PEFMJOH • ,OPXBDUVBMJNQMFNFOUBUJPOJO1ZUIPO • )PQFZPV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z8Y DBOOPUCFTPMWFE "EEJOHTQBSTJUZDPOTUSBJOU
*GOVNCFSPGOPO[FSPWBMVFPGY , JTMFTTUIBO. 8FDBOTPMWF UIJTQSPCMFN W W
-OPSNPQUJNJ[BUJPO • 6TFNJOJNVNOVNCFSPGY UPTBUJTGZ FRVBUJPO • 'JOEX UPNJOJNJ[FOVNCFSPGOPO[FSP FMFNFOUT •
$PNCJOBUJPOBMPQUJNJ[BUJPO • /1IBSEBOEOPUGFBTJCMFL
-OPSNPQUJNJ[BUJPO • 3FMBY-DPOTUSBJOUUP • 'JOEX UPNJOJNJ[FTVNPGJUTBCTPMVUFWBMVFT • (MPCBMTPMVUJPODBO TUJMM CFSFBDIFE
• 4PMWFEXJUIJOQSBDUJDBMUJNF
&Y7JTVBMFYQSFTTJPO -OPSN !" + !$ = &
• -FBTU"CTPMVUF4ISJOLBHFBOE4FMFDUJPO0QFSBUPS • 0CKFDUJWFGVODUJPOXJUI-OPSNBTSFHVMBSJ[BUJPO UFSN -BTTP min 1 2 &
− () * + , ( - 㱺 3FHVMBSJ[BUJPOQBSBNFUFS Е DPOUSPMT TQBSTJUZ
7BSJPVT"MHPSJUINTGPS-BTTP • $PPSEJOBUF%FTDFOU • -FBTU"OHMF3FHSFTTJPO • *45" • "%..
&Yɿ$PPSEJOBUF%FTDFOU *OJUJBMJ[F !" # = 1, … , (
XJUISBOEPNWBMVF 6QEBUF ) !" = * + , -. , / , 0 8IFSF 1(") = 4 − ∑ 78" 9 7 !7 BOES JTTPGUUISFTIPMEJOH GVODUJPO 3FQFBUVOUJMDPOWFSHJOHDPOEJUJPOTBUJTGJFE
4PGU5ISFTIPMEJOH0QFSBUPS • 4ISJOLHJWFOWBMVFYCBTFEPO! S #, ! = & # −
!, (# ≥ !) 0, (−! < # < !) # + !, (# ≤ −!)
1ZUIPODPEFFYBNQMF # Soft thresholding operator def soft_threshold(X, thresh): return np.where(np.abs(X)
<= thresh, 0, X - thresh * np.sign(X)) # Coordinate descent w_cd = np.zeros(n_features) for _ in range(n_iter): for j in range(n_features): w_cd[j] = 0.0 r_j = y - np.dot(X, w_cd) w_cd[j] = soft_threshold(np.dot(X[:, j], r_j) / n_samples, alpha)
3FTVMU EJNFOTJPOBMJOQVUXJUI OPO[FSPDPFGGJDJFOUTBOETBNQMFT
1BUIEJBHSBN • 7JTVBMFYQSFTTJPOPGIPX! BGGFDUTUIF OVNCFSPGOPO[FSPDPFGGJDJFOUT
0UIFSJNQMFNFOUBUJPOT • TDJLJUMFBSO • $PPEJOBUF %FTDFOUJTEFGBVMU -BTTP • -"34JTBMTPBWBJMBCMF -BTTP-BST
• TQNJNBHF • "%..JTBWBJMBCMF -BTTP"%..
TQNJNBHF • 1ZUIPOMJCSBSZGPSTQBSTFNPEFMJOH • "MHPSJUINTGPS*NBHFBOBMZTJT • $PNQMJBOUUPTDJLJUMFBSOJOUFSGBDF • IUUQTHJUIVCDPNIBDBSVTTQNJNBHF
&Y-BTTPBOE-BTTP"%.. # Lasso from scikit-learn from sklearn.linear_model import Lasso model
= Lasso(alpha=0.1) model.fit(X_train, Y_train) model.score(X_test, y_test) # Lasso from spm-image from spmimage.linear_model import LassoADMM model = LassoADMM(alpha=0.1) model.fit(X_train, Y_train) model.score(X_test, y_test)
*NBHFBOBMZTJT
%JDUJPOBSZMFBSOJOH :*NBHF "%JDUJPOBSZ ! "# $# 9DPFGGJDJFOU • &YUSBDUQBUDIFTGSPNJNBHFT •
-FBSOEJDUJPOBSZ UPFYQSFTTFWFSZQBUDIFT • &WFSZQBUDIFTTIPVMECFTQBSTF DPNCJOBUJPOPG CBTJT 4QBSTF$PEJOH
&Y*NBHFSFDPOTUSVDUJPO 0SJHJOBMJNBHF 3FDPOTUSVDUFEJNBHF
&Y*NBHFSFDPOTUSVDUJPO -FBSOFEEJDUJPOBSZ Y CBTJT 4QBSTF$PEJOH HSFFOJT[FSP
1ZUIPODPEFFYBNQMF # extract patches patches = extract_simple_patches_2d(img, patch_size) # normalize
patches patches = patches.reshape(patches.shape[0], -1).astype(np.float64) intercept = np.mean(patches, axis=0) patches -= intercept patches /= np.std(patches, axis=0) # dictionary learning model = MiniBatchDictionaryLearning(n_components=n_basis, alpha=1, n_iter=n_iter, n_jobs=1) model.fit(patches) # reconstruction reconstructed_patches = np.dot(code, model.components_) reconstructed_patches = reconstructed_patches.reshape(len(patches), *patch_size) reconstructed = reconstruct_from_simple_patches_2d(reconstructed_patches, img.shape)
*OQBJOUJOH 'PSNJTTJOHWBMVFT XFDPOTJEFSNBTLNBUSJY.BOE VTFJUXJUIVTVBMJNBHFSFDPOTUSVDUJPOCZEJDUJPOBSZ
4VNNBSZ
4QBSTFNPEFMJOH • "EWBOUBHFT • 4FMFDUJNQPSUBOUGFBUVSFTGSPNJOQVU • 8PSLXJUI FWFO TNBMMBNPVOUPGEBUB •
3VOPOMJNJUFEIBSEXBSFSFTPVSDF • :PVDBOTUBSUJUUPEBZJ • 1ZUIPOJNQMFNFOUBUJPOJTBWBJMBCMFJOTDJLJU MFBSOBOETQNJNBHF
! 8F`SFIJSJOH ! IUUQTXXXLBMJCSSDPNDIBDBSVTJODKPCT