586. Child Mind Institute - Detect Sleep States | child-mind-institute-detect-sleep-states
我基于@tubotubo的源代码实现了这个解决方案。感谢分享!
总损失 = (清醒损失) × 0.12 + (入睡/醒来损失) × 0.88
| 特征提取器 | 解码器 | 下采样率 | CV分数 |
|---|---|---|---|
| LSTM | UNet1D | 2 | 0.7611 |
| CNN | UNet1D | 2 | 0.7628 |
| 频谱图 | UNet1D | 2 | 0.7463 |
| CNN | Transformer | 6 | 0.7480 |
| 频谱图 | Transformer | 6 | 0.7725 |
| 2CNN+时间特征嵌入 | UNet1D | 2 | 0.7705 |
month = self.month_embedding(month) # (batch_size, 4, n_timesteps)
hour = self.hour_embedding(hour) # (batch_size, 8, n_timesteps)
minute = self.minute_embedding(minute) # (batch_size, 16, n_timesteps)
x = x[:, 3:, :] # (batch_size, n_channels, n_timesteps)
x1 = self.feature_extractor1(x[:, :x.shape[1]//2, :]) # (batch_size, n_kernel, height, n_timesteps)
x2 = self.feature_extractor2(x[:, x.shape[1]//2:, :]) # (batch_size, n_kernel, height, n_timesteps)
x = torch.cat([x1, x2], dim=2) # (batch_size, n_kernel, height*2, n_timesteps)
x = self.encoder(x).squeeze(1) # (batch_size, height, n_timesteps)
x = torch.cat([x, month, hour, minute], dim=1) # (batch_size, height+28, n_timesteps)
logits = self.decoder(x) # (batch_size, n_timesteps, n_classes)