{
  "id": 239893,
  "title": "[25th] Public Sub + Shortest Path Search",
  "url": "/competitions/indoor-location-navigation/writeups/tomoo-inubushi-25th-public-sub-shortest-path-searc",
  "author_name": "",
  "post_date": "2021-05-18T05:07:38.057Z",
  "votes": 18,
  "comment_count": 7,
  "views": 0,
  "content": "<h1>Thank you everyone!</h1>\n<p>My solution is very simple. Everything is available from <a href=\"https://www.kaggle.com/tomooinubushi/25th-public-sub-shortest-path-search\" target=\"_blank\">here</a>.</p>\n<p><strong>1. I use the results of <a href=\"https://www.kaggle.com/ahmedewida/indoorlocation-ensembling\" target=\"_blank\">public best submission</a>.</strong><br>\nI used the public sub, because my NN models were never better than 7.7 in CV. I am looking forward to see other solutions.</p>\n<p><strong>2. Correct floor predictions based on the leakages of <a href=\"https://www.kaggle.com/tomooinubushi/retrieving-user-id-from-leaked-wifi-feature\" target=\"_blank\">shared wifi records</a> and <a href=\"https://www.kaggle.com/c/indoor-location-navigation/discussion/234543\" target=\"_blank\">device IDs</a>.</strong></p>\n<p>I assumed that the paths with the same ID are in the same floor, which is not always true for train waypoints. Correcting start/end waypoints based on the leakages did not work well when combining with following shortest path search post-processing. This process changes floor predictions of only three paths that are in private test set i.e., this process did not change public LB score.</p>\n<p><strong>3. Postprocess the waypoints based on <a href=\"https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm\" target=\"_blank\">Dijkstra's algorithm</a>.</strong><br>\nI re-defined the task as a <a href=\"https://en.wikipedia.org/wiki/Shortest_path_problem\" target=\"_blank\">shortest path problem</a> rather than a regression task. I searched the path with minimal <a href=\"https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization\" target=\"_blank\">cost</a> based on Dijkstra's algorithm, in which the nodes are train and augmented waypoints.</p>\n<p>Instead of using hand-labeled waypoints, I generated augmented waypoints with following rules.</p>\n<ul>\n<li>Augmented waypoints have similar X and Y values of train ones (mean of the subset of train waypoints).</li>\n<li>Augmented waypoints are in hallways.</li>\n<li>Augmented waypoints are sufficiently distant from train ones and each other.</li>\n</ul>\n<p>I used codes and ideas from many many discussions and notebooks. Please notify me if I miss someone. Thank you very much.</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/kenmatsu4/feature-store-for-indoor-location-navigation\" target=\"_blank\">https://www.kaggle.com/kenmatsu4/feature-store-for-indoor-location-navigation</a></li>\n<li><a href=\"https://www.kaggle.com/jiweiliu/fix-the-timestamps-of-test-data-using-dask\" target=\"_blank\">https://www.kaggle.com/jiweiliu/fix-the-timestamps-of-test-data-using-dask</a></li>\n<li><a href=\"https://www.kaggle.com/ahmedewida/indoorlocation-ensembling\" target=\"_blank\">https://www.kaggle.com/ahmedewida/indoorlocation-ensembling</a></li>\n<li><a href=\"https://www.kaggle.com/c/indoor-location-navigation/discussion/234543\" target=\"_blank\">https://www.kaggle.com/c/indoor-location-navigation/discussion/234543</a></li>\n<li><a href=\"https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization\" target=\"_blank\">https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization</a></li>\n<li><a href=\"https://www.kaggle.com/museas/with-magn-cost-minimization\" target=\"_blank\">https://www.kaggle.com/museas/with-magn-cost-minimization</a></li>\n<li><a href=\"https://www.kaggle.com/higepon/visualize-submissions-with-post-processing\" target=\"_blank\">https://www.kaggle.com/higepon/visualize-submissions-with-post-processing</a></li>\n<li><a href=\"https://www.kaggle.com/robikscube/indoor-nav-visualize-predictions-train-data\" target=\"_blank\">https://www.kaggle.com/robikscube/indoor-nav-visualize-predictions-train-data</a></li>\n<li><a href=\"https://www.kaggle.com/nigelhenry/simple-99-accurate-floor-model\" target=\"_blank\">https://www.kaggle.com/nigelhenry/simple-99-accurate-floor-model</a></li>\n</ul>",
  "messages": [
    {
      "id": "1312305",
      "postDate": "05/18/2021 01:32:08",
      "content": "<h1>Thank you everyone!</h1>\n<p>My solution is very simple. Everything is available from <a href=\"https://www.kaggle.com/tomooinubushi/25th-public-sub-shortest-path-search\" target=\"_blank\">here</a>.</p>\n<p><strong>1. I use the results of <a href=\"https://www.kaggle.com/ahmedewida/indoorlocation-ensembling\" target=\"_blank\">public best submission</a>.</strong><br>\nI used the public sub, because my NN models were never better than 7.7 in CV. I am looking forward to see other solutions.</p>\n<p><strong>2. Correct floor predictions based on the leakages of <a href=\"https://www.kaggle.com/tomooinubushi/retrieving-user-id-from-leaked-wifi-feature\" target=\"_blank\">shared wifi records</a> and <a href=\"https://www.kaggle.com/c/indoor-location-navigation/discussion/234543\" target=\"_blank\">device IDs</a>.</strong></p>\n<p>I assumed that the paths with the same ID are in the same floor, which is not always true for train waypoints. Correcting start/end waypoints based on the leakages did not work well when combining with following shortest path search post-processing. This process changes floor predictions of only three paths that are in private test set i.e., this process did not change public LB score.</p>\n<p><strong>3. Postprocess the waypoints based on <a href=\"https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm\" target=\"_blank\">Dijkstra's algorithm</a>.</strong><br>\nI re-defined the task as a <a href=\"https://en.wikipedia.org/wiki/Shortest_path_problem\" target=\"_blank\">shortest path problem</a> rather than a regression task. I searched the path with minimal <a href=\"https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization\" target=\"_blank\">cost</a> based on Dijkstra's algorithm, in which the nodes are train and augmented waypoints.</p>\n<p>Instead of using hand-labeled waypoints, I generated augmented waypoints with following rules.</p>\n<ul>\n<li>Augmented waypoints have similar X and Y values of train ones (mean of the subset of train waypoints).</li>\n<li>Augmented waypoints are in hallways.</li>\n<li>Augmented waypoints are sufficiently distant from train ones and each other.</li>\n</ul>\n<p>I used codes and ideas from many many discussions and notebooks. Please notify me if I miss someone. Thank you very much.</p>\n<ul>\n<li><a href=\"https://www.kaggle.com/kenmatsu4/feature-store-for-indoor-location-navigation\" target=\"_blank\">https://www.kaggle.com/kenmatsu4/feature-store-for-indoor-location-navigation</a></li>\n<li><a href=\"https://www.kaggle.com/jiweiliu/fix-the-timestamps-of-test-data-using-dask\" target=\"_blank\">https://www.kaggle.com/jiweiliu/fix-the-timestamps-of-test-data-using-dask</a></li>\n<li><a href=\"https://www.kaggle.com/ahmedewida/indoorlocation-ensembling\" target=\"_blank\">https://www.kaggle.com/ahmedewida/indoorlocation-ensembling</a></li>\n<li><a href=\"https://www.kaggle.com/c/indoor-location-navigation/discussion/234543\" target=\"_blank\">https://www.kaggle.com/c/indoor-location-navigation/discussion/234543</a></li>\n<li><a href=\"https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization\" target=\"_blank\">https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization</a></li>\n<li><a href=\"https://www.kaggle.com/museas/with-magn-cost-minimization\" target=\"_blank\">https://www.kaggle.com/museas/with-magn-cost-minimization</a></li>\n<li><a href=\"https://www.kaggle.com/higepon/visualize-submissions-with-post-processing\" target=\"_blank\">https://www.kaggle.com/higepon/visualize-submissions-with-post-processing</a></li>\n<li><a href=\"https://www.kaggle.com/robikscube/indoor-nav-visualize-predictions-train-data\" target=\"_blank\">https://www.kaggle.com/robikscube/indoor-nav-visualize-predictions-train-data</a></li>\n<li><a href=\"https://www.kaggle.com/nigelhenry/simple-99-accurate-floor-model\" target=\"_blank\">https://www.kaggle.com/nigelhenry/simple-99-accurate-floor-model</a></li>\n</ul>",
      "rawMarkdown": "# Thank you everyone!\n\nMy solution is very simple. Everything is available from [here](https://www.kaggle.com/tomooinubushi/25th-public-sub-shortest-path-search).\n\n\n\n**1. I use the results of [public best submission](https://www.kaggle.com/ahmedewida/indoorlocation-ensembling).**\nI used the public sub, because my NN models were never better than 7.7 in CV. I am looking forward to see other solutions.\n\n**2. Correct floor predictions based on the leakages of [shared wifi records](https://www.kaggle.com/tomooinubushi/retrieving-user-id-from-leaked-wifi-feature) and [device IDs](https://www.kaggle.com/c/indoor-location-navigation/discussion/234543).**\n\nI assumed that the paths with the same ID are in the same floor, which is not always true for train waypoints. Correcting start/end waypoints based on the leakages did not work well when combining with following shortest path search post-processing. This process changes floor predictions of only three paths that are in private test set i.e., this process did not change public LB score.\n\n**3. Postprocess the waypoints based on [Dijkstra's algorithm](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm).**\nI re-defined the task as a [shortest path problem](https://en.wikipedia.org/wiki/Shortest_path_problem) rather than a regression task. I searched the path with minimal [cost](https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization) based on Dijkstra's algorithm, in which the nodes are train and augmented waypoints.\n\nInstead of using hand-labeled waypoints, I generated augmented waypoints with following rules.\n-   Augmented waypoints have similar X and Y values of train ones (mean of the subset of train waypoints).\n-   Augmented waypoints are in hallways.\n-   Augmented waypoints are sufficiently distant from train ones and each other.\n\nI used codes and ideas from many many discussions and notebooks. Please notify me if I miss someone. Thank you very much.\n\n* https://www.kaggle.com/kenmatsu4/feature-store-for-indoor-location-navigation\n* https://www.kaggle.com/jiweiliu/fix-the-timestamps-of-test-data-using-dask\n* https://www.kaggle.com/ahmedewida/indoorlocation-ensembling\n* https://www.kaggle.com/c/indoor-location-navigation/discussion/234543\n* https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization\n* https://www.kaggle.com/museas/with-magn-cost-minimization\n* https://www.kaggle.com/higepon/visualize-submissions-with-post-processing\n* https://www.kaggle.com/robikscube/indoor-nav-visualize-predictions-train-data\n* https://www.kaggle.com/nigelhenry/simple-99-accurate-floor-model",
      "votes": null
    },
    {
      "id": "1312323",
      "postDate": "05/18/2021 01:52:12",
      "content": "<p>Very strong PP, congrats on 25th place <a href=\"https://www.kaggle.com/tomooinubushi\" target=\"_blank\">@tomooinubushi</a> </p>",
      "rawMarkdown": "Very strong PP, congrats on 25th place @tomooinubushi",
      "votes": null
    },
    {
      "id": "1312396",
      "postDate": "05/18/2021 03:14:54",
      "content": "<p>Thank you <a href=\"https://www.kaggle.com/duykhanh99\" target=\"_blank\">@duykhanh99</a>.<br>\nI hope I can use my own model in the next competition.</p>",
      "rawMarkdown": "Thank you @duykhanh99.\nI hope I can use my own model in the next competition.",
      "votes": null
    },
    {
      "id": "1312667",
      "postDate": "05/18/2021 07:12:12",
      "content": "<p>Pretty nice idea! Congrats!</p>",
      "rawMarkdown": "Pretty nice idea! Congrats!",
      "votes": null
    },
    {
      "id": "1313470",
      "postDate": "05/18/2021 15:20:31",
      "content": "<p>Damn, using Dijkstra's algorithm to find the shortest path is very smart! I would never have thought of using it for this type of problem 😅</p>",
      "rawMarkdown": "Damn, using Dijkstra's algorithm to find the shortest path is very smart! I would never have thought of using it for this type of problem 😅",
      "votes": null
    },
    {
      "id": "1315510",
      "postDate": "05/19/2021 21:12:44",
      "content": "<p>Thank you for publishing a great solution.<br>\nAlso, thank you for publishing a useful notebook during the competition.</p>\n<p>Please let me know about your notebook, if you don't mind.<br>\nThe reason why the post-processing execution threshold (start_threshold, end_threshold) was set to 5,500?</p>\n<p>（Reference）<br>\n<a href=\"https://www.kaggle.com/tomooinubushi/postprocessing-based-on-leakage\" target=\"_blank\">https://www.kaggle.com/tomooinubushi/postprocessing-based-on-leakage</a></p>",
      "rawMarkdown": "Thank you for publishing a great solution.\nAlso, thank you for publishing a useful notebook during the competition.\n\nPlease let me know about your notebook, if you don't mind.\nThe reason why the post-processing execution threshold (start_threshold, end_threshold) was set to 5,500?\n\n（Reference）\nhttps://www.kaggle.com/tomooinubushi/postprocessing-based-on-leakage",
      "votes": null
    },
    {
      "id": "1315582",
      "postDate": "05/20/2021 00:24:03",
      "content": "<p>Thank you for your comment.<br>\nThis is very important point and <a href=\"https://www.kaggle.com/c/indoor-location-navigation/discussion/234543\" target=\"_blank\">already asked by 2nd place winner</a>.<br>\nThese thresholds (5,500) are based on EDA of raw timestamps. I found whether start and end points are the same is related to the temporal difference of start and end point. You can see this relationship <a href=\"https://www.kaggle.com/iwatatakuya/use-leakage-considering-device-id-postprocess\" target=\"_blank\">in the notebook by ganchan</a> while this notebook uses more sophisticated method for finding leaked start/end waypoints. <br>\nI created the histogram of diff raw timestamps grouped with whether it create chain (coincidence of start and end waypoint) or not. At the around 5,500 ms, the probability of chain becomes 50/50.<br>\nI did not think these thresholds are optimal, but I thought it is OK if I could demonstrate the existence of the leakage at that time.</p>",
      "rawMarkdown": "Thank you for your comment.\nThis is very important point and [already asked by 2nd place winner](https://www.kaggle.com/c/indoor-location-navigation/discussion/234543).\nThese thresholds (5,500) are based on EDA of raw timestamps. I found whether start and end points are the same is related to the temporal difference of start and end point. You can see this relationship [in the notebook by ganchan](https://www.kaggle.com/iwatatakuya/use-leakage-considering-device-id-postprocess) while this notebook uses more sophisticated method for finding leaked start/end waypoints. \nI created the histogram of diff raw timestamps grouped with whether it create chain (coincidence of start and end waypoint) or not. At the around 5,500 ms, the probability of chain becomes 50/50.\nI did not think these thresholds are optimal, but I thought it is OK if I could demonstrate the existence of the leakage at that time.",
      "votes": null
    },
    {
      "id": "1316284",
      "postDate": "05/20/2021 12:37:34",
      "content": "<p>Thanks for the explanation. I understand now about it.<br>\nI did some experimenting with different thresholds to improve the effect, but I couldn't find the optimal value, so I used 5,500 for the final sub.</p>\n<p>Adding constraints to the floor and raising the threshold improved the score on the public leaderboard, but I wasn't sure if the result would be the same for private.</p>",
      "rawMarkdown": "Thanks for the explanation. I understand now about it.\nI did some experimenting with different thresholds to improve the effect, but I couldn't find the optimal value, so I used 5,500 for the final sub.\n\nAdding constraints to the floor and raising the threshold improved the score on the public leaderboard, but I wasn't sure if the result would be the same for private.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1312323,
      "author_name": "duykhanh99",
      "author_url": "",
      "post_date": "05/18/2021 01:52:12",
      "content": "<p>Very strong PP, congrats on 25th place <a href=\"https://www.kaggle.com/tomooinubushi\" target=\"_blank\">@tomooinubushi</a> </p>",
      "votes": null,
      "replies": [
        {
          "id": 1312396,
          "author_name": "tomooinubushi",
          "author_url": "",
          "post_date": "05/18/2021 03:14:54",
          "content": "<p>Thank you <a href=\"https://www.kaggle.com/duykhanh99\" target=\"_blank\">@duykhanh99</a>.<br>\nI hope I can use my own model in the next competition.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1312667,
      "author_name": "josephjzk",
      "author_url": "",
      "post_date": "05/18/2021 07:12:12",
      "content": "<p>Pretty nice idea! Congrats!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1313470,
      "author_name": "romainfabre",
      "author_url": "",
      "post_date": "05/18/2021 15:20:31",
      "content": "<p>Damn, using Dijkstra's algorithm to find the shortest path is very smart! I would never have thought of using it for this type of problem 😅</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1315510,
      "author_name": "dehokanta",
      "author_url": "",
      "post_date": "05/19/2021 21:12:44",
      "content": "<p>Thank you for publishing a great solution.<br>\nAlso, thank you for publishing a useful notebook during the competition.</p>\n<p>Please let me know about your notebook, if you don't mind.<br>\nThe reason why the post-processing execution threshold (start_threshold, end_threshold) was set to 5,500?</p>\n<p>（Reference）<br>\n<a href=\"https://www.kaggle.com/tomooinubushi/postprocessing-based-on-leakage\" target=\"_blank\">https://www.kaggle.com/tomooinubushi/postprocessing-based-on-leakage</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 1315582,
          "author_name": "tomooinubushi",
          "author_url": "",
          "post_date": "05/20/2021 00:24:03",
          "content": "<p>Thank you for your comment.<br>\nThis is very important point and <a href=\"https://www.kaggle.com/c/indoor-location-navigation/discussion/234543\" target=\"_blank\">already asked by 2nd place winner</a>.<br>\nThese thresholds (5,500) are based on EDA of raw timestamps. I found whether start and end points are the same is related to the temporal difference of start and end point. You can see this relationship <a href=\"https://www.kaggle.com/iwatatakuya/use-leakage-considering-device-id-postprocess\" target=\"_blank\">in the notebook by ganchan</a> while this notebook uses more sophisticated method for finding leaked start/end waypoints. <br>\nI created the histogram of diff raw timestamps grouped with whether it create chain (coincidence of start and end waypoint) or not. At the around 5,500 ms, the probability of chain becomes 50/50.<br>\nI did not think these thresholds are optimal, but I thought it is OK if I could demonstrate the existence of the leakage at that time.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1316284,
          "author_name": "dehokanta",
          "author_url": "",
          "post_date": "05/20/2021 12:37:34",
          "content": "<p>Thanks for the explanation. I understand now about it.<br>\nI did some experimenting with different thresholds to improve the effect, but I couldn't find the optimal value, so I used 5,500 for the final sub.</p>\n<p>Adding constraints to the floor and raising the threshold improved the score on the public leaderboard, but I wasn't sure if the result would be the same for private.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1312305": "# Thank you everyone!\n\nMy solution is very simple. Everything is available from [here](https://www.kaggle.com/tomooinubushi/25th-public-sub-shortest-path-search).\n\n\n\n**1. I use the results of [public best submission](https://www.kaggle.com/ahmedewida/indoorlocation-ensembling).**\nI used the public sub, because my NN models were never better than 7.7 in CV. I am looking forward to see other solutions.\n\n**2. Correct floor predictions based on the leakages of [shared wifi records](https://www.kaggle.com/tomooinubushi/retrieving-user-id-from-leaked-wifi-feature) and [device IDs](https://www.kaggle.com/c/indoor-location-navigation/discussion/234543).**\n\nI assumed that the paths with the same ID are in the same floor, which is not always true for train waypoints. Correcting start/end waypoints based on the leakages did not work well when combining with following shortest path search post-processing. This process changes floor predictions of only three paths that are in private test set i.e., this process did not change public LB score.\n\n**3. Postprocess the waypoints based on [Dijkstra's algorithm](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm).**\nI re-defined the task as a [shortest path problem](https://en.wikipedia.org/wiki/Shortest_path_problem) rather than a regression task. I searched the path with minimal [cost](https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization) based on Dijkstra's algorithm, in which the nodes are train and augmented waypoints.\n\nInstead of using hand-labeled waypoints, I generated augmented waypoints with following rules.\n-   Augmented waypoints have similar X and Y values of train ones (mean of the subset of train waypoints).\n-   Augmented waypoints are in hallways.\n-   Augmented waypoints are sufficiently distant from train ones and each other.\n\nI used codes and ideas from many many discussions and notebooks. Please notify me if I miss someone. Thank you very much.\n\n* https://www.kaggle.com/kenmatsu4/feature-store-for-indoor-location-navigation\n* https://www.kaggle.com/jiweiliu/fix-the-timestamps-of-test-data-using-dask\n* https://www.kaggle.com/ahmedewida/indoorlocation-ensembling\n* https://www.kaggle.com/c/indoor-location-navigation/discussion/234543\n* https://www.kaggle.com/saitodevel01/indoor-post-processing-by-cost-minimization\n* https://www.kaggle.com/museas/with-magn-cost-minimization\n* https://www.kaggle.com/higepon/visualize-submissions-with-post-processing\n* https://www.kaggle.com/robikscube/indoor-nav-visualize-predictions-train-data\n* https://www.kaggle.com/nigelhenry/simple-99-accurate-floor-model",
    "1312323": "Very strong PP, congrats on 25th place @tomooinubushi",
    "1312396": "Thank you @duykhanh99.\nI hope I can use my own model in the next competition.",
    "1312667": "Pretty nice idea! Congrats!",
    "1313470": "Damn, using Dijkstra's algorithm to find the shortest path is very smart! I would never have thought of using it for this type of problem 😅",
    "1315510": "Thank you for publishing a great solution.\nAlso, thank you for publishing a useful notebook during the competition.\n\nPlease let me know about your notebook, if you don't mind.\nThe reason why the post-processing execution threshold (start_threshold, end_threshold) was set to 5,500?\n\n（Reference）\nhttps://www.kaggle.com/tomooinubushi/postprocessing-based-on-leakage",
    "1315582": "Thank you for your comment.\nThis is very important point and [already asked by 2nd place winner](https://www.kaggle.com/c/indoor-location-navigation/discussion/234543).\nThese thresholds (5,500) are based on EDA of raw timestamps. I found whether start and end points are the same is related to the temporal difference of start and end point. You can see this relationship [in the notebook by ganchan](https://www.kaggle.com/iwatatakuya/use-leakage-considering-device-id-postprocess) while this notebook uses more sophisticated method for finding leaked start/end waypoints. \nI created the histogram of diff raw timestamps grouped with whether it create chain (coincidence of start and end waypoint) or not. At the around 5,500 ms, the probability of chain becomes 50/50.\nI did not think these thresholds are optimal, but I thought it is OK if I could demonstrate the existence of the leakage at that time.",
    "1316284": "Thanks for the explanation. I understand now about it.\nI did some experimenting with different thresholds to improve the effect, but I couldn't find the optimal value, so I used 5,500 for the final sub.\n\nAdding constraints to the floor and raising the threshold improved the score on the public leaderboard, but I wasn't sure if the result would be the same for private."
  },
  "source": "meta"
}