Skip to content

Instantly share code, notes, and snippets.

@sujnesh
Created February 25, 2021 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sujnesh/84c3d1b4c1b66cbfeec8f649baaf94a2 to your computer and use it in GitHub Desktop.
Save sujnesh/84c3d1b4c1b66cbfeec8f649baaf94a2 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Baseline_Tile-Slider.ipynb","provenance":[],"collapsed_sections":[],"toc_visible":true,"machine_shape":"hm"},"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.8.2"},"widgets":{"application/vnd.jupyter.widget-state+json":{"125a6d325ed947a0b03b6a7e8b901d41":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","state":{"_view_name":"HBoxView","_dom_classes":[],"_model_name":"HBoxModel","_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.5.0","box_style":"","layout":"IPY_MODEL_c8c4ff0591d34701a11f11d0a9ad9def","_model_module":"@jupyter-widgets/controls","children":["IPY_MODEL_4b3e315799e64532b9941acea065363a","IPY_MODEL_faca844ce8df4e41bc94422accf377f8"]}},"c8c4ff0591d34701a11f11d0a9ad9def":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"4b3e315799e64532b9941acea065363a":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","state":{"_view_name":"ProgressView","style":"IPY_MODEL_e2b201d2485d4682832120b1a87d85db","_dom_classes":[],"description":"sample_submission.csv: 100%","_model_name":"FloatProgressModel","bar_style":"success","max":60015,"_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","value":60015,"_view_count":null,"_view_module_version":"1.5.0","orientation":"horizontal","min":0,"description_tooltip":null,"_model_module":"@jupyter-widgets/controls","layout":"IPY_MODEL_608ea7248e954088aa0d0af7ca66cd79"}},"faca844ce8df4e41bc94422accf377f8":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","state":{"_view_name":"HTMLView","style":"IPY_MODEL_5e6475af9f3945a29d4f2304ea55424b","_dom_classes":[],"description":"","_model_name":"HTMLModel","placeholder":"​","_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","value":" 60.0k/60.0k [00:43&lt;00:00, 1.38kB/s]","_view_count":null,"_view_module_version":"1.5.0","description_tooltip":null,"_model_module":"@jupyter-widgets/controls","layout":"IPY_MODEL_7edcccd6c4064a08b9d0e9479fb0b08e"}},"e2b201d2485d4682832120b1a87d85db":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","state":{"_view_name":"StyleView","_model_name":"ProgressStyleModel","description_width":"initial","_view_module":"@jupyter-widgets/base","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.2.0","bar_color":null,"_model_module":"@jupyter-widgets/controls"}},"608ea7248e954088aa0d0af7ca66cd79":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"5e6475af9f3945a29d4f2304ea55424b":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","state":{"_view_name":"StyleView","_model_name":"DescriptionStyleModel","description_width":"","_view_module":"@jupyter-widgets/base","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.2.0","_model_module":"@jupyter-widgets/controls"}},"7edcccd6c4064a08b9d0e9479fb0b08e":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"c6d0bf4035404ad3b34df068e4c229b9":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","state":{"_view_name":"HBoxView","_dom_classes":[],"_model_name":"HBoxModel","_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.5.0","box_style":"","layout":"IPY_MODEL_19140b7e24d846bc90c63539405d7fc3","_model_module":"@jupyter-widgets/controls","children":["IPY_MODEL_de11dfc879f842b1a911063ea07c8ad1","IPY_MODEL_61133dcfbbd449e8a70eed51e4b5b5da"]}},"19140b7e24d846bc90c63539405d7fc3":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"de11dfc879f842b1a911063ea07c8ad1":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","state":{"_view_name":"ProgressView","style":"IPY_MODEL_225ecd0d175e46ca9035b255125f0a99","_dom_classes":[],"description":"dataset.zip: 100%","_model_name":"FloatProgressModel","bar_style":"success","max":724488,"_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","value":724488,"_view_count":null,"_view_module_version":"1.5.0","orientation":"horizontal","min":0,"description_tooltip":null,"_model_module":"@jupyter-widgets/controls","layout":"IPY_MODEL_90dc739845e845d3aaeeefafa5cdff94"}},"61133dcfbbd449e8a70eed51e4b5b5da":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","state":{"_view_name":"HTMLView","style":"IPY_MODEL_42de5bbdc4504341b9287410fc8b5115","_dom_classes":[],"description":"","_model_name":"HTMLModel","placeholder":"​","_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","value":" 724k/724k [00:03&lt;00:00, 207kB/s]","_view_count":null,"_view_module_version":"1.5.0","description_tooltip":null,"_model_module":"@jupyter-widgets/controls","layout":"IPY_MODEL_bcc73ff444a244d89d4155b7b13d19fc"}},"225ecd0d175e46ca9035b255125f0a99":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","state":{"_view_name":"StyleView","_model_name":"ProgressStyleModel","description_width":"initial","_view_module":"@jupyter-widgets/base","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.2.0","bar_color":null,"_model_module":"@jupyter-widgets/controls"}},"90dc739845e845d3aaeeefafa5cdff94":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"42de5bbdc4504341b9287410fc8b5115":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","state":{"_view_name":"StyleView","_model_name":"DescriptionStyleModel","description_width":"","_view_module":"@jupyter-widgets/base","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.2.0","_model_module":"@jupyter-widgets/controls"}},"bcc73ff444a244d89d4155b7b13d19fc":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"282207bb2ce64494a2b26d5c1e8df7dc":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","state":{"_view_name":"HBoxView","_dom_classes":[],"_model_name":"HBoxModel","_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.5.0","box_style":"","layout":"IPY_MODEL_1ef2a77348d74d9cb9b0cc4563a34fdc","_model_module":"@jupyter-widgets/controls","children":["IPY_MODEL_649346f61e8c46c0b201154fc7909a21","IPY_MODEL_3461859613064f3abaf14638c83da304"]}},"1ef2a77348d74d9cb9b0cc4563a34fdc":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"649346f61e8c46c0b201154fc7909a21":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","state":{"_view_name":"ProgressView","style":"IPY_MODEL_347967a707894bf99081ca29da3145a6","_dom_classes":[],"description":"sample_submission.csv: 100%","_model_name":"FloatProgressModel","bar_style":"success","max":60015,"_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","value":60015,"_view_count":null,"_view_module_version":"1.5.0","orientation":"horizontal","min":0,"description_tooltip":null,"_model_module":"@jupyter-widgets/controls","layout":"IPY_MODEL_24fd0e9c289f45e9a67136f5907b286b"}},"3461859613064f3abaf14638c83da304":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","state":{"_view_name":"HTMLView","style":"IPY_MODEL_a055013b60f140068189a61342485f66","_dom_classes":[],"description":"","_model_name":"HTMLModel","placeholder":"​","_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","value":" 60.0k/60.0k [00:39&lt;00:00, 1.51kB/s]","_view_count":null,"_view_module_version":"1.5.0","description_tooltip":null,"_model_module":"@jupyter-widgets/controls","layout":"IPY_MODEL_fe90200e3eee45159f7b550b5c9437a8"}},"347967a707894bf99081ca29da3145a6":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","state":{"_view_name":"StyleView","_model_name":"ProgressStyleModel","description_width":"initial","_view_module":"@jupyter-widgets/base","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.2.0","bar_color":null,"_model_module":"@jupyter-widgets/controls"}},"24fd0e9c289f45e9a67136f5907b286b":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"a055013b60f140068189a61342485f66":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","state":{"_view_name":"StyleView","_model_name":"DescriptionStyleModel","description_width":"","_view_module":"@jupyter-widgets/base","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.2.0","_model_module":"@jupyter-widgets/controls"}},"fe90200e3eee45159f7b550b5c9437a8":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"21197126eac244b9bef1ab65dc0064f3":{"model_module":"@jupyter-widgets/controls","model_name":"HBoxModel","state":{"_view_name":"HBoxView","_dom_classes":[],"_model_name":"HBoxModel","_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.5.0","box_style":"","layout":"IPY_MODEL_21847fbdd11148589fdf8527eef33e17","_model_module":"@jupyter-widgets/controls","children":["IPY_MODEL_091b8e357ede4aa881af1f4235eab610","IPY_MODEL_f1d3da3974a840e593180fc1f61bb561"]}},"21847fbdd11148589fdf8527eef33e17":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"091b8e357ede4aa881af1f4235eab610":{"model_module":"@jupyter-widgets/controls","model_name":"FloatProgressModel","state":{"_view_name":"ProgressView","style":"IPY_MODEL_c6af285477c74d00a191966f8da5629c","_dom_classes":[],"description":"dataset.zip: 100%","_model_name":"FloatProgressModel","bar_style":"success","max":724488,"_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","value":724488,"_view_count":null,"_view_module_version":"1.5.0","orientation":"horizontal","min":0,"description_tooltip":null,"_model_module":"@jupyter-widgets/controls","layout":"IPY_MODEL_85c270b414ec420ab9c76579474a14ad"}},"f1d3da3974a840e593180fc1f61bb561":{"model_module":"@jupyter-widgets/controls","model_name":"HTMLModel","state":{"_view_name":"HTMLView","style":"IPY_MODEL_3b1ee9b28c134f1d8961df2e447d34ad","_dom_classes":[],"description":"","_model_name":"HTMLModel","placeholder":"​","_view_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","value":" 724k/724k [00:23&lt;00:00, 31.3kB/s]","_view_count":null,"_view_module_version":"1.5.0","description_tooltip":null,"_model_module":"@jupyter-widgets/controls","layout":"IPY_MODEL_f24f33335a024f75ae5a865858d1135b"}},"c6af285477c74d00a191966f8da5629c":{"model_module":"@jupyter-widgets/controls","model_name":"ProgressStyleModel","state":{"_view_name":"StyleView","_model_name":"ProgressStyleModel","description_width":"initial","_view_module":"@jupyter-widgets/base","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.2.0","bar_color":null,"_model_module":"@jupyter-widgets/controls"}},"85c270b414ec420ab9c76579474a14ad":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"3b1ee9b28c134f1d8961df2e447d34ad":{"model_module":"@jupyter-widgets/controls","model_name":"DescriptionStyleModel","state":{"_view_name":"StyleView","_model_name":"DescriptionStyleModel","description_width":"","_view_module":"@jupyter-widgets/base","_model_module_version":"1.5.0","_view_count":null,"_view_module_version":"1.2.0","_model_module":"@jupyter-widgets/controls"}},"f24f33335a024f75ae5a865858d1135b":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}},"52a537f2f4f345b9a7bf551cdf224a42":{"model_module":"@jupyter-widgets/output","model_name":"OutputModel","state":{"_view_name":"OutputView","msg_id":"","_dom_classes":[],"_model_name":"OutputModel","outputs":[{"output_type":"display_data","metadata":{"tags":[]},"text/html":"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #000080; text-decoration-color: #000080; font-weight: bold\">submission.csv</span> <span style=\"color: #729c1f; text-decoration-color: #729c1f\">━━━━━━━━━━━━━━━━━━━━</span> <span style=\"color: #800080; text-decoration-color: #800080\">100.0%</span> • <span style=\"color: #008000; text-decoration-color: #008000\">61.7/60.0 KB</span> • <span style=\"color: #800000; text-decoration-color: #800000\">396.6 kB/s</span> • <span style=\"color: #008080; text-decoration-color: #008080\">0:00:00</span>\n</pre>\n","text/plain":"<rich.jupyter.JupyterRenderable at 0x7ff274b4fe50>"}],"_view_module":"@jupyter-widgets/output","_model_module_version":"1.0.0","_view_count":null,"_view_module_version":"1.0.0","layout":"IPY_MODEL_8529e80cf70c446e8d3c20575e9f6836","_model_module":"@jupyter-widgets/output"}},"8529e80cf70c446e8d3c20575e9f6836":{"model_module":"@jupyter-widgets/base","model_name":"LayoutModel","state":{"_view_name":"LayoutView","grid_template_rows":null,"right":null,"justify_content":null,"_view_module":"@jupyter-widgets/base","overflow":null,"_model_module_version":"1.2.0","_view_count":null,"flex_flow":null,"width":null,"min_width":null,"border":null,"align_items":null,"bottom":null,"_model_module":"@jupyter-widgets/base","top":null,"grid_column":null,"overflow_y":null,"overflow_x":null,"grid_auto_flow":null,"grid_area":null,"grid_template_columns":null,"flex":null,"_model_name":"LayoutModel","justify_items":null,"grid_row":null,"max_height":null,"align_content":null,"visibility":null,"align_self":null,"height":null,"min_height":null,"padding":null,"grid_auto_rows":null,"grid_gap":null,"max_width":null,"order":null,"_view_module_version":"1.2.0","grid_template_areas":null,"object_position":null,"object_fit":null,"grid_auto_columns":null,"margin":null,"display":null,"left":null}}}}},"cells":[{"cell_type":"markdown","metadata":{"id":"ZtEKOsBu2wCX"},"source":["# Getting Started Code for Tile-Slider Challenge\n","#### Authors : \n","👾[Kanish Anand](https://www.linkedin.com/in/kanishanand/)\n","\n","🚀[Animesh Sinha](https://www.linkedin.com/in/animeshsinha1309/) \n"]},{"cell_type":"markdown","metadata":{"id":"f7ANsXJHQTJF"},"source":["# Download Necessary Packages 📚"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"svQCYLUQOcpK","executionInfo":{"status":"ok","timestamp":1614253769667,"user_tz":-330,"elapsed":10093,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}},"outputId":"84a4feee-32dc-403e-c7d5-6b38f680cd14"},"source":["! pip install git+https://gitlab.aicrowd.com/yoogottamk/aicrowd-cli.git >/dev/null\n","%load_ext aicrowd.magic"],"execution_count":1,"outputs":[{"output_type":"stream","text":[" Running command git clone -q https://gitlab.aicrowd.com/yoogottamk/aicrowd-cli.git /tmp/pip-req-build-ark7ofec\n"],"name":"stdout"}]},{"cell_type":"markdown","metadata":{"id":"hMUMGoZZ2wCd"},"source":["## Download data\n","The first step is to download out data. We will be training a classifier on the data and make predictions on data. We submit our predictions\n"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"7yBcx3nYQMk0","executionInfo":{"status":"ok","timestamp":1614253772603,"user_tz":-330,"elapsed":1412,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}},"outputId":"b7eea11f-027b-4311-d28f-c4a01c3384d9"},"source":["API_KEY = \"\" #Please enter your API Key [https://www.aicrowd.com/participants/me]\n","%aicrowd login --api-key $API_KEY"],"execution_count":2,"outputs":[{"output_type":"stream","text":["\u001b[32mAPI Key valid\u001b[0m\n","\u001b[32mSaved API Key successfully!\u001b[0m\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"ib5DKhbdQcrE","colab":{"base_uri":"https://localhost:8080/","height":217,"referenced_widgets":["125a6d325ed947a0b03b6a7e8b901d41","c8c4ff0591d34701a11f11d0a9ad9def","4b3e315799e64532b9941acea065363a","faca844ce8df4e41bc94422accf377f8","e2b201d2485d4682832120b1a87d85db","608ea7248e954088aa0d0af7ca66cd79","5e6475af9f3945a29d4f2304ea55424b","7edcccd6c4064a08b9d0e9479fb0b08e","c6d0bf4035404ad3b34df068e4c229b9","19140b7e24d846bc90c63539405d7fc3","de11dfc879f842b1a911063ea07c8ad1","61133dcfbbd449e8a70eed51e4b5b5da","225ecd0d175e46ca9035b255125f0a99","90dc739845e845d3aaeeefafa5cdff94","42de5bbdc4504341b9287410fc8b5115","bcc73ff444a244d89d4155b7b13d19fc","282207bb2ce64494a2b26d5c1e8df7dc","1ef2a77348d74d9cb9b0cc4563a34fdc","649346f61e8c46c0b201154fc7909a21","3461859613064f3abaf14638c83da304","347967a707894bf99081ca29da3145a6","24fd0e9c289f45e9a67136f5907b286b","a055013b60f140068189a61342485f66","fe90200e3eee45159f7b550b5c9437a8","21197126eac244b9bef1ab65dc0064f3","21847fbdd11148589fdf8527eef33e17","091b8e357ede4aa881af1f4235eab610","f1d3da3974a840e593180fc1f61bb561","c6af285477c74d00a191966f8da5629c","85c270b414ec420ab9c76579474a14ad","3b1ee9b28c134f1d8961df2e447d34ad","f24f33335a024f75ae5a865858d1135b"]},"executionInfo":{"status":"ok","timestamp":1614253781668,"user_tz":-330,"elapsed":8418,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}},"outputId":"a15d2dde-0813-488a-cd2a-1a796a64b1ed"},"source":["%aicrowd dataset download -c tile-slider -j 3\n","%aicrowd dataset download --challenge tile-slider -j 3"],"execution_count":3,"outputs":[{"output_type":"display_data","data":{"application/vnd.jupyter.widget-view+json":{"model_id":"125a6d325ed947a0b03b6a7e8b901d41","version_minor":0,"version_major":2},"text/plain":["HBox(children=(FloatProgress(value=0.0, description='sample_submission.csv', max=60015.0, style=ProgressStyle(…"]},"metadata":{"tags":[]}},{"output_type":"display_data","data":{"application/vnd.jupyter.widget-view+json":{"model_id":"c6d0bf4035404ad3b34df068e4c229b9","version_minor":0,"version_major":2},"text/plain":["HBox(children=(FloatProgress(value=0.0, description='dataset.zip', max=724488.0, style=ProgressStyle(descripti…"]},"metadata":{"tags":[]}},{"output_type":"stream","text":["\n","\n"],"name":"stdout"},{"output_type":"display_data","data":{"application/vnd.jupyter.widget-view+json":{"model_id":"282207bb2ce64494a2b26d5c1e8df7dc","version_minor":0,"version_major":2},"text/plain":["HBox(children=(FloatProgress(value=0.0, description='sample_submission.csv', max=60015.0, style=ProgressStyle(…"]},"metadata":{"tags":[]}},{"output_type":"display_data","data":{"application/vnd.jupyter.widget-view+json":{"model_id":"21197126eac244b9bef1ab65dc0064f3","version_minor":0,"version_major":2},"text/plain":["HBox(children=(FloatProgress(value=0.0, description='dataset.zip', max=724488.0, style=ProgressStyle(descripti…"]},"metadata":{"tags":[]}},{"output_type":"stream","text":["\n","\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"KM91aXAw2wCe","executionInfo":{"status":"ok","timestamp":1614253790855,"user_tz":-330,"elapsed":1411,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}}},"source":["! unzip -q dataset.zip"],"execution_count":4,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"U7H2PP692wCg"},"source":["\n","## Import packages"]},{"cell_type":"code","metadata":{"id":"zv0sEu7z2wCg","executionInfo":{"status":"ok","timestamp":1614253793374,"user_tz":-330,"elapsed":1078,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}}},"source":["import os\n","import random\n","import tqdm\n","import pandas as pd\n","import numpy as np"],"execution_count":5,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"Pc0brLwc2wCi"},"source":["## Load Data"]},{"cell_type":"code","metadata":{"id":"eBwUmeV92wCj","executionInfo":{"status":"ok","timestamp":1614253798116,"user_tz":-330,"elapsed":1376,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}}},"source":["DATA_PATH = \"dataset/\" #path where data is stored"],"execution_count":6,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"NMtGgNBv2wCo"},"source":["## Visualize the data 👀"]},{"cell_type":"code","metadata":{"id":"mEKcS2Lr2wCp","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1614253800979,"user_tz":-330,"elapsed":1103,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}},"outputId":"924395cc-6911-4ec5-bc0d-a480e9619d87"},"source":["file = open(os.path.join(DATA_PATH,os.listdir(DATA_PATH)[0]), \"r\")\n","print(file.read())"],"execution_count":7,"outputs":[{"output_type":"stream","text":["40 40\n","#.#...#..#.....##...#.....##..#......###\n",".#.#...#..###..#.#..#.......#....#.#..#.\n","#......##.....##......##........#..##..#\n","##........#.#..#.#...#....#.##.....#....\n",".......#.#..#..###...#....#.####.#.....#\n","#...#.......#..#.#.##.#...#.#........#..\n","#...##.#.#.#...#.....#..#.##.#...#..#.##\n",".#.#......###...#.....#.###...#..#.....#\n",".#...............#....##.....#........##\n",".#...#......#..#.#.##....#..#...#.#...#.\n","..#....##....####...#.###......##.#..#.#\n","#...#.#.##.#....#..#...#.#.#..#...#.##.#\n","..#.#..#....###.##.###...............##.\n","..#........#....#.....#......#.#.......#\n","#..###.##..#...#..#..#..#..#..#....#.#.#\n","..#.........##....#..#..#....#....#....#\n","#...#....##.##.#..#....#..###......#.#.#\n",".#...#.......#..#..#.#.##.#...#...#.#.#.\n",".#..##....#.........#..#........#....##.\n","..............#.#....#.##...........##..\n",".##....#........##..#.#..#..##..#.......\n","#....###..#.#....##.......#..#..###.....\n",".#......#..##..........##....##....##...\n","...###...#.##.....#.#...###......#....#.\n","#.....##.##.#.....#....#.#..##...#...##.\n","#...##.....#...#..#.###...##..#..#....##\n","..#.......#..##...##...#..........#.....\n","..#...#....####.#.....#...#.####....#...\n",".....##..#..###...###...#..#.....#..##..\n",".#.#..............#.#.##..#...#.#.#....#\n",".......#.....#..#..##...#...#.....##...#\n","##...#...#.###....##.#...#.###.......#.#\n","..#.#.###..#.........####.#....#.....#..\n",".........#.##.#....#.#.#...#...#....#...\n","#.#....#.....##...#...##.##.###.#...#...\n","....##..............##..####.#.##....#.#\n","#........##...................##........\n","##..##..#.##..#......##.##.#.#.#..#..###\n",".#..#...#.#....#..#.#.......##.#....#.##\n","..#.#...........##...#............#..#.#\n","5\n","8 35 9 37\n","39 12 33 0\n","0 14 0 10\n","33 6 39 18\n","16 20 19 17\n","\n"],"name":"stdout"}]},{"cell_type":"markdown","metadata":{"id":"quSVK2i5wHDj"},"source":["# Helper Functions\n","Below class provides helper functions to load grid from given text files and make moves in the grid."]},{"cell_type":"code","metadata":{"id":"VX9Vu9SUwG22","executionInfo":{"status":"ok","timestamp":1614253804367,"user_tz":-330,"elapsed":1417,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}}},"source":["class GridState:\n"," def __init__(self, input_file):\n"," self.UP = (-1, 0)\n"," self.DOWN = (1, 0)\n"," self.LEFT = (0, -1)\n"," self.RIGHT = (0, 1)\n"," self.load(input_file)\n","\n"," def load(self, input_file):\n"," file = open(input_file, 'r')\n"," # Get the Grid\n"," self.n, self.m = list(map(int, file.readline().strip().split()))\n"," self.grid = np.array(\n"," [[cell == \".\" for cell in file.readline().strip()] for _ in range(self.n)])\n"," k = int(file.readline().strip())\n"," self.tiles, self.targets = [], []\n"," for _ in range(k):\n"," line = list(map(int, file.readline().strip().split()))\n"," self.tiles.append((line[0], line[1]))\n"," self.targets.append((line[2], line[3]))\n"," file.close()\n","\n"," def move_value(self, direction):\n"," if direction == 'U':\n"," return self.UP\n"," elif direction == 'D':\n"," return self.DOWN\n"," elif direction == 'L':\n"," return self.LEFT\n"," elif direction == 'R':\n"," return self.RIGHT\n","\n"," def move(self, move):\n"," delta_r, delta_c = self.move_value(move)\n"," flag = 0\n"," for _ in range(max(self.n, self.m) + 1):\n"," for idx, tile in enumerate(self.tiles):\n"," next_r, next_c = tile[0] + delta_r, tile[1] + delta_c\n"," if 0 <= next_r < self.n and 0 <= next_c < self.m and \\\n"," self.grid[next_r, next_c] and (next_r, next_c) not in self.tiles:\n"," flag = 1\n"," tile = tile[0] + delta_r, tile[1] + delta_c\n"," self.tiles[idx] = tile\n"," # no change in any tile\n"," if flag == 0:\n"," break"],"execution_count":8,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"QQp1N8J5mgne"},"source":["# TRAINING PHASE 🏋️"]},{"cell_type":"markdown","metadata":{"id":"yeedW4GrevP5"},"source":["Here we are applying a random set of moves for each given grid and checking if that set of moves solves puzzle or not."]},{"cell_type":"code","metadata":{"id":"I6b1ND1B5Xb6","executionInfo":{"status":"ok","timestamp":1614253811612,"user_tz":-330,"elapsed":1373,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}}},"source":["def create_random_moves(moves_length):\n"," seq = ['U', 'D', 'L', 'R']\n"," moves = ''.join(random.choices(seq, k=moves_length))\n"," return moves"],"execution_count":9,"outputs":[]},{"cell_type":"code","metadata":{"id":"sBzylNUPz2Ba","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1614253820852,"user_tz":-330,"elapsed":9852,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}},"outputId":"8841a1cc-d094-4503-f34d-6edf8326340c"},"source":["solved = 0\n","moves_length = 20\n","lst = sorted(os.listdir(DATA_PATH))\n","total = len(lst)\n","df = pd.DataFrame(columns = {'filename', 'moves'})\n","\n","for file in tqdm.tqdm(lst):\n"," path = os.path.join(DATA_PATH, file)\n"," obj = GridState(path)\n"," moves = create_random_moves(moves_length)\n"," for direction in moves:\n"," obj.move(direction)\n"," if obj.tiles == obj.targets:\n"," # print(obj.tiles, obj.targets)\n"," solved += 1\n"," # print(\"Puzzle Solved\")\n"," break\n"," df = df.append({'filename':file, 'moves': moves}, ignore_index = True)"],"execution_count":10,"outputs":[{"output_type":"stream","text":["100%|██████████| 2000/2000 [00:08<00:00, 234.71it/s]\n"],"name":"stderr"}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":198},"id":"IKD5oqeZ1tkM","executionInfo":{"status":"ok","timestamp":1614253820853,"user_tz":-330,"elapsed":5635,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}},"outputId":"4ec58854-6950-4ad3-8af6-811062d22267"},"source":["df.head()"],"execution_count":11,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n"," .dataframe tbody tr th:only-of-type {\n"," vertical-align: middle;\n"," }\n","\n"," .dataframe tbody tr th {\n"," vertical-align: top;\n"," }\n","\n"," .dataframe thead th {\n"," text-align: right;\n"," }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n"," <thead>\n"," <tr style=\"text-align: right;\">\n"," <th></th>\n"," <th>moves</th>\n"," <th>filename</th>\n"," </tr>\n"," </thead>\n"," <tbody>\n"," <tr>\n"," <th>0</th>\n"," <td>RDDRRLRRDDDDRUUDURRR</td>\n"," <td>0001.txt</td>\n"," </tr>\n"," <tr>\n"," <th>1</th>\n"," <td>LULRRDDLRRDLLLULRURR</td>\n"," <td>0002.txt</td>\n"," </tr>\n"," <tr>\n"," <th>2</th>\n"," <td>LRDDURRULRUDLLRRLRDU</td>\n"," <td>0003.txt</td>\n"," </tr>\n"," <tr>\n"," <th>3</th>\n"," <td>DUURDLDDDDDLRUURLUUR</td>\n"," <td>0004.txt</td>\n"," </tr>\n"," <tr>\n"," <th>4</th>\n"," <td>RURDLULLUURUUUUDDRUU</td>\n"," <td>0005.txt</td>\n"," </tr>\n"," </tbody>\n","</table>\n","</div>"],"text/plain":[" moves filename\n","0 RDDRRLRRDDDDRUUDURRR 0001.txt\n","1 LULRRDDLRRDLLLULRURR 0002.txt\n","2 LRDDURRULRUDLLRRLRDU 0003.txt\n","3 DUURDLDDDDDLRUURLUUR 0004.txt\n","4 RURDLULLUURUUUUDDRUU 0005.txt"]},"metadata":{"tags":[]},"execution_count":11}]},{"cell_type":"markdown","metadata":{"id":"5z-zEWhz2wC8"},"source":["## Evaluate the Performance"]},{"cell_type":"code","metadata":{"id":"7My62Dvw2wC-","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1614253825627,"user_tz":-330,"elapsed":1447,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}},"outputId":"9912967c-5ab8-4942-bc62-c3c270dbf0ee"},"source":["print(\"Number of puzzles solved is :\" ,solved)\n","print(\"Percentage of puzzles solved :\" , (solved/total)*100)"],"execution_count":12,"outputs":[{"output_type":"stream","text":["Number of puzzles solved is : 34\n","Percentage of puzzles solved : 1.7000000000000002\n"],"name":"stdout"}]},{"cell_type":"markdown","metadata":{"id":"CzNzVf_p2wDI"},"source":["## Save the prediction to csv"]},{"cell_type":"code","metadata":{"id":"xkYnHOAh2wDL","executionInfo":{"status":"ok","timestamp":1614253832426,"user_tz":-330,"elapsed":1391,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}}},"source":["submission = pd.DataFrame(df)\n","submission.to_csv('submission.csv',index=False)"],"execution_count":13,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"VlYQsWiX2wDM"},"source":["🚧 Note : \n","- Do take a look at the submission format. \n","- The submission file should contain a header. \n","- Follow all submission guidelines strictly to avoid inconvenience."]},{"cell_type":"markdown","metadata":{"id":"-dHkb4QE2wDP"},"source":["### Well Done! 👍 We are all set to make a submission and see your name on leaderborad. "]},{"cell_type":"code","metadata":{"id":"OKNgJfyHzcTd","colab":{"base_uri":"https://localhost:8080/","height":325,"referenced_widgets":["52a537f2f4f345b9a7bf551cdf224a42","8529e80cf70c446e8d3c20575e9f6836"]},"executionInfo":{"status":"ok","timestamp":1614253836709,"user_tz":-330,"elapsed":3437,"user":{"displayName":"Kanish Anand","photoUrl":"","userId":"02302143370643625965"}},"outputId":"dd753683-578d-453f-887a-443d0fe11744"},"source":["%aicrowd submission create -c tile-slider -f submission.csv"],"execution_count":14,"outputs":[{"output_type":"display_data","data":{"application/vnd.jupyter.widget-view+json":{"model_id":"52a537f2f4f345b9a7bf551cdf224a42","version_minor":0,"version_major":2},"text/plain":["Output()"]},"metadata":{"tags":[]}},{"output_type":"stream","text":[" ╭─────────────────────────╮ \n"," │ Successfully submitted! │ \n"," ╰─────────────────────────╯ \n"," Important links \n","┌──────────────────┬────────────────────────────────────────────────────────────────────────────────────┐\n","│ This submission │ https://www.aicrowd.com/challenges/ml-battleground/submissions/123258 │\n","│ │ │\n","│ All submissions │ https://www.aicrowd.com/challenges/ml-battleground/submissions?my_submissions=true │\n","│ │ │\n","│ Leaderboard │ https://www.aicrowd.com/challenges/ml-battleground/leaderboards │\n","│ │ │\n","│ Discussion forum │ https://discourse.aicrowd.com/c/ml-battleground │\n","│ │ │\n","│ Challenge page │ https://www.aicrowd.com/challenges/ml-battleground │\n","└──────────────────┴────────────────────────────────────────────────────────────────────────────────────┘\n","{'submission_id': 123258, 'created_at': '2021-02-25T11:51:34.527Z'}\n"],"name":"stdout"}]}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment