# 159th solution 🥉

I started to working on this competition just after
[@tubotubo](https://www.kaggle.com/tubotubo)
published his solution to learn how to solve this kind of time series problem.
I learned a lot from his approach and appreciate sharing great ideas!
[https://www.kaggle.com/competitions/child-mind-institute-detect-sleep-states/discussion/452940](https://www.kaggle.com/competitions/child-mind-institute-detect-sleep-states/discussion/452940)
My solution is basically same as the referenced one.
Here are my ideas to improve the score.
Continuous time features
The original code uses hour_sin/hour_cos features to teach the model when of the day it is looking at.
I changed this feature to seconds in a day so the feature has continuous value rather than digital rapidly change on the border of hours. This boosted my cv score about ~ 0.01
Smaller threshold and larger distance of the peaks
Considering the competition metric, I changed post processing parameters.
peak distance: 100steps
peak threshold: 0.005
The Larger peak distance decreases false positives that is too close to each other.
The smaller peak threshold increases true positives without increasing false positives that have effects on the MAP metric (additional peaks that have relatively small scores are never referenced before the higher peaks are counted as TP/FP when calculating MAP score so the setting smaller threshold is a reasonable strategy.)
Excluding predictions in periodic times
There are periodic times without any label events in training data.
Predictions in these period should be removed so that the number of FP decreases.
I compared the series features around each predicted events with that of preceding and following day, and excluded the event if it is identical to at least one of them.
This had little effect on my cv score but boosted the public score about +0.007 (private: +0.016)!
etc.
Actually I have no Idea about how to improve the model architectures that is already sophisticated and worked on minor changes like post processing. I will catch up the high ranker solutions and learn how to construct models!