{
  "id": 154409,
  "title": "My part of the 3rd place solution",
  "content": "<p>Here is the description of our final solution <a href=\"https://www.kaggle.com/c/abstraction-and-reasoning-challenge/discussion/154305\">https://www.kaggle.com/c/abstraction-and-reasoning-challenge/discussion/154305</a>\n@golubev has definitely contributed more than I into the final result, but even my solo solution could get at least the high silver so I share it with all the source code.</p>\n\n<p>The code and more detailed approach description can be found here: <a href=\"https://github.com/IliaLarchenko/abstract_reasoning\">https://github.com/IliaLarchenko/abstract_reasoning</a></p>\n\n<p>Below is the short write up of my approach.</p>\n\n<ul>\n<li><p>In general, my method can be described as a domain-specific language (DSL) based. I have created the abstract representation of the colors, image blocks extracted from the original input image, and different binary masks. Using these abstractions, I wrote several \"predictors\" that try to derive a set of transformations used to get every output image from the corresponding input image and, if it succeeds – apply these transformations to test input to get the final answer.</p></li>\n<li><p>By the moment of team-up, I had 5 tasks solved (+2 from public kernels). (<a href=\"https://www.kaggle.com/ilialar/5-tasks-part-of-3rd-place-solution\">my kernel demonstrating how it works</a>). Probably there are other tasks that can be solved as well, but I have not tested my solution separately after the merge. My approach also solves 138 and 96 samples from the train and valid sets, respectively.</p></li>\n<li><p>The general logic of every predictor is described in the pseudo-code below (although, it can be different for some classes).\n```\nfor n, (input_image, output_image) in enumerate(sample[‘train’]):\nlist_of_solutions = []\nfor possible_solution in all_possible_solutions:\n    if apply_solution(input_image, possible_solution) == output_image:\n        list_of_solutions.append(possible_solution)\nif n == 0:\n    final_list_of_solutions = list_of_solutions\nelse:\n    final_list_of_solutions = intersection(list_of_solutions, final_list_of_solutions)</p>\n\n<p>if len(final_list_of_solutions) == 0\n    return None</p></li>\n</ul>\n\n<p>answers = []\nfor test_input_image in sample[‘test’]:\n    answers.append([])\n    for solution in final_list_of_solutions:\n        answers[-1].append(apply_solution(test_input_image, solution))</p>\n\n<p>return answers\n```</p>\n\n<ul>\n<li><p>The best working predictors (on the test set) were those that restore some kind of mosaic on images.</p></li>\n<li><p>Other important tips:\n– I have used multiprocessing to significantly speed up computations and control RAM and time each process uses.\n– I have cached all blocks generated at any step. Without it, 16gb RAM often was not enough.\n– I have used unit test extensively to control that I have not broken anything with my last changes (I think, it saved me a lot of hours)</p></li>\n</ul>",
  "comments": [
    {
      "id": 864877,
      "author_name": "Vlad Golubev",
      "author_url": "",
      "post_date": "2020-05-28T08:43:20.417000",
      "content": "<p><a href=\"/ilialar\">@ilialar</a> You have contributed exactly what we need for Top3🎉  And you have very motivated me via your daily activity/progress. I had glad to team-up with you</p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 864944,
      "author_name": "Jan Bre",
      "author_url": "",
      "post_date": "2020-05-28T09:40:24.090000",
      "content": "<p>Congratulations on becoming Kaggle Master</p>",
      "votes": 2,
      "replies": [
        {
          "id": 864949,
          "author_name": "Ilia Larchenko",
          "author_url": "",
          "post_date": "2020-05-28T09:42:53.120000",
          "content": "<p>Thank you!\nAnd congratulations on becoming Kaggle Master too</p>",
          "votes": 2,
          "replies": []
        }
      ]
    },
    {
      "id": 865191,
      "author_name": "Froggy McFrogson",
      "author_url": "",
      "post_date": "2020-05-28T13:06:30.817000",
      "content": "<p>Good job. Very professionally done.\nSeems like you and Zoltan both got a lot of the symmetry questions correct.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 866314,
          "author_name": "Ilia Larchenko",
          "author_url": "",
          "post_date": "2020-05-29T09:39:19.623000",
          "content": "<p>Thank you.\nYes, it seems so. I think we have a significant intersection between solved tasks.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 866315,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-05-29T09:39:48.840000",
      "content": "",
      "votes": 0,
      "replies": []
    },
    {
      "id": 872100,
      "author_name": "corochann",
      "author_url": "",
      "post_date": "2020-06-02T23:07:24.500000",
      "content": "<p>Conglats! thanks for sharing.</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "comment_count": 7,
  "messages": [
    {
      "id": 864859,
      "postDate": "2020-05-28T08:27:30.413Z",
      "content": "<p>Here is the description of our final solution <a href=\"https://www.kaggle.com/c/abstraction-and-reasoning-challenge/discussion/154305\">https://www.kaggle.com/c/abstraction-and-reasoning-challenge/discussion/154305</a>\n@golubev has definitely contributed more than I into the final result, but even my solo solution could get at least the high silver so I share it with all the source code.</p>\n\n<p>The code and more detailed approach description can be found here: <a href=\"https://github.com/IliaLarchenko/abstract_reasoning\">https://github.com/IliaLarchenko/abstract_reasoning</a></p>\n\n<p>Below is the short write up of my approach.</p>\n\n<ul>\n<li><p>In general, my method can be described as a domain-specific language (DSL) based. I have created the abstract representation of the colors, image blocks extracted from the original input image, and different binary masks. Using these abstractions, I wrote several \"predictors\" that try to derive a set of transformations used to get every output image from the corresponding input image and, if it succeeds – apply these transformations to test input to get the final answer.</p></li>\n<li><p>By the moment of team-up, I had 5 tasks solved (+2 from public kernels). (<a href=\"https://www.kaggle.com/ilialar/5-tasks-part-of-3rd-place-solution\">my kernel demonstrating how it works</a>). Probably there are other tasks that can be solved as well, but I have not tested my solution separately after the merge. My approach also solves 138 and 96 samples from the train and valid sets, respectively.</p></li>\n<li><p>The general logic of every predictor is described in the pseudo-code below (although, it can be different for some classes).\n```\nfor n, (input_image, output_image) in enumerate(sample[‘train’]):\nlist_of_solutions = []\nfor possible_solution in all_possible_solutions:\n    if apply_solution(input_image, possible_solution) == output_image:\n        list_of_solutions.append(possible_solution)\nif n == 0:\n    final_list_of_solutions = list_of_solutions\nelse:\n    final_list_of_solutions = intersection(list_of_solutions, final_list_of_solutions)</p>\n\n<p>if len(final_list_of_solutions) == 0\n    return None</p></li>\n</ul>\n\n<p>answers = []\nfor test_input_image in sample[‘test’]:\n    answers.append([])\n    for solution in final_list_of_solutions:\n        answers[-1].append(apply_solution(test_input_image, solution))</p>\n\n<p>return answers\n```</p>\n\n<ul>\n<li><p>The best working predictors (on the test set) were those that restore some kind of mosaic on images.</p></li>\n<li><p>Other important tips:\n– I have used multiprocessing to significantly speed up computations and control RAM and time each process uses.\n– I have cached all blocks generated at any step. Without it, 16gb RAM often was not enough.\n– I have used unit test extensively to control that I have not broken anything with my last changes (I think, it saved me a lot of hours)</p></li>\n</ul>",
      "rawMarkdown": "Here is the description of our final solution https://www.kaggle.com/c/abstraction-and-reasoning-challenge/discussion/154305\n@golubev has definitely contributed more than I into the final result, but even my solo solution could get at least the high silver so I share it with all the source code.\n\nThe code and more detailed approach description can be found here: https://github.com/IliaLarchenko/abstract_reasoning\n\nBelow is the short write up of my approach.\n \n- In general, my method can be described as a domain-specific language (DSL) based. I have created the abstract representation of the colors, image blocks extracted from the original input image, and different binary masks. Using these abstractions, I wrote several \"predictors\" that try to derive a set of transformations used to get every output image from the corresponding input image and, if it succeeds – apply these transformations to test input to get the final answer.\n\n- By the moment of team-up, I had 5 tasks solved (+2 from public kernels). ([my kernel demonstrating how it works](https://www.kaggle.com/ilialar/5-tasks-part-of-3rd-place-solution)). Probably there are other tasks that can be solved as well, but I have not tested my solution separately after the merge. My approach also solves 138 and 96 samples from the train and valid sets, respectively.\n\n- The general logic of every predictor is described in the pseudo-code below (although, it can be different for some classes).\n```\nfor n, (input_image, output_image) in enumerate(sample[‘train’]):\n    list_of_solutions = []\n    for possible_solution in all_possible_solutions:\n        if apply_solution(input_image, possible_solution) == output_image:\n            list_of_solutions.append(possible_solution)\n    if n == 0:\n        final_list_of_solutions = list_of_solutions\n    else:\n        final_list_of_solutions = intersection(list_of_solutions, final_list_of_solutions)\n\n    if len(final_list_of_solutions) == 0\n        return None\n\nanswers = []\nfor test_input_image in sample[‘test’]:\n    answers.append([])\n    for solution in final_list_of_solutions:\n        answers[-1].append(apply_solution(test_input_image, solution))\n\nreturn answers\n```\n\n- The best working predictors (on the test set) were those that restore some kind of mosaic on images.\n\n- Other important tips:\n– I have used multiprocessing to significantly speed up computations and control RAM and time each process uses.\n– I have cached all blocks generated at any step. Without it, 16gb RAM often was not enough.\n– I have used unit test extensively to control that I have not broken anything with my last changes (I think, it saved me a lot of hours)\n\n",
      "votes": 28
    },
    {
      "id": 864877,
      "postDate": "2020-05-28T08:43:20.417Z",
      "content": "<p><a href=\"/ilialar\">@ilialar</a> You have contributed exactly what we need for Top3🎉  And you have very motivated me via your daily activity/progress. I had glad to team-up with you</p>",
      "rawMarkdown": "@ilialar You have contributed exactly what we need for Top3🎉  And you have very motivated me via your daily activity/progress. I had glad to team-up with you",
      "votes": 3
    },
    {
      "id": 864944,
      "postDate": "2020-05-28T09:40:24.090Z",
      "content": "<p>Congratulations on becoming Kaggle Master</p>",
      "rawMarkdown": "Congratulations on becoming Kaggle Master",
      "votes": 2,
      "replies": [
        {
          "id": 864949,
          "postDate": "2020-05-28T09:42:53.120Z",
          "content": "<p>Thank you!\nAnd congratulations on becoming Kaggle Master too</p>",
          "rawMarkdown": "Thank you!\nAnd congratulations on becoming Kaggle Master too",
          "votes": 2
        }
      ]
    },
    {
      "id": 865191,
      "postDate": "2020-05-28T13:06:30.817Z",
      "content": "<p>Good job. Very professionally done.\nSeems like you and Zoltan both got a lot of the symmetry questions correct.</p>",
      "rawMarkdown": "Good job. Very professionally done.\nSeems like you and Zoltan both got a lot of the symmetry questions correct.\n",
      "replies": [
        {
          "id": 866314,
          "postDate": "2020-05-29T09:39:19.623Z",
          "content": "<p>Thank you.\nYes, it seems so. I think we have a significant intersection between solved tasks.</p>",
          "rawMarkdown": "Thank you.\nYes, it seems so. I think we have a significant intersection between solved tasks."
        }
      ]
    },
    {
      "id": 866315,
      "postDate": "2020-05-29T09:39:48.840Z",
      "rawMarkdown": "",
      "isDeleted": true
    },
    {
      "id": 872100,
      "postDate": "2020-06-02T23:07:24.500Z",
      "content": "<p>Conglats! thanks for sharing.</p>",
      "rawMarkdown": "Conglats! thanks for sharing."
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T22:06:42Z",
  "competition_id": 18329,
  "competition_slug": "abstraction-and-reasoning-challenge",
  "team_id": 4390616,
  "solution_url": "/competitions/abstraction-and-reasoning-challenge/writeups/vlad-ilia-my-part-of-the-3rd-place-solution"
}