# 1st Place Solution: Take care of the data!

Intro
Thank you again to the host for an amazing competition. The full solution code can be found here
[https://www.kaggle.com/wrrosa/dtabp-1st-place-solution](https://www.kaggle.com/wrrosa/dtabp-1st-place-solution)
. I apologize for the delay in making the solution available.
EDA
I observed that we are dealing with time series at the deviceId level. This critically affected the data transformation. This is the direct reason for the construction of the test set and the differences between the test and training sets.
I didn't have much time to explore the numerical features, but I noted the ultra-extreme winBid values and the suspicious c2 and c4 histograms. The floorPrice for most auctions was a symbolic 0.01.
Data transformation
Splitting data into 'last measurement' - at first I combine data train + test, then I create features (last) + split data into train and test, then I split data into ttrain, oof and test. Divide ttrain into 5 folds by deviceId and save to numpy.
Features that were created are (besides one hot encoding): time (month + day + hour) and grouped shift/last(n) winBid.
Model
LGBM with manually tuned parameters. In the initial phase, AutoML from H20 was also working fine. Grouping models by slightly modified size feature.
What worked
last winBid by deviceId
last winBid by deviceId x unitDisplayType
last winBid by deviceId x c1
grouping models by size
apache superset with postgres as open source BI for device and error data mining
error analysis on dataset oof
What didn't work
models grouped by countryCode and other features
number of folds other than 5
rejection from the set of cases with has_won = 1. These cases in a way curve our dataset, but in the end remained
separate models for new devices
models: knn, enet, xgboost
other methods of winBid postprocessing than described below.
What worked, but I'm not sure (overfitting alert).
linear blend folds, even though the coefficients were adjusted on oof (risky idea).
winBid target pre/postprocessing with parameter p = 0.7 (winBid**p).
in general, it was difficult to improve the model below public score 15, due to the sensitivity of the metric.
Insights
some of the devices changed their features, an example (after a few days we get a different brandName and correctModelName)
![p2.png](assets/f9ed3231a1382be51d2f1ac1.png)
even if the features clearly did not change, after few days previous winBids were irrelevant (deviceId 80f3f2bcb94):
![p3.png](assets/28d472bdd8ff35947fb82ab6.png)
different c1 but same bid (deviceId 80f3f2bcb94):
![](assets/ca0bc634eb6e3dcdd7248a3b.png)
jumpy process (deviceId 6ab74700e47):
![p5.png](assets/1aeb2dec8d436999c9329242.png)
c1 co-occurrence: there is a correlation of c1 occurrence. The graph shows the number of devices in which the selected c1 occurred simultaneously. I tried to group the c1s and create models, but this did not help:
![p1.png](assets/2f9c868767ff123d4d716ed8.png)
competition metric is so sensitive. oof 18.5 divided into 2 different datasets (randomly) could give 16.5 - 20.5
noticed bug in pandas at nested shift winBid groupby
the number of rows used in training was less than 10% of the total set
Fun fact
there is a deviceId value composed only of digits: 80901872283
Feel free to comment and ask questions