{
  "id": 358676,
  "title": "1st Place Solution: Take care of the data!",
  "url": "/competitions/digital-turbine-auction-bid-price-prediction/writeups/wojtek-rosa-1st-place-solution-take-care-of-the-da",
  "author_name": "",
  "post_date": "2022-10-08T23:49:42.967006700Z",
  "votes": 14,
  "comment_count": 3,
  "views": 0,
  "content": "<h2>Intro</h2>\n<p>Thank you again to the host for an amazing competition. The full solution code can be found here <a href=\"https://www.kaggle.com/wrrosa/dtabp-1st-place-solution\" target=\"_blank\">https://www.kaggle.com/wrrosa/dtabp-1st-place-solution</a>. I apologize for the delay in making the solution available.</p>\n<h2>EDA</h2>\n<p>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.<br>\nI 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.</p>\n<h2>Data transformation</h2>\n<p>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.<br>\nFeatures that were created are (besides one hot encoding): time (month + day + hour) and grouped shift/last(n) winBid.</p>\n<h2>Model</h2>\n<p>LGBM with manually tuned parameters. In the initial phase, AutoML from H20 was also working fine. Grouping models by slightly modified size feature.</p>\n<h2>What worked</h2>\n<ul>\n<li>last winBid by deviceId</li>\n<li>last winBid by deviceId x unitDisplayType</li>\n<li>last winBid by deviceId x c1</li>\n<li>grouping models by size</li>\n<li>apache superset with postgres as open source BI for device and error data mining</li>\n<li>error analysis on dataset oof</li>\n</ul>\n<h2>What didn't work</h2>\n<ul>\n<li>models grouped by countryCode and other features</li>\n<li>number of folds other than 5</li>\n<li>rejection from the set of cases with has_won = 1. These cases in a way curve our dataset, but in the end remained</li>\n<li>separate models for new devices</li>\n<li>models: knn, enet, xgboost</li>\n<li>other methods of winBid postprocessing than described below.</li>\n</ul>\n<h2>What worked, but I'm not sure (overfitting alert).</h2>\n<ul>\n<li>linear blend folds, even though the coefficients were adjusted on oof (risky idea).</li>\n<li>winBid target pre/postprocessing with parameter p = 0.7 (winBid**p).</li>\n<li>in general, it was difficult to improve the model below public score 15, due to the sensitivity of the metric.</li>\n</ul>\n<h2>Insights</h2>\n<ul>\n<li>some of the devices changed their features, an example (after a few days we get a different brandName and correctModelName)<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F707526cd99927ddc83e7042c9b035492%2Fp2.png?generation=1665272029215415&amp;alt=media\" alt=\"p2.png\"></li>\n<li>even if the features clearly did not change, after few days previous winBids were irrelevant (deviceId 80f3f2bcb94):<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2Fb1e8eef43d6b8023885fecad8984d785%2Fp3.png?generation=1665272041993431&amp;alt=media\" alt=\"p3.png\"></li>\n<li>different c1 but same bid (deviceId 80f3f2bcb94):<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F65bd623857ec09ba460307161eed661b%2Fc6.png?generation=1665272563435243&amp;alt=media\" alt=\"\"></li>\n<li>jumpy process (deviceId 6ab74700e47):<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F0175543af52882923507515cbc3d650e%2Fp5.png?generation=1665272065678087&amp;alt=media\" alt=\"p5.png\"></li>\n<li>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:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2Ff14bb4404f249965aa270c4017cccacb%2Fp1.png?generation=1665272015858160&amp;alt=media\" alt=\"p1.png\"></li>\n<li>competition metric is so sensitive. oof 18.5 divided into 2 different datasets (randomly) could give 16.5 - 20.5</li>\n<li>noticed bug in pandas at nested shift winBid groupby</li>\n<li>the number of rows used in training was less than 10% of the total set </li>\n</ul>\n<h2>Fun fact</h2>\n<ul>\n<li>there is a deviceId value composed only of digits: 80901872283 </li>\n</ul>\n<p>Feel free to comment and ask questions</p>",
  "messages": [
    {
      "id": "1978703",
      "postDate": "10/08/2022 23:49:42",
      "content": "<h2>Intro</h2>\n<p>Thank you again to the host for an amazing competition. The full solution code can be found here <a href=\"https://www.kaggle.com/wrrosa/dtabp-1st-place-solution\" target=\"_blank\">https://www.kaggle.com/wrrosa/dtabp-1st-place-solution</a>. I apologize for the delay in making the solution available.</p>\n<h2>EDA</h2>\n<p>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.<br>\nI 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.</p>\n<h2>Data transformation</h2>\n<p>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.<br>\nFeatures that were created are (besides one hot encoding): time (month + day + hour) and grouped shift/last(n) winBid.</p>\n<h2>Model</h2>\n<p>LGBM with manually tuned parameters. In the initial phase, AutoML from H20 was also working fine. Grouping models by slightly modified size feature.</p>\n<h2>What worked</h2>\n<ul>\n<li>last winBid by deviceId</li>\n<li>last winBid by deviceId x unitDisplayType</li>\n<li>last winBid by deviceId x c1</li>\n<li>grouping models by size</li>\n<li>apache superset with postgres as open source BI for device and error data mining</li>\n<li>error analysis on dataset oof</li>\n</ul>\n<h2>What didn't work</h2>\n<ul>\n<li>models grouped by countryCode and other features</li>\n<li>number of folds other than 5</li>\n<li>rejection from the set of cases with has_won = 1. These cases in a way curve our dataset, but in the end remained</li>\n<li>separate models for new devices</li>\n<li>models: knn, enet, xgboost</li>\n<li>other methods of winBid postprocessing than described below.</li>\n</ul>\n<h2>What worked, but I'm not sure (overfitting alert).</h2>\n<ul>\n<li>linear blend folds, even though the coefficients were adjusted on oof (risky idea).</li>\n<li>winBid target pre/postprocessing with parameter p = 0.7 (winBid**p).</li>\n<li>in general, it was difficult to improve the model below public score 15, due to the sensitivity of the metric.</li>\n</ul>\n<h2>Insights</h2>\n<ul>\n<li>some of the devices changed their features, an example (after a few days we get a different brandName and correctModelName)<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F707526cd99927ddc83e7042c9b035492%2Fp2.png?generation=1665272029215415&amp;alt=media\" alt=\"p2.png\"></li>\n<li>even if the features clearly did not change, after few days previous winBids were irrelevant (deviceId 80f3f2bcb94):<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2Fb1e8eef43d6b8023885fecad8984d785%2Fp3.png?generation=1665272041993431&amp;alt=media\" alt=\"p3.png\"></li>\n<li>different c1 but same bid (deviceId 80f3f2bcb94):<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F65bd623857ec09ba460307161eed661b%2Fc6.png?generation=1665272563435243&amp;alt=media\" alt=\"\"></li>\n<li>jumpy process (deviceId 6ab74700e47):<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F0175543af52882923507515cbc3d650e%2Fp5.png?generation=1665272065678087&amp;alt=media\" alt=\"p5.png\"></li>\n<li>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:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2Ff14bb4404f249965aa270c4017cccacb%2Fp1.png?generation=1665272015858160&amp;alt=media\" alt=\"p1.png\"></li>\n<li>competition metric is so sensitive. oof 18.5 divided into 2 different datasets (randomly) could give 16.5 - 20.5</li>\n<li>noticed bug in pandas at nested shift winBid groupby</li>\n<li>the number of rows used in training was less than 10% of the total set </li>\n</ul>\n<h2>Fun fact</h2>\n<ul>\n<li>there is a deviceId value composed only of digits: 80901872283 </li>\n</ul>\n<p>Feel free to comment and ask questions</p>",
      "rawMarkdown": "## Intro\nThank 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.\n## EDA\nI 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.\nI 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.\n## Data transformation\nSplitting 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.\nFeatures that were created are (besides one hot encoding): time (month + day + hour) and grouped shift/last(n) winBid.\n## Model\nLGBM with manually tuned parameters. In the initial phase, AutoML from H20 was also working fine. Grouping models by slightly modified size feature.\n## What worked\n* last winBid by deviceId\n* last winBid by deviceId x unitDisplayType\n* last winBid by deviceId x c1\n* grouping models by size\n* apache superset with postgres as open source BI for device and error data mining\n* error analysis on dataset oof\n## What didn't work\n* models grouped by countryCode and other features\n* number of folds other than 5\n* rejection from the set of cases with has_won = 1. These cases in a way curve our dataset, but in the end remained\n* separate models for new devices\n* models: knn, enet, xgboost\n* other methods of winBid postprocessing than described below.\n## What worked, but I'm not sure (overfitting alert).\n* linear blend folds, even though the coefficients were adjusted on oof (risky idea).\n* winBid target pre/postprocessing with parameter p = 0.7 (winBid**p).\n* in general, it was difficult to improve the model below public score 15, due to the sensitivity of the metric.\n## Insights\n\n* some of the devices changed their features, an example (after a few days we get a different brandName and correctModelName)\n![p2.png](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F707526cd99927ddc83e7042c9b035492%2Fp2.png?generation=1665272029215415&alt=media)\n* even if the features clearly did not change, after few days previous winBids were irrelevant (deviceId 80f3f2bcb94):\n![p3.png](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2Fb1e8eef43d6b8023885fecad8984d785%2Fp3.png?generation=1665272041993431&alt=media)\n* different c1 but same bid (deviceId 80f3f2bcb94):\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F65bd623857ec09ba460307161eed661b%2Fc6.png?generation=1665272563435243&alt=media)\n* jumpy process (deviceId 6ab74700e47):\n![p5.png](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F0175543af52882923507515cbc3d650e%2Fp5.png?generation=1665272065678087&alt=media)\n* 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:\n![p1.png](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2Ff14bb4404f249965aa270c4017cccacb%2Fp1.png?generation=1665272015858160&alt=media)\n* competition metric is so sensitive. oof 18.5 divided into 2 different datasets (randomly) could give 16.5 - 20.5\n* noticed bug in pandas at nested shift winBid groupby\n* the number of rows used in training was less than 10% of the total set \n\n## Fun fact\n* there is a deviceId value composed only of digits: 80901872283 \n\nFeel free to comment and ask questions",
      "votes": null
    },
    {
      "id": "1978958",
      "postDate": "10/09/2022 05:10:34",
      "content": "<p>Hearty congratulations!! Thanks for the detailed explanation and the notebook!<br>\nAll the best <a href=\"https://www.kaggle.com/wrrosa\" target=\"_blank\">@wrrosa</a> </p>",
      "rawMarkdown": "Hearty congratulations!! Thanks for the detailed explanation and the notebook!\nAll the best @wrrosa",
      "votes": null
    },
    {
      "id": "1979776",
      "postDate": "10/09/2022 17:24:32",
      "content": "<p><a href=\"https://www.kaggle.com/wrrosa\" target=\"_blank\">@wrrosa</a> </p>\n<p>Great Notebook. Very insightful. And I'd like to congratulate you on your new Job at Digital Turbine. Wish you all the best at the job and cheers to your success. </p>",
      "rawMarkdown": "wrrosa \n\nGreat Notebook. Very insightful. And I'd like to congratulate you on your new Job at Digital Turbine. Wish you all the best at the job and cheers to your success.",
      "votes": null
    },
    {
      "id": "2499884",
      "postDate": "10/26/2023 10:23:24",
      "content": "<p>Great work! Did you try using catboost?</p>",
      "rawMarkdown": "Great work! Did you try using catboost?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1978958,
      "author_name": "ravi20076",
      "author_url": "",
      "post_date": "10/09/2022 05:10:34",
      "content": "<p>Hearty congratulations!! Thanks for the detailed explanation and the notebook!<br>\nAll the best <a href=\"https://www.kaggle.com/wrrosa\" target=\"_blank\">@wrrosa</a> </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1979776,
      "author_name": "pearsejim01",
      "author_url": "",
      "post_date": "10/09/2022 17:24:32",
      "content": "<p><a href=\"https://www.kaggle.com/wrrosa\" target=\"_blank\">@wrrosa</a> </p>\n<p>Great Notebook. Very insightful. And I'd like to congratulate you on your new Job at Digital Turbine. Wish you all the best at the job and cheers to your success. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2499884,
      "author_name": "mateuszdenys",
      "author_url": "",
      "post_date": "10/26/2023 10:23:24",
      "content": "<p>Great work! Did you try using catboost?</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1978703": "## Intro\nThank 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.\n## EDA\nI 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.\nI 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.\n## Data transformation\nSplitting 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.\nFeatures that were created are (besides one hot encoding): time (month + day + hour) and grouped shift/last(n) winBid.\n## Model\nLGBM with manually tuned parameters. In the initial phase, AutoML from H20 was also working fine. Grouping models by slightly modified size feature.\n## What worked\n* last winBid by deviceId\n* last winBid by deviceId x unitDisplayType\n* last winBid by deviceId x c1\n* grouping models by size\n* apache superset with postgres as open source BI for device and error data mining\n* error analysis on dataset oof\n## What didn't work\n* models grouped by countryCode and other features\n* number of folds other than 5\n* rejection from the set of cases with has_won = 1. These cases in a way curve our dataset, but in the end remained\n* separate models for new devices\n* models: knn, enet, xgboost\n* other methods of winBid postprocessing than described below.\n## What worked, but I'm not sure (overfitting alert).\n* linear blend folds, even though the coefficients were adjusted on oof (risky idea).\n* winBid target pre/postprocessing with parameter p = 0.7 (winBid**p).\n* in general, it was difficult to improve the model below public score 15, due to the sensitivity of the metric.\n## Insights\n\n* some of the devices changed their features, an example (after a few days we get a different brandName and correctModelName)\n![p2.png](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F707526cd99927ddc83e7042c9b035492%2Fp2.png?generation=1665272029215415&alt=media)\n* even if the features clearly did not change, after few days previous winBids were irrelevant (deviceId 80f3f2bcb94):\n![p3.png](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2Fb1e8eef43d6b8023885fecad8984d785%2Fp3.png?generation=1665272041993431&alt=media)\n* different c1 but same bid (deviceId 80f3f2bcb94):\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F65bd623857ec09ba460307161eed661b%2Fc6.png?generation=1665272563435243&alt=media)\n* jumpy process (deviceId 6ab74700e47):\n![p5.png](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2F0175543af52882923507515cbc3d650e%2Fp5.png?generation=1665272065678087&alt=media)\n* 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:\n![p1.png](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3974868%2Ff14bb4404f249965aa270c4017cccacb%2Fp1.png?generation=1665272015858160&alt=media)\n* competition metric is so sensitive. oof 18.5 divided into 2 different datasets (randomly) could give 16.5 - 20.5\n* noticed bug in pandas at nested shift winBid groupby\n* the number of rows used in training was less than 10% of the total set \n\n## Fun fact\n* there is a deviceId value composed only of digits: 80901872283 \n\nFeel free to comment and ask questions",
    "1978958": "Hearty congratulations!! Thanks for the detailed explanation and the notebook!\nAll the best @wrrosa",
    "1979776": "wrrosa \n\nGreat Notebook. Very insightful. And I'd like to congratulate you on your new Job at Digital Turbine. Wish you all the best at the job and cheers to your success.",
    "2499884": "Great work! Did you try using catboost?"
  },
  "source": "meta"
}