# One trick that can give you a bronze medal or above 

First of all, thank you Kaggle and the hosts for this interesting competition! Congrats to all the winners and people who have participated! While my team is working on the writeup, I'd like to share the post processing we used in this competition.
Just by adding the post processing alone, the kkiller's public inference notebook can achieve 0.62(in bronze medal range) on private leaderboard. Just for reference, the original inference notebook is 0.55. So that's a +0.07!
Back to the main topic, our post processing idea is from
[@triplex](https://www.kaggle.com/triplex)
's Cornell writeup(
[https://www.kaggle.com/c/birdsong-recognition/discussion/183255)](https://www.kaggle.com/c/birdsong-recognition/discussion/183255))
.
To quote his words:
"""
if model gets a confident prediction of any bird, then lower threshold for this bird in the same audio file
use thr_median as initial threshold
use thr_high for confident prediction
if any bird with probability higher than thr_high in any clip, lower threshold to thr_low for this specific bird in the same audio file
"""
His post processing code can be found here:
[https://github.com/xins-yao/Kaggle_Birdcall_17th_solution/blob/master/inference.py](https://github.com/xins-yao/Kaggle_Birdcall_17th_solution/blob/master/inference.py)
I adopted his idea and used optuna to tune the thr_dict to get the optimal threshold according to cv.
Besides this, I've also tried using location information to adjust threshold. We did not end up using location information in our submission because it consistently gives us -0.01 on public leaderboard but in fact gives us a big boost on the private leaderboard(our best submission is 0.68 with location processing).
Here's the general idea for adding location:
In the train audios, I computed the distance between the location of the recording and the 4 sites(COL,COR,SNE,SSW) based on their coordinates. I also extracted the month information from the metadata. During test time, I use the location and month data of each test audio and get a list of birds that are not present near that location(I set the radius to 360km but with bird domain knowledge you can definitely change this number) during that month based on the location and month. information I extracted from the train audio data. I then increase the threshold for non-present birds. This threshold is also tunable!
I will do more experiment on location once I get more gpu time.
Thank you for reading!