{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport jo_wilder_310\nimport pickle\nenv = jo_wilder_310.make_env()\nimport pandas as pd\niter_test = env.iter_test()    \nlimits = {'0-4':[1,3], '5-12':[4,5,6,7,8,9,10,11], '13-22':[14,15,16,17]}\nlset={'0-4': {('tunic.historicalsociety.entry', 1): 0, ('tunic.kohlcenter.halloffame', 3): 1, ('tunic.historicalsociety.basement', 2): 2, ('tunic.historicalsociety.stacks', 2): 3, ('tunic.historicalsociety.closet', 3): 4, ('tunic.kohlcenter.halloffame', 4): 5, ('tunic.historicalsociety.closet', 2): 6, ('tunic.historicalsociety.closet', 1): 7, ('tunic.historicalsociety.collection', 2): 8, ('tunic.historicalsociety.closet', 0): 9, ('tunic.capitol_0.hall', 4): 10, ('tunic.historicalsociety.collection', 3): 11, ('tunic.historicalsociety.basement', 1): 12, ('tunic.historicalsociety.entry', 3): 13, ('tunic.historicalsociety.basement', 3): 14, ('tunic.historicalsociety.entry', 2): 15, ('tunic.historicalsociety.stacks', 3): 16, 'logbook': 17, 'tomicrofiche': 18, 'businesscards.card_1.next': 19, 'groupconvo_flag': 20, 'flag_girl': 21, 'block_1': 22, 'journals_flag.pic_0.next': 23, 'reader_flag': 24, 'journals_flag.hub.topics_old': 25, 'journals_flag.pic_2.bingo': 26, 'tocage': 27, 'tofrontdesk': 28, 'tomap': 29, 'tohallway': 30, 'block_badge_2': 31, 'tostacks': 32, 'journals.pic_1.next': 33, 'togrampa': 34, 'retirement_letter': 35, 'tunic.capitol_1': 36, 'reader_flag.paper0.next': 37, 'block_tocollection': 38, 'ch3start': 39, 'chap2_finale': 40, 'crane_ranger': 41, 'janitor': 42, 'notebook': 43, 'report': 44, 'reader.paper0.next': 45, 'coffee': 46, 'tunic.historicalsociety': 47, 'toentry': 48, 'colorbook': 49, 'directory': 50, 'directory.closeup.archivist': 51, 'tracks.hub.deer': 52, 'reader_flag.paper2.prev': 53, 'reader_flag.paper2.bingo': 54, 'boss': 55, 'lockeddoor': 56, 'journals': 57, 'need_glasses': 58, 'businesscards.card_bingo.next': 59, 'gramps': 60, 'tunic.kohlcenter': 61, 'fox': 62, 'journals_flag': 63, 'tunic.capitol_0': 64, 'trigger_coffee': 65, 'groupconvo': 66, 'journals_flag.pic_1.next': 67, 'journals.pic_2.next': 68, 'journals_flag.pic_0.bingo': 69, 'journals_flag.hub.topics': 70, 'block_badge': 71, 'tocollectionflag': 72, 'tunic.hub.slip': 73, 'archivist_glasses': 74, 'logbook.page.bingo': 75, 'photo': 76, 'journals_flag.pic_1.bingo': 77, 'tracks': 78, 'reader.paper2.prev': 79, 'tocloset': 80, 'intro': 81, 'reader.paper1.next': 82, 'confrontation': 83, 'journals_flag.pic_2.next': 84, 'tocollection': 85, 'cs': 86, 'journals_flag.pic_2_old.next': 87, 'remove_cup': 88, 'savedteddy': 89, 'block_magnify': 90, 'reader.paper2.bingo': 91, 'block_tomap2': 92, 'journals.pic_2.bingo': 93, 'chap2_finale_c': 94, 'outtolunch': 95, 'wellsbadge': 96, 'teddy': 97, 'journals_flag.pic_1_old.next': 98, 'chap1_finale_c': 99, 'reader.paper0.prev': 100, 'journals.pic_0.next': 101, 'plaque': 102, 'tunic.capitol_2': 103, 'key': 104, 'seescratches': 105, 'reader': 106, 'wells': 107, 'journals_flag.pic_0_old.next': 108, 'tunic.flaghouse': 109, 'block_tomap1': 110, 'doorblock': 111, 'what_happened': 112, 'unlockdoor': 113, 'businesscards.card_bingo.bingo': 114, 'reader_flag.paper1.next': 115, 'archivist': 116, 'door_block_talk': 117, 'tunic': 118, 'chap1_finale': 119, 'block_nelson': 120, 'reader.paper1.prev': 121, 'tocloset_dirty': 122, 'tunic.library': 123, 'glasses': 124, 'expert': 125, 'chap4_finale_c': 126, 'plaque.face.date': 127, 'reader_flag.paper2.next': 128, 'reader_flag.paper1.prev': 129, 'reader.paper2.next': 130, 'block_0': 131, 'reader_flag.paper0.prev': 132, 'businesscards': 133, 'tunic.drycleaner': 134, 'magnify': 135, 'worker': 136, 'journals.hub.topics': 137, 'businesscards.card_0.next': 138, 'door_block_clean': 139, 'tunic.wildlife': 140, 'tobasement': 141, 'trigger_scarf': 142, 'tunic.humanecology': 143, 'block': 144}, '5-12': {('tunic.historicalsociety.basement', 5): 0, ('tunic.capitol_1.hall', 7): 1, ('tunic.historicalsociety.collection', 9): 2, ('tunic.historicalsociety.stacks', 5): 3, ('tunic.historicalsociety.stacks', 12): 4, ('tunic.humanecology.frontdesk', 8): 5, ('tunic.library.frontdesk', 12): 6, ('tunic.historicalsociety.entry', 7): 7, ('tunic.capitol_1.hall', 11): 8, ('tunic.historicalsociety.frontdesk', 6): 9, ('tunic.historicalsociety.collection', 5): 10, ('tunic.library.microfiche', 10): 11, ('tunic.kohlcenter.halloffame', 6): 12, ('tunic.historicalsociety.collection', 12): 13, ('tunic.capitol_0.hall', 5): 14, ('tunic.historicalsociety.closet_dirty', 7): 15, ('tunic.library.frontdesk', 9): 16, ('tunic.historicalsociety.frontdesk', 11): 17, ('tunic.capitol_1.hall', 6): 18, ('tunic.historicalsociety.collection', 8): 19, ('tunic.historicalsociety.basement', 11): 20, ('tunic.historicalsociety.closet_dirty', 11): 21, ('tunic.historicalsociety.stacks', 11): 22, ('tunic.historicalsociety.basement', 6): 23, ('tunic.historicalsociety.frontdesk', 7): 24, ('tunic.kohlcenter.halloffame', 7): 25, ('tunic.historicalsociety.frontdesk', 12): 26, ('tunic.historicalsociety.entry', 11): 27, ('tunic.humanecology.frontdesk', 11): 28, ('tunic.drycleaner.frontdesk', 9): 29, ('tunic.library.frontdesk', 10): 30, ('tunic.library.microfiche', 9): 31, ('tunic.kohlcenter.halloffame', 11): 32, ('tunic.historicalsociety.collection', 11): 33, ('tunic.historicalsociety.frontdesk', 8): 34, ('tunic.humanecology.frontdesk', 7): 35, ('tunic.historicalsociety.basement', 8): 36, ('tunic.historicalsociety.basement', 7): 37, ('tunic.capitol_1.hall', 9): 38, ('tunic.historicalsociety.collection', 7): 39, ('tunic.historicalsociety.stacks', 7): 40, ('tunic.library.microfiche', 12): 41, ('tunic.historicalsociety.basement', 12): 42, ('tunic.historicalsociety.entry', 12): 43, ('tunic.historicalsociety.closet_dirty', 8): 44, ('tunic.drycleaner.frontdesk', 8): 45, ('tunic.historicalsociety.entry', 5): 46, ('tunic.library.frontdesk', 11): 47, ('tunic.kohlcenter.halloffame', 8): 48, ('tunic.historicalsociety.frontdesk', 9): 49, ('tunic.historicalsociety.closet_dirty', 12): 50, ('tunic.historicalsociety.entry', 8): 51, ('tunic.historicalsociety.basement', 9): 52, ('tunic.historicalsociety.closet_dirty', 5): 53, ('tunic.drycleaner.frontdesk', 12): 54, ('tunic.historicalsociety.stacks', 9): 55, ('tunic.historicalsociety.stacks', 8): 56, ('tunic.kohlcenter.halloffame', 12): 57, ('tunic.historicalsociety.collection', 6): 58, ('tunic.capitol_1.hall', 8): 59, ('tunic.historicalsociety.stacks', 6): 60, ('tunic.kohlcenter.halloffame', 5): 61, ('tunic.historicalsociety.closet_dirty', 9): 62, ('tunic.humanecology.frontdesk', 9): 63, ('tunic.historicalsociety.entry', 6): 64, ('tunic.capitol_1.hall', 12): 65, ('tunic.drycleaner.frontdesk', 11): 66, ('tunic.library.microfiche', 11): 67, ('tunic.kohlcenter.halloffame', 9): 68, ('tunic.historicalsociety.entry', 9): 69, ('tunic.historicalsociety.closet_dirty', 6): 70, ('tunic.humanecology.frontdesk', 12): 71, 'logbook': 72, 'tomicrofiche': 73, 'businesscards.card_1.next': 74, 'groupconvo_flag': 75, 'flag_girl': 76, 'block_1': 77, 'journals_flag.pic_0.next': 78, 'reader_flag': 79, 'journals_flag.hub.topics_old': 80, 'journals_flag.pic_2.bingo': 81, 'tocage': 82, 'tofrontdesk': 83, 'tomap': 84, 'tohallway': 85, 'block_badge_2': 86, 'tostacks': 87, 'journals.pic_1.next': 88, 'togrampa': 89, 'retirement_letter': 90, 'tunic.capitol_1': 91, 'reader_flag.paper0.next': 92, 'block_tocollection': 93, 'ch3start': 94, 'chap2_finale': 95, 'crane_ranger': 96, 'janitor': 97, 'notebook': 98, 'report': 99, 'reader.paper0.next': 100, 'coffee': 101, 'tunic.historicalsociety': 102, 'toentry': 103, 'colorbook': 104, 'directory': 105, 'directory.closeup.archivist': 106, 'tracks.hub.deer': 107, 'reader_flag.paper2.prev': 108, 'reader_flag.paper2.bingo': 109, 'boss': 110, 'lockeddoor': 111, 'journals': 112, 'need_glasses': 113, 'businesscards.card_bingo.next': 114, 'gramps': 115, 'tunic.kohlcenter': 116, 'fox': 117, 'journals_flag': 118, 'tunic.capitol_0': 119, 'trigger_coffee': 120, 'groupconvo': 121, 'journals_flag.pic_1.next': 122, 'journals.pic_2.next': 123, 'journals_flag.pic_0.bingo': 124, 'journals_flag.hub.topics': 125, 'block_badge': 126, 'tocollectionflag': 127, 'tunic.hub.slip': 128, 'archivist_glasses': 129, 'logbook.page.bingo': 130, 'photo': 131, 'journals_flag.pic_1.bingo': 132, 'tracks': 133, 'reader.paper2.prev': 134, 'tocloset': 135, 'intro': 136, 'reader.paper1.next': 137, 'confrontation': 138, 'journals_flag.pic_2.next': 139, 'tocollection': 140, 'cs': 141, 'journals_flag.pic_2_old.next': 142, 'remove_cup': 143, 'savedteddy': 144, 'block_magnify': 145, 'reader.paper2.bingo': 146, 'block_tomap2': 147, 'journals.pic_2.bingo': 148, 'chap2_finale_c': 149, 'outtolunch': 150, 'wellsbadge': 151, 'teddy': 152, 'journals_flag.pic_1_old.next': 153, 'chap1_finale_c': 154, 'reader.paper0.prev': 155, 'journals.pic_0.next': 156, 'plaque': 157, 'tunic.capitol_2': 158, 'key': 159, 'seescratches': 160, 'reader': 161, 'wells': 162, 'journals_flag.pic_0_old.next': 163, 'tunic.flaghouse': 164, 'block_tomap1': 165, 'doorblock': 166, 'what_happened': 167, 'unlockdoor': 168, 'businesscards.card_bingo.bingo': 169, 'reader_flag.paper1.next': 170, 'archivist': 171, 'door_block_talk': 172, 'tunic': 173, 'chap1_finale': 174, 'block_nelson': 175, 'reader.paper1.prev': 176, 'tocloset_dirty': 177, 'tunic.library': 178, 'glasses': 179, 'expert': 180, 'chap4_finale_c': 181, 'plaque.face.date': 182, 'reader_flag.paper2.next': 183, 'reader_flag.paper1.prev': 184, 'reader.paper2.next': 185, 'block_0': 186, 'reader_flag.paper0.prev': 187, 'businesscards': 188, 'tunic.drycleaner': 189, 'magnify': 190, 'worker': 191, 'journals.hub.topics': 192, 'businesscards.card_0.next': 193, 'door_block_clean': 194, 'tunic.wildlife': 195, 'tobasement': 196, 'trigger_scarf': 197, 'tunic.humanecology': 198, 'block': 199}, '13-22': {('tunic.historicalsociety.entry', 16): 0, ('tunic.historicalsociety.basement', 20): 1, ('tunic.kohlcenter.halloffame', 21): 2, ('tunic.drycleaner.frontdesk', 17): 3, ('tunic.historicalsociety.cage', 21): 4, ('tunic.historicalsociety.frontdesk', 16): 5, ('tunic.library.frontdesk', 13): 6, ('tunic.historicalsociety.stacks', 17): 7, ('tunic.humanecology.frontdesk', 21): 8, ('tunic.historicalsociety.basement', 15): 9, ('tunic.library.microfiche', 22): 10, ('tunic.historicalsociety.closet_dirty', 18): 11, ('tunic.kohlcenter.halloffame', 22): 12, ('tunic.humanecology.frontdesk', 14): 13, ('tunic.historicalsociety.cage', 16): 14, ('tunic.drycleaner.frontdesk', 20): 15, ('tunic.library.frontdesk', 18): 16, ('tunic.historicalsociety.stacks', 20): 17, ('tunic.humanecology.frontdesk', 16): 18, ('tunic.capitol_2.hall', 17): 19, ('tunic.capitol_2.hall', 14): 20, ('tunic.library.microfiche', 21): 21, ('tunic.historicalsociety.entry', 13): 22, ('tunic.historicalsociety.stacks', 13): 23, ('tunic.historicalsociety.cage', 15): 24, ('tunic.wildlife.center', 19): 25, ('tunic.historicalsociety.frontdesk', 14): 26, ('tunic.humanecology.frontdesk', 19): 27, ('tunic.historicalsociety.collection_flag', 16): 28, ('tunic.capitol_2.hall', 20): 29, ('tunic.historicalsociety.entry', 20): 30, ('tunic.historicalsociety.basement', 16): 31, ('tunic.kohlcenter.halloffame', 17): 32, ('tunic.library.microfiche', 16): 33, ('tunic.historicalsociety.closet_dirty', 20): 34, ('tunic.historicalsociety.frontdesk', 20): 35, ('tunic.drycleaner.frontdesk', 14): 36, ('tunic.wildlife.center', 20): 37, ('tunic.historicalsociety.collection_flag', 14): 38, ('tunic.library.frontdesk', 20): 39, ('tunic.flaghouse.entry', 22): 40, ('tunic.historicalsociety.entry', 17): 41, ('tunic.historicalsociety.basement', 21): 42, ('tunic.kohlcenter.halloffame', 18): 43, ('tunic.historicalsociety.cage', 20): 44, ('tunic.drycleaner.frontdesk', 16): 45, ('tunic.historicalsociety.frontdesk', 17): 46, ('tunic.drycleaner.frontdesk', 13): 47, ('tunic.library.frontdesk', 14): 48, ('tunic.historicalsociety.stacks', 16): 49, ('tunic.humanecology.frontdesk', 20): 50, ('tunic.flaghouse.entry', 21): 51, ('tunic.historicalsociety.basement', 22): 52, ('tunic.historicalsociety.closet_dirty', 19): 53, ('tunic.humanecology.frontdesk', 13): 54, ('tunic.historicalsociety.cage', 19): 55, ('tunic.library.microfiche', 15): 56, ('tunic.historicalsociety.frontdesk', 18): 57, ('tunic.library.frontdesk', 19): 58, ('tunic.historicalsociety.stacks', 19): 59, ('tunic.historicalsociety.collection_flag', 20): 60, ('tunic.capitol_2.hall', 16): 61, ('tunic.capitol_2.hall', 13): 62, ('tunic.kohlcenter.halloffame', 13): 63, ('tunic.library.microfiche', 20): 64, ('tunic.historicalsociety.closet_dirty', 16): 65, ('tunic.historicalsociety.entry', 14): 66, ('tunic.historicalsociety.cage', 14): 67, ('tunic.historicalsociety.frontdesk', 15): 68, ('tunic.historicalsociety.closet_dirty', 14): 69, ('tunic.library.frontdesk', 16): 70, ('tunic.historicalsociety.stacks', 22): 71, ('tunic.humanecology.frontdesk', 18): 72, ('tunic.historicalsociety.collection_flag', 17): 73, ('tunic.capitol_2.hall', 19): 74, ('tunic.historicalsociety.entry', 21): 75, ('tunic.historicalsociety.basement', 17): 76, ('tunic.kohlcenter.halloffame', 14): 77, ('tunic.library.microfiche', 19): 78, ('tunic.historicalsociety.closet_dirty', 21): 79, ('tunic.historicalsociety.stacks', 15): 80, ('tunic.historicalsociety.frontdesk', 21): 81, ('tunic.wildlife.center', 21): 82, ('tunic.historicalsociety.collection_flag', 15): 83, ('tunic.library.frontdesk', 21): 84, ('tunic.historicalsociety.collection_flag', 18): 85, ('tunic.capitol_2.hall', 22): 86, ('tunic.historicalsociety.entry', 18): 87, ('tunic.historicalsociety.collection', 14): 88, ('tunic.historicalsociety.basement', 18): 89, ('tunic.kohlcenter.halloffame', 19): 90, ('tunic.drycleaner.frontdesk', 19): 91, ('tunic.historicalsociety.frontdesk', 22): 92, ('tunic.library.frontdesk', 15): 93, ('tunic.wildlife.center', 22): 94, ('tunic.historicalsociety.basement', 13): 95, ('tunic.flaghouse.entry', 20): 96, ('tunic.historicalsociety.collection', 13): 97, ('tunic.kohlcenter.halloffame', 20): 98, ('tunic.historicalsociety.cage', 18): 99, ('tunic.drycleaner.frontdesk', 22): 100, ('tunic.library.microfiche', 14): 101, ('tunic.historicalsociety.frontdesk', 19): 102, ('tunic.historicalsociety.stacks', 18): 103, ('tunic.humanecology.frontdesk', 22): 104, ('tunic.historicalsociety.collection_flag', 21): 105, ('tunic.historicalsociety.basement', 14): 106, ('tunic.flaghouse.entry', 19): 107, ('tunic.historicalsociety.closet_dirty', 17): 108, ('tunic.historicalsociety.entry', 15): 109, ('tunic.humanecology.frontdesk', 15): 110, ('tunic.historicalsociety.cage', 17): 111, ('tunic.drycleaner.frontdesk', 21): 112, ('tunic.library.microfiche', 13): 113, ('tunic.historicalsociety.closet_dirty', 15): 114, ('tunic.library.frontdesk', 17): 115, ('tunic.historicalsociety.stacks', 21): 116, ('tunic.humanecology.frontdesk', 17): 117, ('tunic.historicalsociety.collection_flag', 22): 118, ('tunic.capitol_2.hall', 18): 119, ('tunic.historicalsociety.entry', 22): 120, ('tunic.capitol_2.hall', 15): 121, ('tunic.kohlcenter.halloffame', 15): 122, ('tunic.library.microfiche', 18): 123, ('tunic.historicalsociety.closet_dirty', 22): 124, ('tunic.historicalsociety.stacks', 14): 125, ('tunic.capitol_1.hall', 13): 126, ('tunic.wildlife.center', 18): 127, ('tunic.library.frontdesk', 22): 128, ('tunic.historicalsociety.collection_flag', 19): 129, ('tunic.capitol_2.hall', 21): 130, ('tunic.historicalsociety.entry', 19): 131, ('tunic.historicalsociety.basement', 19): 132, ('tunic.kohlcenter.halloffame', 16): 133, ('tunic.library.microfiche', 17): 134, ('tunic.drycleaner.frontdesk', 18): 135, ('tunic.historicalsociety.cage', 22): 136, ('tunic.drycleaner.frontdesk', 15): 137, 'logbook': 138, 'tomicrofiche': 139, 'businesscards.card_1.next': 140, 'groupconvo_flag': 141, 'flag_girl': 142, 'block_1': 143, 'journals_flag.pic_0.next': 144, 'reader_flag': 145, 'journals_flag.hub.topics_old': 146, 'journals_flag.pic_2.bingo': 147, 'tocage': 148, 'tofrontdesk': 149, 'tomap': 150, 'tohallway': 151, 'block_badge_2': 152, 'tostacks': 153, 'journals.pic_1.next': 154, 'togrampa': 155, 'retirement_letter': 156, 'tunic.capitol_1': 157, 'reader_flag.paper0.next': 158, 'block_tocollection': 159, 'ch3start': 160, 'chap2_finale': 161, 'crane_ranger': 162, 'janitor': 163, 'notebook': 164, 'report': 165, 'reader.paper0.next': 166, 'coffee': 167, 'tunic.historicalsociety': 168, 'toentry': 169, 'colorbook': 170, 'directory': 171, 'directory.closeup.archivist': 172, 'tracks.hub.deer': 173, 'reader_flag.paper2.prev': 174, 'reader_flag.paper2.bingo': 175, 'boss': 176, 'lockeddoor': 177, 'journals': 178, 'need_glasses': 179, 'businesscards.card_bingo.next': 180, 'gramps': 181, 'tunic.kohlcenter': 182, 'fox': 183, 'journals_flag': 184, 'tunic.capitol_0': 185, 'trigger_coffee': 186, 'groupconvo': 187, 'journals_flag.pic_1.next': 188, 'journals.pic_2.next': 189, 'journals_flag.pic_0.bingo': 190, 'journals_flag.hub.topics': 191, 'block_badge': 192, 'tocollectionflag': 193, 'tunic.hub.slip': 194, 'archivist_glasses': 195, 'logbook.page.bingo': 196, 'photo': 197, 'journals_flag.pic_1.bingo': 198, 'tracks': 199, 'reader.paper2.prev': 200, 'tocloset': 201, 'intro': 202, 'reader.paper1.next': 203, 'confrontation': 204, 'journals_flag.pic_2.next': 205, 'tocollection': 206, 'cs': 207, 'journals_flag.pic_2_old.next': 208, 'remove_cup': 209, 'savedteddy': 210, 'block_magnify': 211, 'reader.paper2.bingo': 212, 'block_tomap2': 213, 'journals.pic_2.bingo': 214, 'chap2_finale_c': 215, 'outtolunch': 216, 'wellsbadge': 217, 'teddy': 218, 'journals_flag.pic_1_old.next': 219, 'chap1_finale_c': 220, 'reader.paper0.prev': 221, 'journals.pic_0.next': 222, 'plaque': 223, 'tunic.capitol_2': 224, 'key': 225, 'seescratches': 226, 'reader': 227, 'wells': 228, 'journals_flag.pic_0_old.next': 229, 'tunic.flaghouse': 230, 'block_tomap1': 231, 'doorblock': 232, 'what_happened': 233, 'unlockdoor': 234, 'businesscards.card_bingo.bingo': 235, 'reader_flag.paper1.next': 236, 'archivist': 237, 'door_block_talk': 238, 'tunic': 239, 'chap1_finale': 240, 'block_nelson': 241, 'reader.paper1.prev': 242, 'tocloset_dirty': 243, 'tunic.library': 244, 'glasses': 245, 'expert': 246, 'chap4_finale_c': 247, 'plaque.face.date': 248, 'reader_flag.paper2.next': 249, 'reader_flag.paper1.prev': 250, 'reader.paper2.next': 251, 'block_0': 252, 'reader_flag.paper0.prev': 253, 'businesscards': 254, 'tunic.drycleaner': 255, 'magnify': 256, 'worker': 257, 'journals.hub.topics': 258, 'businesscards.card_0.next': 259, 'door_block_clean': 260, 'tunic.wildlife': 261, 'tobasement': 262, 'trigger_scarf': 263, 'tunic.humanecology': 264, 'block': 265}}\nlens={'0-4':145,'5-12':200,'13-22':266}\nlgb_model=[]\nfor i in range(1,19):\n    with open(f'/kaggle/input/lgbmodels2/gridsearch_model{i}.pkl', 'rb') as file:\n        lgb_model.append(pickle.load(file))\nlgbmodel=[]\nfor i in range(1,19):\n    with open(f'/kaggle/input/catlgb/gridlgbmodel{i}.pkl', 'rb') as file:\n        lgbmodel.append(pickle.load(file))\nimport multiprocessing\n#type(env)._state = type(type(env)._state).__dict__['INIT']\nlengs={'0-4':17,'5-12':72,'13-22':138}\nweights={1: 0.84, 3: 0.0, 4: 0.21, 5: 0.37, 6: 0.66, 7: 0.5, 8: 0.71, 9: 0.71, 10: 0.79, 11: 0.65, 14: 0.93, 15: 0.59, 16: 0.49, 17: 0.64}\n\nm={'0-4': [('tunic.historicalsociety.entry', 1), ('tunic.kohlcenter.halloffame', 3), ('tunic.historicalsociety.basement', 2), ('tunic.historicalsociety.stacks', 2), ('tunic.historicalsociety.closet', 3), ('tunic.kohlcenter.halloffame', 4), ('tunic.historicalsociety.closet', 2), ('tunic.historicalsociety.closet', 1), ('tunic.historicalsociety.collection', 2), ('tunic.historicalsociety.closet', 0), ('tunic.capitol_0.hall', 4), ('tunic.historicalsociety.collection', 3), ('tunic.historicalsociety.basement', 1), ('tunic.historicalsociety.entry', 3), ('tunic.historicalsociety.basement', 3), ('tunic.historicalsociety.entry', 2), ('tunic.historicalsociety.stacks', 3), 'logbook', 'tomicrofiche', 'businesscards.card_1.next', 'groupconvo_flag', 'flag_girl', 'block_1', 'journals_flag.pic_0.next', 'reader_flag', 'journals_flag.hub.topics_old', 'journals_flag.pic_2.bingo', 'tocage', 'tofrontdesk', 'tomap', 'tohallway', 'block_badge_2', 'tostacks', 'journals.pic_1.next', 'togrampa', 'retirement_letter', 'tunic.capitol_1', 'reader_flag.paper0.next', 'block_tocollection', 'ch3start', 'chap2_finale', 'crane_ranger', 'janitor', 'notebook', 'report', 'reader.paper0.next', 'coffee', 'tunic.historicalsociety', 'toentry', 'colorbook', 'directory', 'directory.closeup.archivist', 'tracks.hub.deer', 'reader_flag.paper2.prev', 'reader_flag.paper2.bingo', 'boss', 'lockeddoor', 'journals', 'need_glasses', 'businesscards.card_bingo.next', 'gramps', 'tunic.kohlcenter', 'fox', 'journals_flag', 'tunic.capitol_0', 'trigger_coffee', 'groupconvo', 'journals_flag.pic_1.next', 'journals.pic_2.next', 'journals_flag.pic_0.bingo', 'journals_flag.hub.topics', 'block_badge', 'tocollectionflag', 'tunic.hub.slip', 'archivist_glasses', 'logbook.page.bingo', 'photo', 'journals_flag.pic_1.bingo', 'tracks', 'reader.paper2.prev', 'tocloset', 'intro', 'reader.paper1.next', 'confrontation', 'journals_flag.pic_2.next', 'tocollection', 'cs', 'journals_flag.pic_2_old.next', 'remove_cup', 'savedteddy', 'block_magnify', 'reader.paper2.bingo', 'block_tomap2', 'journals.pic_2.bingo', 'chap2_finale_c', 'outtolunch', 'wellsbadge', 'teddy', 'journals_flag.pic_1_old.next', 'chap1_finale_c', 'reader.paper0.prev', 'journals.pic_0.next', 'plaque', 'tunic.capitol_2', 'key', 'seescratches', 'reader', 'wells', 'journals_flag.pic_0_old.next', 'tunic.flaghouse', 'block_tomap1', 'doorblock', 'what_happened', 'unlockdoor', 'businesscards.card_bingo.bingo', 'reader_flag.paper1.next', 'archivist', 'door_block_talk', 'tunic', 'chap1_finale', 'block_nelson', 'reader.paper1.prev', 'tocloset_dirty', 'tunic.library', 'glasses', 'expert', 'chap4_finale_c', 'plaque.face.date', 'reader_flag.paper2.next', 'reader_flag.paper1.prev', 'reader.paper2.next', 'block_0', 'reader_flag.paper0.prev', 'businesscards', 'tunic.drycleaner', 'magnify', 'worker', 'journals.hub.topics', 'businesscards.card_0.next', 'door_block_clean', 'tunic.wildlife', 'tobasement', 'trigger_scarf', 'tunic.humanecology', 'block'], '5-12': [('tunic.historicalsociety.basement', 5), ('tunic.capitol_1.hall', 7), ('tunic.historicalsociety.collection', 9), ('tunic.historicalsociety.stacks', 5), ('tunic.historicalsociety.stacks', 12), ('tunic.humanecology.frontdesk', 8), ('tunic.library.frontdesk', 12), ('tunic.historicalsociety.entry', 7), ('tunic.capitol_1.hall', 11), ('tunic.historicalsociety.frontdesk', 6), ('tunic.historicalsociety.collection', 5), ('tunic.library.microfiche', 10), ('tunic.kohlcenter.halloffame', 6), ('tunic.historicalsociety.collection', 12), ('tunic.capitol_0.hall', 5), ('tunic.historicalsociety.closet_dirty', 7), ('tunic.library.frontdesk', 9), ('tunic.historicalsociety.frontdesk', 11), ('tunic.capitol_1.hall', 6), ('tunic.historicalsociety.collection', 8), ('tunic.historicalsociety.basement', 11), ('tunic.historicalsociety.closet_dirty', 11), ('tunic.historicalsociety.stacks', 11), ('tunic.historicalsociety.basement', 6), ('tunic.historicalsociety.frontdesk', 7), ('tunic.kohlcenter.halloffame', 7), ('tunic.historicalsociety.frontdesk', 12), ('tunic.historicalsociety.entry', 11), ('tunic.humanecology.frontdesk', 11), ('tunic.drycleaner.frontdesk', 9), ('tunic.library.frontdesk', 10), ('tunic.library.microfiche', 9), ('tunic.kohlcenter.halloffame', 11), ('tunic.historicalsociety.collection', 11), ('tunic.historicalsociety.frontdesk', 8), ('tunic.humanecology.frontdesk', 7), ('tunic.historicalsociety.basement', 8), ('tunic.historicalsociety.basement', 7), ('tunic.capitol_1.hall', 9), ('tunic.historicalsociety.collection', 7), ('tunic.historicalsociety.stacks', 7), ('tunic.library.microfiche', 12), ('tunic.historicalsociety.basement', 12), ('tunic.historicalsociety.entry', 12), ('tunic.historicalsociety.closet_dirty', 8), ('tunic.drycleaner.frontdesk', 8), ('tunic.historicalsociety.entry', 5), ('tunic.library.frontdesk', 11), ('tunic.kohlcenter.halloffame', 8), ('tunic.historicalsociety.frontdesk', 9), ('tunic.historicalsociety.closet_dirty', 12), ('tunic.historicalsociety.entry', 8), ('tunic.historicalsociety.basement', 9), ('tunic.historicalsociety.closet_dirty', 5), ('tunic.drycleaner.frontdesk', 12), ('tunic.historicalsociety.stacks', 9), ('tunic.historicalsociety.stacks', 8), ('tunic.kohlcenter.halloffame', 12), ('tunic.historicalsociety.collection', 6), ('tunic.capitol_1.hall', 8), ('tunic.historicalsociety.stacks', 6), ('tunic.kohlcenter.halloffame', 5), ('tunic.historicalsociety.closet_dirty', 9), ('tunic.humanecology.frontdesk', 9), ('tunic.historicalsociety.entry', 6), ('tunic.capitol_1.hall', 12), ('tunic.drycleaner.frontdesk', 11), ('tunic.library.microfiche', 11), ('tunic.kohlcenter.halloffame', 9), ('tunic.historicalsociety.entry', 9), ('tunic.historicalsociety.closet_dirty', 6), ('tunic.humanecology.frontdesk', 12), 'logbook', 'tomicrofiche', 'businesscards.card_1.next', 'groupconvo_flag', 'flag_girl', 'block_1', 'journals_flag.pic_0.next', 'reader_flag', 'journals_flag.hub.topics_old', 'journals_flag.pic_2.bingo', 'tocage', 'tofrontdesk', 'tomap', 'tohallway', 'block_badge_2', 'tostacks', 'journals.pic_1.next', 'togrampa', 'retirement_letter', 'tunic.capitol_1', 'reader_flag.paper0.next', 'block_tocollection', 'ch3start', 'chap2_finale', 'crane_ranger', 'janitor', 'notebook', 'report', 'reader.paper0.next', 'coffee', 'tunic.historicalsociety', 'toentry', 'colorbook', 'directory', 'directory.closeup.archivist', 'tracks.hub.deer', 'reader_flag.paper2.prev', 'reader_flag.paper2.bingo', 'boss', 'lockeddoor', 'journals', 'need_glasses', 'businesscards.card_bingo.next', 'gramps', 'tunic.kohlcenter', 'fox', 'journals_flag', 'tunic.capitol_0', 'trigger_coffee', 'groupconvo', 'journals_flag.pic_1.next', 'journals.pic_2.next', 'journals_flag.pic_0.bingo', 'journals_flag.hub.topics', 'block_badge', 'tocollectionflag', 'tunic.hub.slip', 'archivist_glasses', 'logbook.page.bingo', 'photo', 'journals_flag.pic_1.bingo', 'tracks', 'reader.paper2.prev', 'tocloset', 'intro', 'reader.paper1.next', 'confrontation', 'journals_flag.pic_2.next', 'tocollection', 'cs', 'journals_flag.pic_2_old.next', 'remove_cup', 'savedteddy', 'block_magnify', 'reader.paper2.bingo', 'block_tomap2', 'journals.pic_2.bingo', 'chap2_finale_c', 'outtolunch', 'wellsbadge', 'teddy', 'journals_flag.pic_1_old.next', 'chap1_finale_c', 'reader.paper0.prev', 'journals.pic_0.next', 'plaque', 'tunic.capitol_2', 'key', 'seescratches', 'reader', 'wells', 'journals_flag.pic_0_old.next', 'tunic.flaghouse', 'block_tomap1', 'doorblock', 'what_happened', 'unlockdoor', 'businesscards.card_bingo.bingo', 'reader_flag.paper1.next', 'archivist', 'door_block_talk', 'tunic', 'chap1_finale', 'block_nelson', 'reader.paper1.prev', 'tocloset_dirty', 'tunic.library', 'glasses', 'expert', 'chap4_finale_c', 'plaque.face.date', 'reader_flag.paper2.next', 'reader_flag.paper1.prev', 'reader.paper2.next', 'block_0', 'reader_flag.paper0.prev', 'businesscards', 'tunic.drycleaner', 'magnify', 'worker', 'journals.hub.topics', 'businesscards.card_0.next', 'door_block_clean', 'tunic.wildlife', 'tobasement', 'trigger_scarf', 'tunic.humanecology', 'block'], '13-22': [('tunic.historicalsociety.entry', 16), ('tunic.historicalsociety.basement', 20), ('tunic.kohlcenter.halloffame', 21), ('tunic.drycleaner.frontdesk', 17), ('tunic.historicalsociety.cage', 21), ('tunic.historicalsociety.frontdesk', 16), ('tunic.library.frontdesk', 13), ('tunic.historicalsociety.stacks', 17), ('tunic.humanecology.frontdesk', 21), ('tunic.historicalsociety.basement', 15), ('tunic.library.microfiche', 22), ('tunic.historicalsociety.closet_dirty', 18), ('tunic.kohlcenter.halloffame', 22), ('tunic.humanecology.frontdesk', 14), ('tunic.historicalsociety.cage', 16), ('tunic.drycleaner.frontdesk', 20), ('tunic.library.frontdesk', 18), ('tunic.historicalsociety.stacks', 20), ('tunic.humanecology.frontdesk', 16), ('tunic.capitol_2.hall', 17), ('tunic.capitol_2.hall', 14), ('tunic.library.microfiche', 21), ('tunic.historicalsociety.entry', 13), ('tunic.historicalsociety.stacks', 13), ('tunic.historicalsociety.cage', 15), ('tunic.wildlife.center', 19), ('tunic.historicalsociety.frontdesk', 14), ('tunic.humanecology.frontdesk', 19), ('tunic.historicalsociety.collection_flag', 16), ('tunic.capitol_2.hall', 20), ('tunic.historicalsociety.entry', 20), ('tunic.historicalsociety.basement', 16), ('tunic.kohlcenter.halloffame', 17), ('tunic.library.microfiche', 16), ('tunic.historicalsociety.closet_dirty', 20), ('tunic.historicalsociety.frontdesk', 20), ('tunic.drycleaner.frontdesk', 14), ('tunic.wildlife.center', 20), ('tunic.historicalsociety.collection_flag', 14), ('tunic.library.frontdesk', 20), ('tunic.flaghouse.entry', 22), ('tunic.historicalsociety.entry', 17), ('tunic.historicalsociety.basement', 21), ('tunic.kohlcenter.halloffame', 18), ('tunic.historicalsociety.cage', 20), ('tunic.drycleaner.frontdesk', 16), ('tunic.historicalsociety.frontdesk', 17), ('tunic.drycleaner.frontdesk', 13), ('tunic.library.frontdesk', 14), ('tunic.historicalsociety.stacks', 16), ('tunic.humanecology.frontdesk', 20), ('tunic.flaghouse.entry', 21), ('tunic.historicalsociety.basement', 22), ('tunic.historicalsociety.closet_dirty', 19), ('tunic.humanecology.frontdesk', 13), ('tunic.historicalsociety.cage', 19), ('tunic.library.microfiche', 15), ('tunic.historicalsociety.frontdesk', 18), ('tunic.library.frontdesk', 19), ('tunic.historicalsociety.stacks', 19), ('tunic.historicalsociety.collection_flag', 20), ('tunic.capitol_2.hall', 16), ('tunic.capitol_2.hall', 13), ('tunic.kohlcenter.halloffame', 13), ('tunic.library.microfiche', 20), ('tunic.historicalsociety.closet_dirty', 16), ('tunic.historicalsociety.entry', 14), ('tunic.historicalsociety.cage', 14), ('tunic.historicalsociety.frontdesk', 15), ('tunic.historicalsociety.closet_dirty', 14), ('tunic.library.frontdesk', 16), ('tunic.historicalsociety.stacks', 22), ('tunic.humanecology.frontdesk', 18), ('tunic.historicalsociety.collection_flag', 17), ('tunic.capitol_2.hall', 19), ('tunic.historicalsociety.entry', 21), ('tunic.historicalsociety.basement', 17), ('tunic.kohlcenter.halloffame', 14), ('tunic.library.microfiche', 19), ('tunic.historicalsociety.closet_dirty', 21), ('tunic.historicalsociety.stacks', 15), ('tunic.historicalsociety.frontdesk', 21), ('tunic.wildlife.center', 21), ('tunic.historicalsociety.collection_flag', 15), ('tunic.library.frontdesk', 21), ('tunic.historicalsociety.collection_flag', 18), ('tunic.capitol_2.hall', 22), ('tunic.historicalsociety.entry', 18), ('tunic.historicalsociety.collection', 14), ('tunic.historicalsociety.basement', 18), ('tunic.kohlcenter.halloffame', 19), ('tunic.drycleaner.frontdesk', 19), ('tunic.historicalsociety.frontdesk', 22), ('tunic.library.frontdesk', 15), ('tunic.wildlife.center', 22), ('tunic.historicalsociety.basement', 13), ('tunic.flaghouse.entry', 20), ('tunic.historicalsociety.collection', 13), ('tunic.kohlcenter.halloffame', 20), ('tunic.historicalsociety.cage', 18), ('tunic.drycleaner.frontdesk', 22), ('tunic.library.microfiche', 14), ('tunic.historicalsociety.frontdesk', 19), ('tunic.historicalsociety.stacks', 18), ('tunic.humanecology.frontdesk', 22), ('tunic.historicalsociety.collection_flag', 21), ('tunic.historicalsociety.basement', 14), ('tunic.flaghouse.entry', 19), ('tunic.historicalsociety.closet_dirty', 17), ('tunic.historicalsociety.entry', 15), ('tunic.humanecology.frontdesk', 15), ('tunic.historicalsociety.cage', 17), ('tunic.drycleaner.frontdesk', 21), ('tunic.library.microfiche', 13), ('tunic.historicalsociety.closet_dirty', 15), ('tunic.library.frontdesk', 17), ('tunic.historicalsociety.stacks', 21), ('tunic.humanecology.frontdesk', 17), ('tunic.historicalsociety.collection_flag', 22), ('tunic.capitol_2.hall', 18), ('tunic.historicalsociety.entry', 22), ('tunic.capitol_2.hall', 15), ('tunic.kohlcenter.halloffame', 15), ('tunic.library.microfiche', 18), ('tunic.historicalsociety.closet_dirty', 22), ('tunic.historicalsociety.stacks', 14), ('tunic.capitol_1.hall', 13), ('tunic.wildlife.center', 18), ('tunic.library.frontdesk', 22), ('tunic.historicalsociety.collection_flag', 19), ('tunic.capitol_2.hall', 21), ('tunic.historicalsociety.entry', 19), ('tunic.historicalsociety.basement', 19), ('tunic.kohlcenter.halloffame', 16), ('tunic.library.microfiche', 17), ('tunic.drycleaner.frontdesk', 18), ('tunic.historicalsociety.cage', 22), ('tunic.drycleaner.frontdesk', 15), 'logbook', 'tomicrofiche', 'businesscards.card_1.next', 'groupconvo_flag', 'flag_girl', 'block_1', 'journals_flag.pic_0.next', 'reader_flag', 'journals_flag.hub.topics_old', 'journals_flag.pic_2.bingo', 'tocage', 'tofrontdesk', 'tomap', 'tohallway', 'block_badge_2', 'tostacks', 'journals.pic_1.next', 'togrampa', 'retirement_letter', 'tunic.capitol_1', 'reader_flag.paper0.next', 'block_tocollection', 'ch3start', 'chap2_finale', 'crane_ranger', 'janitor', 'notebook', 'report', 'reader.paper0.next', 'coffee', 'tunic.historicalsociety', 'toentry', 'colorbook', 'directory', 'directory.closeup.archivist', 'tracks.hub.deer', 'reader_flag.paper2.prev', 'reader_flag.paper2.bingo', 'boss', 'lockeddoor', 'journals', 'need_glasses', 'businesscards.card_bingo.next', 'gramps', 'tunic.kohlcenter', 'fox', 'journals_flag', 'tunic.capitol_0', 'trigger_coffee', 'groupconvo', 'journals_flag.pic_1.next', 'journals.pic_2.next', 'journals_flag.pic_0.bingo', 'journals_flag.hub.topics', 'block_badge', 'tocollectionflag', 'tunic.hub.slip', 'archivist_glasses', 'logbook.page.bingo', 'photo', 'journals_flag.pic_1.bingo', 'tracks', 'reader.paper2.prev', 'tocloset', 'intro', 'reader.paper1.next', 'confrontation', 'journals_flag.pic_2.next', 'tocollection', 'cs', 'journals_flag.pic_2_old.next', 'remove_cup', 'savedteddy', 'block_magnify', 'reader.paper2.bingo', 'block_tomap2', 'journals.pic_2.bingo', 'chap2_finale_c', 'outtolunch', 'wellsbadge', 'teddy', 'journals_flag.pic_1_old.next', 'chap1_finale_c', 'reader.paper0.prev', 'journals.pic_0.next', 'plaque', 'tunic.capitol_2', 'key', 'seescratches', 'reader', 'wells', 'journals_flag.pic_0_old.next', 'tunic.flaghouse', 'block_tomap1', 'doorblock', 'what_happened', 'unlockdoor', 'businesscards.card_bingo.bingo', 'reader_flag.paper1.next', 'archivist', 'door_block_talk', 'tunic', 'chap1_finale', 'block_nelson', 'reader.paper1.prev', 'tocloset_dirty', 'tunic.library', 'glasses', 'expert', 'chap4_finale_c', 'plaque.face.date', 'reader_flag.paper2.next', 'reader_flag.paper1.prev', 'reader.paper2.next', 'block_0', 'reader_flag.paper0.prev', 'businesscards', 'tunic.drycleaner', 'magnify', 'worker', 'journals.hub.topics', 'businesscards.card_0.next', 'door_block_clean', 'tunic.wildlife', 'tobasement', 'trigger_scarf', 'tunic.humanecology', 'block']}\ndef task1(X, lvl_group):\n    lseto = lset[lvl_group]\n    leen = lengs[lvl_group]\n    lens_group = lens[lvl_group]\n    s = np.zeros((1, lens_group - leen))\n    leno=m[lvl_group][leen:]\n    group_lengths = X.groupby('fqid').size().div(len(X))\n    filtered_X = X['fqid'][X['fqid'].notnull()]\n    indices = np.array([lseto[fqid] - leen for fqid in filtered_X])\n    s[0, indices] = group_lengths[filtered_X].values\n    return s\n\n\ndef task2(X,lvl_group):\n    lseto=lset[lvl_group]\n    leen=lengs[lvl_group]\n    leno=m[lvl_group][:leen]\n    s=np.zeros((1,leen))\n    for (room,lvl),group2 in X.groupby(['room_fqid','level']):\n        if (room,lvl) in leno:\n            s[0,lseto[(room,lvl)]]=np.ptp(group2['elapsed_time'])\n    return s\n#type(env)._state = type(type(env)._state).__dict__['INIT']\npool = multiprocessing.Pool(2)\nfor (X, sample_submission) in env.iter_test():\n    lvl_group = X['level_group'].values[0]\n    session = X['session_id'].values[0]\n    if lvl_group=='0-4': \n        lseto=lset[lvl_group]\n        leen=lengs[lvl_group]\n        leno=m[lvl_group][:leen]\n        s=np.zeros((1,leen))\n        for (room,lvl),group2 in X.groupby(['room_fqid','level']):\n            if (room,lvl) in leno:\n                s[0,lseto[(room,lvl)]]=np.ptp(group2['elapsed_time'])\n        sample_submission.loc[sample_submission.session_id == f'{session}_q{2}','correct'] = 1      \n        for t in limits[lvl_group]:\n            preds2=lgbmodel[t-1].predict_proba(s.astype('float32'))[0,1]\n            sample_submission.loc[sample_submission.session_id == f'{session}_q{t}','correct'] = round(preds2-0.132)   \n\n    else:    \n        jobs=[pool.apply_async(task1, (X,lvl_group)),pool.apply_async(task2, (X,lvl_group))]\n        sess_data1=jobs[0].get()\n        sess_data2=jobs[1].get()\n        sess_data = np.concatenate((sess_data2, sess_data1), axis=1)\n        if lvl_group=='5-12':\n            sample_submission.loc[sample_submission.session_id == f'{session}_q{12}','correct'] = 1      \n            sample_submission.loc[sample_submission.session_id == f'{session}_q{13}','correct'] = 0\n        else:\n            sample_submission.loc[sample_submission.session_id == f'{session}_q{18}','correct'] = 1\n\n        for t in limits[lvl_group]:\n            preds=lgb_model[t-1].predict_proba(sess_data.astype('float32'))[0,1]\n            preds2=lgbmodel[t-1].predict_proba(sess_data2.astype('float32'))[0,1]\n            sample_submission.loc[sample_submission.session_id == f'{session}_q{t}','correct'] = round(preds*weights[t]+preds2*(1-weights[t])-0.125)   \n    sample_submission = sample_submission[['session_id', 'correct']] \n    env.predict(sample_submission)\n\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-06-28T05:01:45.905068Z","iopub.execute_input":"2023-06-28T05:01:45.905481Z","iopub.status.idle":"2023-06-28T05:01:49.317502Z","shell.execute_reply.started":"2023-06-28T05:01:45.905447Z","shell.execute_reply":"2023-06-28T05:01:49.314607Z"},"trusted":true},"execution_count":null,"outputs":[]}]}