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
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
900
QA4AIに則ったMLOpsツールの活用
hacarus
0
610
0から協働ロボット外観検査システムを3ヵ月で具現化した軌跡
hacarus
0
170
ワンちゃんの健康を願う皆様に送る 犬心電図AI解析プロダクト紹介_AWS DevDay2022
hacarus
0
140
犬の心電AI解析プロダクト開発奮闘記 _クラウドからハード開発までてんこ盛り
hacarus
0
1.5k
ExplainableAIの概要とAmazon SageMaker Clarifyでの実装例
hacarus
0
770
AWS Step Functions を用いた非同期学習処理の例
hacarus
0
840
Dashでmyダッシュボードを作ろう ーpytrendsで見るコロナの感染拡大時期ー
hacarus
0
1.1k
Interpretable Machine Learning: モデル非依存な解釈手法の紹介
hacarus
0
880
Other Decks in Technology
See All in Technology
いまならこう作りたい AWSコンテナ[本格]入門ハンズオン 〜2024年版 ハンズオンの構想〜
horsewin
9
2k
アジャイルと契約 エッセンシャル版 / Agile Contracts Essential Edition
fkino
0
110
とあるユーザー企業におけるリスクベースで考えるセキュリティ業務のお話し
4su_para
3
320
プロダクトチームへのSystem Risk Records導入・運用事例の紹介/Introduction and Case Studies on Implementing and Operating System Risk Records for Product Teams
taddy_919
1
160
Fargateを使った研修の話
takesection
0
110
CI/CDやテスト自動化の開発プロジェクトへの適用
megascus
3
740
急成長中のWINTICKETにおける品質と開発スピードと向き合ったQA戦略と今後の展望 / winticket-autify
cyberagentdevelopers
PRO
1
160
AWSコンテナ本出版から3年経った今、もし改めて執筆し直すなら / If I revise our container book
iselegant
15
3.9k
使えそうで使われないCloudHSM
maikamibayashi
0
170
「 SharePoint 難しい」ってよく聞くけど、そんなに言うなら8歳の息子に試してもらった
taichinakamura
1
580
AIを駆使したゲーム開発戦略: 新設AI組織の取り組み / sge-ai-strategy
cyberagentdevelopers
PRO
1
130
LeSSに潜む「隠れWF病」とその処方箋
lycorptech_jp
PRO
2
120
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Building Applications with DynamoDB
mza
90
6.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
92
16k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
The Cult of Friendly URLs
andyhume
78
6k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Practical Orchestrator
shlominoach
186
10k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Side Projects
sachag
452
42k
The Invisible Side of Design
smashingmag
297
50k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.8k
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 • )PQFZPVHFUJOUFSF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UCFTPMWFE "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