Kaggle competition: Fieldguide Challenge: Moths & Butterflies
<SOS> metric: MeanBestErrorAtK Kaggle data source: fieldguide-challenge-moths-and-butterflies<define_variables>
%matplotlib inline
sns.set()
def sigmoid(x):
return 1 /(1 + np.exp(-x))
train_preds = np.zeros(( len(X_train)))
 test_preds = np.zeros(( len(df_test)))
 seed_everything()
X_test_cuda = torch.tensor(X_test, dtype=torch.long ).cuda()
test = torch.utils.data.TensorDataset(X_test_cuda)
 test_loader = torch.utils.data.DataLoader(test, batch_size=batch_size, shuffle=False)
 avg_losses_f = []
avg_val_losses_f = []<data_type_conversions>
sub = pd.read_csv('.. /input/sample_submission.csv' )
for i,(train_idx, valid_idx)in enumerate(splits):
X_train = np.array(X_train)
 y_train = np.array(y_train)
 features_train = np.array(features_train)
 X_train_fold = torch.tensor(X_train[train_idx.astype(int)], dtype=torch.long ).cuda()
y_train_fold = torch.tensor(y_train[train_idx.astype(int), np.newaxis], dtype=torch.float32 ).cuda()
kfold_X_features = features_train[train_idx.astype(int)]
kfold_X_valid_features = features_train[valid_idx.astype(int)]
X_val_fold = torch.tensor(X_train[valid_idx.astype(int)], dtype=torch.long ).cuda()
y_val_fold = torch.tensor(y_train[valid_idx.astype(int), np.newaxis], dtype=torch.float32 ).cuda()
model = NeuralNet()
model.cuda()
loss_fn = torch.nn.BCEWithLogitsLoss(reduction='sum')
 step_size = 400
base_lr, max_lr = 0.001, 0.003
optimizer = torch.optim.Adam(filter(lambda p: p.requires_grad, model.parameters()),
lr=max_lr)
 scheduler = CyclicLR(optimizer, base_lr=base_lr, max_lr=max_lr,
step_size=step_size, mode='exp_range',
gamma=0.99994)
 train = torch.utils.data.TensorDataset(X_train_fold, y_train_fold)
 valid = torch.utils.data.TensorDataset(X_val_fold, y_val_fold)
 train = MyDataset(train)
 valid = MyDataset(valid)
 train_loader = torch.utils.data.DataLoader(train, batch_size=batch_size, shuffle=True)
 valid_loader = torch.utils.data.DataLoader(valid, batch_size=batch_size, shuffle=False)
 print(f'Fold {i + 1}')
 for epoch in range(n_epochs):
start_time = time.time()
model.train()
avg_loss = 0.
 for i,(X_batch, y_batch, index)in enumerate(train_loader):
f = kfold_X_features[index]
y_pred = model([X_batch,f])
 if scheduler:
scheduler.batch_step()
loss = loss_fn(y_pred, y_batch)
 optimizer.zero_grad()
loss.backward()
optimizer.step()
avg_loss += loss.item() / len(train_loader)
 model.eval()
valid_preds_fold = np.zeros(( X_val_fold.size(0)))
 test_preds_fold = np.zeros(( len(df_test)))
 avg_val_loss = 0.
 for i,(X_batch, y_batch, index)in enumerate(valid_loader):
f = kfold_X_valid_features[index]
y_pred = model([X_batch,f] ).detach()
avg_val_loss += loss_fn(y_pred, y_batch ).item() / len(valid_loader)
 valid_preds_fold[i * batch_size:(i+1)* batch_size] = sigmoid(y_pred.cpu().numpy())[:, 0]
elapsed_time = time.time() - start_time
print('Epoch {}/{} \t loss={:.4f} \t val_loss={:.4f} \t time={:.2f}s'.format(
 epoch + 1, n_epochs, avg_loss, avg_val_loss, elapsed_time))
avg_losses_f.append(avg_loss)
 avg_val_losses_f.append(avg_val_loss)
 for i,(X_batch,)in enumerate(test_loader):
f = features_test[i * batch_size:(i+1)* batch_size]
y_pred = model([X_batch,f] ).detach()
test_preds_fold[i * batch_size:(i+1)* batch_size] = sigmoid(y_pred.cpu().numpy())[:, 0]
train_preds[valid_idx] = valid_preds_fold
test_preds += test_preds_fold / len(splits)
 print('All \t loss={:.4f} \t val_loss={:.4f} \t '.format(np.average(avg_losses_f),np.average(avg_val_losses_f)))
<compute_test_metric>
with open('.. /input/train_annotations.json/train_annotations.json','r')as anno_train:
train = json.load(anno_train)
 with open('.. /input/test_annotations.json/test_annotations.json','r')as anno_test:
test = json.load(anno_test )
def bestThresshold(y_train,train_preds):
tmp = [0,0,0]
delta = 0
for tmp[0] in tqdm(np.arange(0.1, 0.501, 0.01)) :
tmp[1] = f1_score(y_train, np.array(train_preds)>tmp[0])
 if tmp[1] > tmp[2]:
delta = tmp[0]
tmp[2] = tmp[1]
print('best threshold is {:.4f} with F1 score: {:.4f}'.format(delta, tmp[2]))
return delta
delta = bestThresshold(y_train,train_preds )<save_to_csv>
test_df = pd.DataFrame()
test_df = test_df.append(test['images'], ignore_index=True )
submission = df_test[['qid']].copy()
submission['prediction'] =(test_preds > delta ).astype(int)
 submission.to_csv('submission.csv', index=False )<categorify>
train_df = pd.DataFrame()
train_df = train_df.append(train['images'], ignore_index=True)
 train_df_anno = pd.DataFrame()
train_df_anno = train_df_anno.append(train['annotations'], ignore_index=True)
 train_df['category_id'] = train_df_anno['category_id']
del train_df_anno
gc.collect()
sbase = "".join(chr(i)for i in range(0,65535)if chr(i ).isalnum())
 def encode(bin_str, sbase):
n = int(bin_str,2)
 code = []
base = len(sbase)
 while n > 0:
n, c = divmod(n, base)
 code.append(sbase[c])
 code = reversed(code)
 return ''.join(code)
 def decode(code, sbase, size):
code = reversed(code)
 base = len(sbase)
 bin_str = bin(sum([sbase.index(c)*base**i for i, c in enumerate(code)])) [2:]
bin_str =(size-len(bin_str)) *'0' + bin_str
return bin_str<define_variables>
category_numbers = [0]*(np.max(train_df['category_id'])+1 )
pred_compress_copy = '9䔎頗륶ữ喎㴞ꃰⰛ让齸ᇜ㪻三鵄湙錃閅啲眗奒긖혖锑ஒ涎靘ॹ䧰逥艰젢喒ظ練ꔙಙ엺求摪ﭯ춖ꐡῳꐊ䙸ⷍ눯徭泅甁潪ㅒꋨ鳠Ĕ裘枡尘젼㤟낗윉泺륧펔䣰ᠪ骢蔟㑃춉鳯ⱺ뺞꼣ᓔ䌀二쟦齊텕슫ष牣拎㢺볡㑩犱ஓ閹멢晹簇ꓯ叏䎫逩棈덎銂㲾邚㳖瀽멦ᥘﶤ뤀ฮ鹋尶数췝臲蘅벘鈌觰皖夥ﶦ畳ⱎ䣈堡螄錉或抄션譕㐡氮軱ಥ䰱㵝澱刔樆簅糮颰趜뎁峊龙虍뼁蠸á跑澝ᠺ鯽퇚땴㥹釢r뼦콖묤䒏㷄ᬤꠌ㝑譱篕蝰謽倠茳烁喕尽叢않蠪햁琺㖚쀅䨯潠嚿ⱬ벅㨢孈鮚꽯ሩ嗨酉犛ᑨ䎷釵鏓㽯똵熎ᠡ塜쨯뀃瀼臛쀧純䭡㹏汿ꥃ돸㔴꾬䲜ਫ਼ƃ鸩퓮薣ɲ컏믚ၰ䴔蕻멳ퟡ玎䣅㱿鳈ⷃ횑箓绪㴼쿱礑⑽ꁏ价ῲ㤨䟨펊酗籲ɀ풓쥵圦뻝黟⓫㘦纴꘤絿䫚闙莳뼦䙘❸ò쀎琊偝垨鑿ᰢ닠锈最헦㶀バ덝據淝飼袼搵Ⲹᠸ늬ⲉ치橣芓팴駺嗯䝼扞扒侧ꩬ譽蒂䮶꾇캏拘茤쎟참鼵㾤ȫք䕅볐ᠸ剣鰟暯䬒蕈텦鱞锞ﳕ㬖뤣땡宂쓭䂳썢キᠶꪖꍻ린嗾흹歷骶빷곑섔㙭㟹ል鋼睌謉酒縺ꔞ禪ኞ델돖퉐汘亓孍䣃㼛鲀퉓ꑼ뭼萯戰氭➑㽎亯ശ홚燕惺䰤ຣሲƼ氬괍㶊ᗌ됿탬1숝蜐ꞣ㘩삙爘厓鍸肯좴뜽聦銉錄썐卦鮓㽀됉ğ熏ꍨꞩ紇耥堄뒘䟞㿀兠軆ۋ蝛쓥ℂሇਊ癸㛁豲䬫Ｐ爋苑䳕䄨袑䫺襛ඳ協픳뽮檖屭ꠖ醀놿끟ᄫ鷈漐竖Ò띉碶펐鉉캾ꐰ䗙鹝飭퍁ᵵ広䚓滾녖ῺꞖ뮮萒㾓㼐짘ꏜ뻘棵渴ស浇燊觟暫荩憣뇪裋䏆ꍠꚣﳏ퉙ᥲᮝἃ뻡ﱘ檷ᚑ盈矩镨枏ӱὗ䐕혬ㆀᨸ裆咤恵൙㞿㒦猸峉㪵ᩄ飿冪쉮黽鬚鱍ᓘ踋ꥀ짤꺪끰嫁ꨒङ앪䐶冺匈ቶꭎ莋꾷뱄㷝컿Ḍ倭颠䧰뵜몹蛼륻ꧮ纵部抿ꡜ閒ꐨ兲袑㔳갊쎆又歓䜖ซϷ땧倩퀛韷䑖饖矋ꃅ吞褈홏矊㫇𢡄稢杰ꔣᙕ膞낺ⶄ篆爢햦䥣訥㕎ᛢ幖恠㔯ꊽ闾㵭벬䲸ዀ쟈鿁滛䄉諌갋텠푀扤㔆Ꚕ蘕㿐욳ಱ㡧田描ㅓ쵏鮻彣檽ﺸ趾崝훓ಹ宰ﾀ嶆孾ヴㅭ橬镽ǃ䆫겭㛃靝ൽ采詓Đ뙬ㄋग뷀鈄ﾡ蜏忆ᅿ㡣쀓㪑邻ꬅඏ햻駆뿽猰髆趍戮峌정褁付강ᯜ䨇뱀歶쁔숐㘄㶤삷籵졺ﰰ亝燌夹皰癴白ꘗ먢ཐꩅ䔀ꮫ빹ㆤȹꞰꗻë獣툨Ừ㕇ᶣż堷捋濹컧裋䗿ꉮ롻Ӎ悉윉淿迹浏剩蓽㮫储ᜎ묨ฮ흻뻤Ĳ䥱콭斖ᆣ绋ږ짷ᙻꎘⴢ瑥ṓ솨ꁬ굴㶱샍嫚邟쯭핓娮왎䶖秢혬쮛낍疭嵃䢍뭡۴颕䪭뚖䭛嗏疧ꆁ劝ጒ䶧聹㑫訮탣쏺朐썓퓼騒ḱ俓鄊芴찚ᖍ䦛聯砂㧕㚿첎彅曀苲貚銑ﾇ获㤘䘡㷆茙ჯ䎑习鍷ധᗬ谍故飶鏹ᨱ賈䤥〧锈ፈ悆ș咳雩艓僁톂䊯瑙ǟ凮퇿壆둡쇏仓ﮙჿ鄚菮鳃嘮恉贈ᖈ熤蛪〹骺硢진쿢醀ƭ約玧兊짗摬ỿ뜼䉙ᵸ倝䶀폘귑থ剨縋ꄉᗖ没උ铔ꁫ瓂쑯வ埍쿩ᐕ껥꿀៰肻蓩搀욠Ⳓ㒑됉楫䐒놀ა沦Ⴒ뛹皴쿹蜋ɲ챳餢贠ᄿ㖔殱ᾛꚧ喽糲潽堋纶埻ជ躍蠒쁑폶쯆ϖ训槍恕䑰촄ꄝ禇谑棓ꪽ㷓ꘆ淒酘诙刞햫猟波푩챳묮鍀訝繜姤쫎츢픲ϢД霄듎헤듬旻떘둎냕୷녥ᄟ潊ꁓ轈탾闸ᙔङ붚菠麷嘿옖鱇ꗨ贫黎ᄍ껲涷ﯘﮫ澘㬯犑覾ᅾ䉵㝬㥮痁옕푣쮡漋쒘硜མꂙ켾덧뺀ｍ芽鄚䮶绍ꧩ㝲ﳲ꾥䒱䯎ꈔ鷜Ѳ鵂죐ữ欯媿ᛠ阑ٺꂙ旴鋯ꑚ鏇ꍷ逫윩㖳㺅ḷ쩵氯엡Ꝃ㨕桚鍵睳璥鼬휑稈Ҥㄍ頳笰衵檕ކ曣댍鳵䍘㈦㦭㼸㘗ᴍ憽좾僲썔陣쩨த谭䆱扮ꈥ囚窏ꬫ㣶띰蟭ꅒꊑ籘걚셈ῧ퍕殺欝酮풔០ꋦ䐲겄柗쮴볍Ἒ䪖둯ᇐ헽秕臡飪풘蹃潣漩謬嵗黰艄褿綮復易ǧ䖫祬죴샋뻮㒔杫ꎼꔆ颬畕빼ڕ勉瘄硭쬞鿊鳯賔飵希굽ᜄ앎㯓謼销蜧큅薗忿榌摡炕ũ耍ꔽ霼â韖䦻篦㓀㿤㑒関鉧ጸ똼볅칭맴꼷汦䴖쐼뻔ꬳ鴙颁嘁ᓉЇ띉䪄揩踛觴め㑚팠軩퇐Ꮫ邬譯䃵觱诏꿜됫酬㶎蕖虊ὓ犼㳼ㇺ냠㚊엮ፓ俣䮍ƪꆒ䍯穎嗼ᕬ髅竂ᴔ籏쯍ꭈ垫镞彈ᕨᑂ姡톦脵ᶠ硶쁛፺፭촤오䖁ꊄ设耼踌覫뀬孧绰퀉㥆詟㲢㐪툽ລฐ샐㝥뙂啺뎭葽撤ⶹꭼ喂夋ﱼ頌蘗腄듂쪔㤺꩖ㅏ뤅䫅圣强Ꮚቫㆵ䛋쁪戨糭덶꧖⒄Ⴛ諛頙蚒ᦐᔥꥣ䒌愤虹鞔ኬ헠䅵ϻ倥琡봷痗Ꭹ噃䨱㩁ꭁ䄽伹䞓꺸灕揾腣牬뚴폑蓛輿ꓘꡫ㢢㙐畗帿ᡄ懸旎悗ꫠ禄럏Іꁥ䳣瘮醝藗ꁸ稩藵ఉ뭵銕혣ᚇ⓱먧膆씥恵쒃景瑒㰤艵眔纉쿣ꚾ欕ﾯ萐踦섒ḣ琦곗텞䕣㑜軖ꝑ稬畷鎣汢甪獵嫦廌寙뜧씪兔湕䈹꽉Ὠ餣뭟龁쳶庅쇿不갺賞鴷闉格底伲덆㵇㙎Ω潅刋㴎ꇓ㠰ᙖ붕Ꜷᒶ儸슱탮뮰밷魰봀ꧏ픰䳂筰쌴㊅如投ṧ梫뤦䁴筍랓ⴠ쿻٩뒭躶ꞇ嶯廓詆ɠ欣낄놎隟뛁譖ഔ괶曈隱븯炭悲湛襑撬嬥ᙱ妃猉䄴뇵䏊돥筁샌Ѕƽ冃娛ҝ郑䐛쀟ᶚ傍噣ⲓԤ檟埼購읤鵗㡔擩帐톴ग㦾꽑懮ⴻᖬ⑦퍫罏帬ῠ혦쾤솴矱ꋠ䜨䯘衒伥땝鷾蜆蟮ﾏ眦鄿뚉ᆆሼ憱გᶘ葰橌ꎃ듞戕燲儾扟컭㕗囕乳퓞ʶ뒜૫繻剗ʁꪄ樿檋鰉찱춰춼㮠召⓮趃䬞邨綛絇쐓睔煩罿絽轖Ᵹ灲皜說㮤厍首ᛴベ䆰氏肖烡甒뉺铉Ꮞ硫糷塚낓뺃Ⰸ鶲寧磖嗋熱霥鮀踻ᑥ烂앂ꚏ屨䪿ꗝ瘁鰘來壑잣ၵ黕뀸拱薗ｂ闏䝰ꌬ䆅祲搄띥옌巽趷刺圛䲙抦兮갣姪礎Ｎ瑔隇轸唡퍠휝ᅓ쀕娑熺됄눖蔪鎶ꐇ梪杪炊ᣐ閉㼁缼䇠继胹ꀸꯟﻠ쵍淴懃熒쌵蕛裵䍌ꋯ쓮卂짵翴漦ﵯ绷桑㬦丅鯩罁踯썱뷧辪᱅ㄘⲆ量犡쳷큶闸臝㻍ɫ鐙懈犪硑軧둸鬨ᾀ㑽떎칊귛곈젼罉렍㠓龏譆韉㽍㝪䙜瓀ꭍ蝱ﲣⴹ뵱敳鮦壒歧跁식檛鸮ꃈ䰰搛姠붊䢎揚움깛跘Ⲭ걌僂崎䗔묥䏩胛㩘鲶홣䍘趡똚痐䮀ꬍ筂뱹쁩顆攍凸鸃໙㕋ㇿ立왃谗菔㗯憗뻣鮂춝孌찾故躄뼢췜鋊类쓖䬏㖃扣蛺麿즣鸔ᚅ娹蔾෦츴瘘Ⅎ玜繛贠盇琖峻ᑽ䎫㻂촀䚥Ⰼ俰ᮇ擞겴䍒㮐ꃺᴠꇫ샘锂蜄纻ⶈ蓖栌总崃욘湬釳櫦і黍䯺羯挣첄쯽氵삺局ꀭ铿Ư㿕厹欄Ł䌞误ꋩ窙턓䘖즂쁏䒰㉉冨謽䐨렊Ⴎ鮀堨肃玖謺妯䎚텝驌ꮏ톢햺즷蹾ﱑ냬햆媈ᏹ츻ꍈ㰩㿃鍆蟟淾꺕㶝磱囤鹘榉Ꭽ躂埏邉툳嫺檽翌椂鲡ﾗ㔍Ὤហ杓餱鞦泹姞ᕆ睲ǅᶅﺵᘝ쓄茿褬뿀ꐪ譴여鈯둺栢ꀉŌ쉹绌Ɱꅿᖋ铚ﰓꚚㇼ㚩궯綡䓔쟠뇬껶ဌځ뿈뮊娔㔈頠똰Ԇᙂ속䢎㗷ⳏ䏫蟷뾘雇繼ﱼ昖꼰꿪ⶕ㽡쮻ᮯꘘ銢漣ꦲ岂㳹ಀ늼阆ᓏ逾咍蹁岃捹麶ﹰ僌蒵ꝓ풺ﳌ疱淔堄ꧠ㜌餬Ὼ콑釳ιⶃꔚ쓎ォ謬ڲ泴귯潟蘉붼傥댥㑲㥼吕擶狏闙䂔퓣牍ᆡ哯䶵칷ݒ翳岻쀦똴蝙嗄숴㙮Ῡ泐晇錈볰빡휈鮒ज़ﲤ꽖摝㑜鐏仪怓渌㼼詫혒뛕ꍴ殃써᠔ㆧꜘ禣鑬聘띗湩簾荷錖闻ڣᗎ㙈굽矛齈챞疠䯥쬢뤶莄㴦瑂촷嫎郷炙톹ܫ뷼Ⳕ㥈㐮괉光䚍藢㿽산㯢ꍎ鋨醠奿旕쨲ᴗ怃祰鄶䌈㸼ᡩ캰웠酄ᎇ궽䩚헣럧篫ꪀ廕顖퇽癩匀蘞艟璉痋칏旤뇶鬏闋謑쉣㾝䠜艞㸪䋅찒ᢄᶈၥ㥋ᅟᐍᎾ춾縊귋걚靼䩯铄蘀庐䥇粂禖ꑬ箩㧀䥛ᖔ涩燕ꮣ趭钚뎺ꍮ科㶞ꔹ䆑ā刦ܤ譁꯰ꩅ藞Ɪ穨Ꚃ梭䎉얂鑂㔷ⷞ眴퀢癏㰉巟䭌㮕隬뭒㸬耰ᬱꂇꄯ囿䒐繎蝹鬒燫ﲫፎ꽄鉣퐁ᨽघ뎍吸ᖏኸ䨹챀闯璘푭翡筐몐뤾쁞ֆ쨞닣撐ᙫ䬸銇䲒밫涺ꠐꪝ镩흏哵홥㱞ᘕ槢䉅婰ﱊ銊ᮄ垛䶥숴㢣힎ﻛ鱷訝鄦钸垖긆䴻齯쇈溦叜寚龴蝣惭ถ蓉浹ضꀇω퇷벚郾䫌ﵟ螾懴梄茺璸鷗䳑琐Ⰴ斑Ц啜ﴼ蚩捬湳Ǝ䜜垏ᘳ饙벞ຜ㞎뎙쟞䔑㘩焋㒶籸霹늒낫羏磢遨㗮䙢뺦葵䥰즵ﰨ鑄ᤐ㾶ㇷ鷺ꑞ遀绔햻䛩ⷚ痽蒦繢鸗Ź娷院補띦㙶븟ԗ㓄洊촜뽺舉損颼룞ტƊ翏琠빿鴭蒨Ꮾ鸍쪒箬릺騏䩸ᦏ饆汵羦뢮왘ꥴ鹦Ō錍퐞糦표修盤涃犧麽掃乹磼耆睛ힹҠ䗡녱캴枤냩꺁銨ᮅ䊠댼닚埤鐣枆㔓냱훵辠咣綛폕煐盱뺚나뮹ᗸứㇴଏ禐밍걱閳顁차䁥쮍肣贏틂僟이樃笯醩ꄣ욒굛홦ￒ怵ʙ빋鍨㉜䳡삊ମ柰꼁썓웠吗䃮쒑㯳糧떒鯉ᆅ埒ꗰ握쨥䴲ꇈ尉먆猛灔Ѕ吋ẍﲞɍᓇ嗮屓웝ळ㳁쯐纖啇둂푊領쿣䃨쑫療뎾ｃ炘悞꿿渡핎ʇ唤訲䞜燚쳽ᓄㆆ钛ᴛ朿ඬষꘁö蝪풺嫬䈝ᛣ蓴싸뒓㠚蚦匪ꊻ錃卙劓眔哈挺ᛲ잃瓉ឈ䢆畁忝ᚪᶲ钊モꚚ笤鎰괶췚ʷ墳萭ﾽ鿂꺤쎯ᨥ왠拋쵪ﻩ抯㻙ꇳધ뜶翨釀嵀仉僛ᏹ쿉䳁칲阫턈뮙镴㭻㾟㔨囀륉봧綶옰᧔휍龄ᖴ紧ꝣɅ锅ꇡ얡窋騬ர뜴慄ꜞ唔噉惁罘ꪹ閳焚挚憎坽죞䄰揊徇ꧧފ僲쳾᧒ず佩䥙咁ἁ됭雞ମ쌲㹟ﲁప窪㟗卵쌵䩺摼殺틂䒅捬켬ᔡ쌽ࢸ늰牎팟팃䆜䕅眸鍲㢺伍녖ఌ윊鐃⒓齳鎨무严汣嫌觚砋鶸ꩺ誵翮衡ഭ瓑ᇖ팦늹ণ粖ᇚ왛ᘜ镾ᴋ錀芲嬹䇘腽ꥥ癖信뚿᭖㲚ᬨᮔ틶懸욭쳊팋퓽ꚼ龤ᢗ撞ಭ䩂残唲仡눀ᒜ彽嘨섁䅂㚝宷奙ꆻﶕ팰忪韺눻饨দᴜ蝹투ᙞ韲뮆簰រ诸궎Ɫ㕗拖쬈ﻘດ靦ᨖ൝㬄艻辘鮌ㇼ獌賳큸셞쁐噧飘鏦槚灂穑짤ꔛ䈢鮅瀥䖭닇斻惘捽ʹ擨뗍肙竽ꕍᠯ埮银톲丷嗫鏾ᣱ쳚櫴醃ⴽ쪚茵픳鬧얬볅娴낧ຄἳ뒆汜ᰃ䚛폏㞘눳잯꩘鄞홺쀳즷쇄念䐢캓辽꧹禧阮瘆䪠泍䲏ꛆ켳䉞蝞忭쭱듷썍桱ɍ輚ᡈ㙣ﴍ瘙펶勐㡐䎅랺炚ᵒ禺ĺ缘睉뺝쐧멖ﷻ府魌ѭἣㄎب蟥맛쾐ü啥뫕軅唥먇쇀쳺䂼ī᪓軅꿄琼킠飗惣菗ﷰ夲䝘좻㶌菋憐蟠ꞡ뵪犡欼뗺ⲭ팞衖꺜饶ጽ敿퓅垮雑踰绷柣俫咿雃歽ꋏ鼑ᬳ쒩쨆뭬ネ蜁鎪觭옅徢쓶庼Ⰰﴝ杌ꓽ妢릭쬩턗ᗰ즏娠幧ꯝ啾灷訏棒旈ɧ嘸ጇ옣乂ꃎ쏜嵦ᅶ쇦쾯唩潃쩀ﺵ씋౹丌ዓꏛ㴘얢㼎枅뀄ᛢ皯뙐ｰ圔䒳켽釴蜬ቖ၄弰便ꡤব쪨ల宒철焧沠쮖馏䙯ຂᴘ䜤蜟딞縖턝Ⅳ쐳蝏뼡愱吏齸姪ݺ셡Ꮀ鼔٩쭜憪螶ꌉⱦ孺鎉暠㨐濥ℸꝽ䦔맟깓퉎᱒뤲轉㐼㱡璍번觢ﱩ牾덳䄒ퟒ㬦ፕ䳒쀒玻䈍蜄尚栱기푑뽄꺶銭㿘燜盪靟竬ޏ簠玍佂飞玢ꕪ쥮롾놩㣎ಘ䨞ᨷ㠂㸡脺綈䰃㞏ਠ敓봧팚턯禀ษ摒ᲇ슈치梃蛊稅얥剨羴省絋훲憖뫨묲両乢岙鶯큘䠡瞃壛浤燸뜦罾鐎ᎊڑ얡漾Ⲭ쩻턜腕ב䲄灳닗䍐馹寫䱇谑꽹윋堍䨈煊뗸ᥝ쯴ᰈ鵨瓚픱辆풥兠贊떊㹙蚩ᄱ뇍⒃Վ迏䙧㗲눴忟炜훭砆侭ᴭ蜵诱ᄏꈹ㓟唂蠅鍪嚢奓竸駪㦎㘞ᇿ䝕ᧂ笖ᄠ梉骉릨冫帩㾉荂혀徵鑦隦兌宭鼕樬乯ꂿ殰ꂄ쎚ሐ醈亇䓁ϻ蒰후絁킪虠鴜帇ᴹᖍꁸɈ玵提똉ຣ濳匬ᜑ늻ꆞ쐹꽝㔞硁ɥ䇓趙镽㭷ᓪ年㾀秨릇忿裡ژ㜉謤䮐퇋ሪ힖䑗ꤸ誵蘹荳챰嘃濮븋ᅴ谑즮餞㢨씀껅㾨굑믶ꨧ釦빾豮佭泾翪藷筞屫ꗶ妜ߝ끦괊琸Ɖ谯쨎賿찥釀鸿탂迎뎋訰牞㻡揨坐榨入沇琚錧샩傚郼휞쒚륙ụ햚ሌꜮ냮ᱲ精йꔪ蛏ꅯ켠ۈㄙ堊쪋ⷖ뵕鯽ܮ歏搇諾ꆕ㓶单䞩䅭뛨Š鶀伝賺폑慫ろ䵶ꪥ輑嘫脀წʊ䳨ڣ籪砶䥗ﭛ岠窿ᚌ뮆푡ힷ뇉朅㒶ᗳ㕱逥瞡밟맿훯셿뎔됟줮핂瘍န龅뵾៤俉䬮䓛哉烱ס⒗죪ꂓ躟샩፰欖蓆Ӝ谰㾒ᕭ몝绬똮즼ᒭ䆥泭苽藡冀ᓛ맇꼷팷ᮼꜼᕋ蜯㲛젠廏ﲦꋛᛮ쭼㥆ᔿ窟ꎯ黽험䬧쇔囍掣辍씽㠮瓡綟韕ᐏ㔟壑Ⴁ鴋肀爠ⳙ䀬꼬톜幖菅番䃖鰴沪昫ꀪ淴ꂻ塆헆穢뉟ފ毓傳㐕좍한쌑玃㰌ⵊꐣ当꿃ㅥ碿쑳꼖鿕촞몦㵬渷2ꬿ溍㸃1㮉콹ࡌ竇콴ㇼ픙꽤㼈왆飈暑ྉ著웹돺㤳脴슼䯣铍ῨƵ焇䳝캚醋襘進䯵Ⱚ୧糪撁Ⲿ황ꨜ틏ܔﷰ₄'<save_to_csv>
for i in train_df['category_id']:
category_numbers[i]+=1
sub = pd.read_csv('.. /input/sample_submission.csv')
 pred_to_submit = decode(pred_compress_copy, sbase, len(sub))
sub['prediction'] = list(pred_to_submit)
 sub.to_csv('submission.csv', index=False )<import_modules>
few_shot = 0
for i in category_numbers[1:]:
if i <= 200:
few_shot+=1
<load_from_csv><EOS> 
few_shot/len(category_numbers )