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
HMSコンペ 11th Solution (team : kansai-kaggler)
Search
T88
July 04, 2024
Programming
1.5k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
HMSコンペ 11th Solution (team : kansai-kaggler)
T88
July 04, 2024
More Decks by T88
See All by T88
polarsのudfとかpluginとか触ってみた
t88
0
3.4k
忙しくて手を動かせない時もいい感じに進捗出してくれるAgent作りたい
t88
10
6k
レコメンドコンペ入門
t88
1
1.5k
Other Decks in Programming
See All in Programming
Oxcを導入して開発体験が向上した話
yug1224
4
350
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
act1-costs.pdf
sumedhbala
0
140
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
430
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
570
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
230
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
210
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.4k
Agentic UI
manfredsteyer
PRO
0
210
Lessons from Spec-Driven Development
simas
PRO
0
230
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
7.1k
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
160
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
240
It's Worth the Effort
3n
188
29k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
250
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Paper Plane
katiecoart
PRO
1
52k
Balancing Empowerment & Direction
lara
6
1.2k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Git: the NoSQL Database
bkeepers
PRO
432
67k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Transcript
HMSコンペ 11th Solution Team: kansai-kaggler
チームメンバー P-SHA TR
コ ン ペ 概 要 コ ン ペ 概 要
概要とポイント Team merge するまで 01 01
チームマージの経緯 かなり前から意識 そこから TRを抜き浮上
LB追いついたら チームマージしてあげる チームマージの経緯 P-SHA(T88) TR(Ryushi)
チームマージの経緯 1週間後
チームマージの経緯 Kansai-Kagglerチーム結成
HMSコンペ概要 脳波から専門家の6種類の診断確率を予測するコンペ データとしては以下が与えられた EEG スペクトログラム メタ/ラベルデータ 目的変数は専門家のvote率 https://www.kaggle.com/competitions/hms-harmful-brain-activity-classification/discussion/468010
S o l u t i o n S o
l u t i o n 11th pl ace sol uti on 02 02
TRチーム 【波形⇒画像変換】 LL,LP,RP,RLそれぞれの隣り合う波形の差分をとる⇒CWT変換 通常のスペクトログラム変換より低い周波数をきれいにとってくれるはず。。。 eegs["Fp1"] - eegs["F7"] mean([ spec(fp1-f7), spec(f7-t3),
spec(t3-t5), spec(t5-o1) ])
LL LP RP RL TRチーム 【基本モデル】 波形から変換した画像をtimmモデルに通す timm backbone ⇒
各ラベルの確立(sigmoid)
TRチーム 【序盤】 データによってアノテーター(vote)の数が違う。明らかに2つの山がある。 ⇒votesが少ないデータはラベル付けが荒い? 例えばvotes=3なら、各ラベル0.33333の表現になる(学習が偏りそう) こっちいらんやろ。。。
TRチーム 【序盤】 votes>= 8だけで学習させてみるか。。。 これだけで当時の4位(0.32)
全データで学習(10epochs) 引き続き、votes>=8のみで学習(10epochs) ⇒LB0.26くらい(金圏復帰) 単純なpretraining⇒finetuningではなく、 途中でデータセットを切り替える方法の方が 精度がよかった なんで?⇒LRのチューニングが難しかったぽい TRチーム 【中盤】 とは言え、各チームラベルの偏りに気づき、それぞれLBを上げていく。
⇒モデルの変更、votesが少ないラベルでのpretrainingを実装。 https://www.kaggle.com/competitions/ hms-harmful-brain-activity- classification/discussion/488083
TRチーム 【終盤】 チームマージを経てアンサンブル用モデル作成と同時にシングルモデルを改善 結果として微妙な改善。。。終盤はT88さんのスタッキングの恩恵が大きかった。 _x = x.clone() # LL <=>
RL x[:, 0:4, :, :] = _x[:, 4:8, :, :] x[:, 4:8, :, :] = _x[:, 0:4, :, :] # LP <=> RP x[:, 8:12, :, :] = _x[:, 12:16, :, :] x[:, 12:16, :, :] = _x[:, 8:12, :, :] FLIP 50sec ラベル:10sec ⇒01のattention_channel追加 【他】 specの平均を横にとる 平均ではなくmax-minをとる GeM, multisample-dropout, etc...
P-SHAチーム ・生波形の特性を生かす試み(①、⑤)と、スペクトル変換したもの(②、③、④、⑥)を連結して学習。 ・バックボーンはCNN系を活用。(tf_efficientnetv2_s.in21kとtf_efficientnet_b3.in1k) ・多様な変換方法により、EEGの細かな特性を捉えることができ、精度向上に繋がった。
P-SHAチーム ・様々な変換方法による個別の損失結果を、train lossの計算時に考慮させると、精度向上に寄与。
Stacking シングルモデルを伸ばす方向がネタ切れだったので 単純平均のblendingでスコアの向上が見られたので、アンサンブルを深堀 参考 conv2d stacking model class seizure lpd
gpd lrda grda other 1✕3 kernel class HMSStacking2DCNN(nn.Module): def __init__(self, 6): super().__init__() self.conv2d1 = nn.Conv2d(1, 8, kernel_size=(1,3), padding=0, stride=1) self.conv2d2 = nn.Conv2d(8, 16, kernel_size=(1,3), padding=0, stride=1) self.fc1 = nn.Linear(480, 480) self.dropout1 = nn.Dropout(p=cfg.dropout) self.fc2 = nn.Linear(480, 6) def forward(self, x): x = F.relu(self.conv2d1(x)) x = F.relu(self.conv2d2(x)) x = torch.flatten(x, start_dim=1) x = F.relu(self.fc1(x)) x = self.dropout1(x) x = self.fc2(x) return x ・各モデル✕各クラスの予測値を1channelの画像として入力 ・1✕3 kernelでモデル方向に畳み込み ・単純平均(public:0.24 / private:0.29)に対して stacking(public:0.23 / private:0.28)とスコア向上に寄与
exp LB cv (10seed mean) T88 129 T88 130 T88
131 T88 132 iida 62 iida 78 iida 139 iida 157 iida 160 iida 164 iida 169 eikichi 038 tomo 053 tomo 086 tomo 089 tomo 092 tomo 093 tomo 094 tomo 095 ryushi 002 013 0.23 0.22486 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 012 0.23 0.22498 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 010 0.24 0.22613 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 009 0.23 0.22710 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 007 0.24 0.22828 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 008 0.23 0.22879 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 006 0.23 0.22923 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ Stacking スタッキングに組み込むモデルとハイパラをoptunaでチューニング
exp LB cv (10seed mean) T88 129 T88 130 T88
131 T88 132 iida 62 iida 78 iida 139 iida 157 iida 160 iida 164 iida 169 eikichi 038 tomo 053 tomo 086 tomo 089 tomo 092 tomo 093 tomo 094 tomo 095 ryushi 002 013 0.23 0.22486 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 012 0.23 0.22498 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 010 0.24 0.22613 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 009 0.23 0.22710 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 007 0.24 0.22828 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 008 0.23 0.22879 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ 006 0.23 0.22923 ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ Stacking スタッキングに組み込むモデルとハイパラをoptunaでチューニング 山田鐘人・アベツカサ/小学館 「葬送のフリーレン」より