Kaggle competition: Tabular Playground Series - Feb 2021
<SOS> metric: RMSE Kaggle data source: tabular-playground-series-feb-2021<train_model>
%matplotlib inline
dfk = pd.DataFrame({
'Kernel ID': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U'],
'Score': [ 0.84362, 0.84358, 0.84352, 0.84318, 0.84310, 0.84303, 0.84266, 0.84251, 0.84245, 0.84243, 0.84233, 0.84229, 0.84221, 0.84220, 0.84209, 0.84207, 0.84202, 0.84200, 0.84199, 0.84198, 0.84193],
'File Path': ['.. /input/feb84362/FEB84362.csv', '.. /input/feb84358/FEB84358.csv', '.. /input/feb84352/FEB84352.csv', '.. /input/feb84318/FEB84318.csv', '.. /input/feb84310/FEB84310.csv', '.. /input/feb84303/FEB84303.csv', '.. /input/feb84266/FEB84266.csv', '.. /input/feb84251/FEB84251.csv', '.. /input/feb84245/FEB84245.csv', '.. /input/feb84243/FEB84243.csv', '.. /input/feb84233/FEB84233.csv' , '.. /input/feb84229/FEB84229.csv', '.. /input/feb84221/FEB84221.csv', '.. /input/feb84220/FEB84220.csv', '.. /input/feb84209/FEB84209.csv', '.. /input/feb84207/FEB84207.csv', '.. /input/feb84202/FEB84202.csv', '.. /input/feb84200/FEB84200.csv', '.. /input/feb84199/FEB84199.csv', '.. /input/feb84198/FEB84198.csv', '.. /input/feb84193/FEB84193.csv']
})
 dfk
model.fit_one_cycle(10,max_lr=slice(1e-2,1e-4))<train_model>
def generate(main, support, coeff):
g = main.copy()
for i in main.columns[1:]:
res = []
lm, Is = [], []
lm = main[i].tolist()
ls = support[i].tolist()
for j in range(len(main)) :
res.append(( lm[j] * coeff)+(ls[j] *(1.- coeff)))
 g[i] = res
return g
model.fit_one_cycle(10,max_lr=slice(1e-2,1e-4))<train_model>
support = pd.read_csv(dfk.iloc[0, 2])
 for k in range(1, 6):
main = pd.read_csv(dfk.iloc[k, 2])
 support = generate(main, support, 0.60)
 sub1 = support
model.fit_one_cycle(10,max_lr=slice(1e-2,1e-4))<save_model>
support = sub1
for k in range(6, 14):
main = pd.read_csv(dfk.iloc[k, 2])
 support = generate(main, support, 0.50)
 sub2 = support
model.save('stage-1-resnet152' )<choose_model_class>
sub2 = comparison2(sub2, 10, 0.9970, 1.0000 )
interpreter = ClassificationInterpretation.from_learner(model)
<train_model>
support = sub2
for k in range(14, 20):
main = pd.read_csv(dfk.iloc[k, 2])
 support = generate(main, support, 0.40)
 sub3 = support
img = model.data.test_ds
img<save_to_csv>
sub3 = comparison3(sub3, 16, 1.0000, 0.9970)
preds, _ = model.get_preds(ds_type=DatasetType.Test)
 test_df.has_cactus = preds.numpy() [:,0]
test_df.to_csv('submission.csv', index=False )<set_options>
main = pd.read_csv(dfk.iloc[20, 2])
 sub4 = generate(main, sub3, 0.60 )
sns.set()<load_from_csv>
sub4 = comparison(sub4, 17, 0.9955, 0.9985 )
cactus_dir = ".. /input/aerial-cactus-identification/"
train_dir = cactus_dir + "/train/train/"
test_dir = cactus_dir + "/test/test/"
df_train_data = pd.read_csv(cactus_dir + "/train.csv")
 df_train_data['has_cactus'] = df_train_data['has_cactus'].astype(str)
 df_test = pd.read_csv(cactus_dir + "/sample_submission.csv" )<count_values>
original = pd.read_csv(".. /input/feb84186/FEB84186.csv")
 sub5 = comparison5(sub4, original, 18, 1.0000, 0.9960)
<filter><EOS> 
sub = sub5
sub.to_csv("submission.csv", index=False)
 sub1.to_csv("submission1.csv", index=False)
 sub2.to_csv("submission2.csv", index=False)
 sub3.to_csv("submission3.csv", index=False)
 sub4.to_csv("submission4.csv", index=False)
 sub5.to_csv("submission5.csv", index=False)
 !ls