Kaggle competition: Google Landmark Recognition Challenge
<SOS> metric: GoogleGlobalAP Kaggle data source: landmark-recognition-challenge<save_to_csv>
train = pd.read_csv('.. /input/train.csv')
 sub = pd.read_csv('.. /input/sample_submission.csv')
 pl.seed(0)
df_sub['question_type_spelling']=spelling
df_sub.iloc[:, 1:] = final_predictions
df_sub.to_csv('submission.csv', index=False )<import_modules>
probs = train.landmark_id.value_counts() / train.shape[0]
sub['landmark_id'] = train.landmark_id.iloc[pl.randint(0, train.shape[0], sub.shape[0])].values
sub['prob'] = probs[sub.landmark_id].values
sub['landmarks'] = sub.landmark_id.astype(str)+ ' ' + sub.prob.astype(str)
 sub[['id','landmarks']].to_csv('submission_1.csv', index=False)
 sub[['id','landmarks']].head()
<load_from_csv>
sub['landmarks'] = '%d %g' %(probs.index[0], probs[probs.index[0]])
 sub[['id','landmarks']].to_csv('submission_2.csv', index=False)
 sub[['id','landmarks']].head()
df1=pd.read_csv('/kaggle/input/kernel6e40bb3926/submission1.csv')
 df2a=pd.read_csv('/kaggle/input/part2a/submission2a.csv')
 df2b=pd.read_csv('/kaggle/input/part2b/submission2b.csv')
 df3a=pd.read_csv('/kaggle/input/part3a/submission1.csv')
 df3b=pd.read_csv('/kaggle/input/part3b/submission3b.csv')
 df4=pd.read_csv('/kaggle/input/part4/submission4.csv')
<concatenate>
N = 1000
probs = train.landmark_id.value_counts() / train.shape[0]
probs = probs.iloc[:N]
probs = pd.DataFrame({'landmark_id': probs.index,
'probability': probs.values}, index=pl.arange(N))
T = pd.merge(train, probs, on='landmark_id', how='inner')
 inx = pl.randint(0, T.shape[0], sub.shape[0])
 sub['landmark_id'] = T.landmark_id.iloc[inx].values
sub['prob'] = T.probability.iloc[inx].values
sub['landmarks'] = sub.landmark_id.astype(str)+ ' ' + sub.prob.astype(str)
 sub[['id','landmarks']].to_csv('submission_3.csv', index=False)
 sub[['id','landmarks']].head()
df_final=pd.concat([df1, df2a, df2b, df3a, df3b, df4])
 df_final.head()<save_to_csv>
N = 1000
probs = train.landmark_id.value_counts() / train.shape[0]
probs = probs.iloc[:N]
probs = pd.DataFrame({'landmark_id': probs.index,
'probability': 0.1}, index=pl.arange(N))
T = pd.merge(train, probs, on='landmark_id', how='inner')
 inx = pl.randint(0, T.shape[0], sub.shape[0])
 sub['landmark_id'] = T.landmark_id.iloc[inx].values
sub['prob'] = T.probability.iloc[inx].values
sub['landmarks'] = sub.landmark_id.astype(str)+ ' ' + sub.prob.astype(str)
 sub[['id','landmarks']].to_csv('submission_4.csv', index=False)
 sub[['id','landmarks']].head()
<set_options><EOS> 
train = pd.read_csv('.. /input/train.csv')
 sub = pd.read_csv('.. /input/sample_submission.csv')
 N = 2
probs = train.landmark_id.value_counts() / train.shape[0]
probs = probs.iloc[:N]
probs = pd.DataFrame({'landmark_id': probs.index,
'probability': 0.1}, index=pl.arange(N))
T = pd.merge(train, probs, on='landmark_id', how='inner')
 inx = pl.randint(0, T.shape[0], sub.shape[0])
 sub['landmark_id'] = T.landmark_id.iloc[inx].values
sub['prob'] = T.probability.iloc[inx].values
sub['landmarks'] = sub.landmark_id.astype(str)+ ' ' + sub.prob.astype(str)
 sub[['id','landmarks']].to_csv('submission_5.csv', index=False)
 sub[['id','landmarks']].head()