# Solution Sharing

Congrats to everyone for a great competition, in particular to the guys at the top. Congrats especially to tvdwiele and Markus who were significantly ahead of the field yet neck-and-neck for a long time. @tvdwiele also thanks for the shiny app, that was probably the most useful data visualizations I've seen on Kaggle (
[https://www.kaggle.com/c/facebook-v-predicting-check-ins/forums/t/21365/interactive-exploratory-analysis-using-a-shiny-app](https://www.kaggle.com/c/facebook-v-predicting-check-ins/forums/t/21365/interactive-exploratory-analysis-using-a-shiny-app)
).
My solution (place 20) was the combination of an xgb (0.592 on public lb) and knn (0.585), which somehow combined to get 0.603. I combined them by averaging the top 6 probabilities predicted by each model. Ensembling is surprisingly powerful. I used a 40 x 50 grid for xgb and a 20 x 25 grid for knn, with the extension technique from the scripts.
My xgb model took 4 days to run on my dual-core macbook pro. I used the basic time features (hour, weekday, year etc), did not have any real success with advanced feature engineering this competition. I also used the xgb weight option, so more recent times were weighted more heavily while training.
My knn model I tried to get around the hour cyclic problem by shifting the hour feature and averaging the predictions from different models. Otherwise it was pretty similar to the early knn scripts.
One interesting thing I did was to use the knn model to predict how common a place id was in the test set. This is peaking into the future, so it isn't all that useful in the real world but it provided a boost of about 0.004 on the public lb. I basically used knn to get the average predicted probability, then applied the ratio of the predicted probability in test over the probability in train to weight the probabilities of the next level models.
My code needs to be cleaned up, but if you don't mind looking at messy code it is here:
[https://github.com/jturkewitz/SideProjects/tree/master/Kaggle/Facebook_Checkin](https://github.com/jturkewitz/SideProjects/tree/master/Kaggle/Facebook_Checkin)