Kaggle competition: iWildCam 2020 - FGVC7
path = '.. /input/covid19-global-forecasting-week-3/'
train = pd.read_csv(path + 'train.csv')
 test = pd.read_csv(path + 'test.csv')
 sub = pd.read_csv(path + 'submission.csv')
 train['Date'] = train['Date'].apply(lambda x:(datetime.datetime.strptime(x, '%Y-%m-%d')))
 test['Date'] = test['Date'].apply(lambda x:(datetime.datetime.strptime(x, '%Y-%m-%d')))
 train['days'] =(train['Date'].dt.date - train['Date'].dt.date.min() ).dt.days
test['days'] =(test['Date'].dt.date - train['Date'].dt.date.min() ).dt.days
train.loc[train['Province_State'].isnull() , 'Province_State'] = 'N/A'
test.loc[test['Province_State'].isnull() , 'Province_State'] = 'N/A'
train['Area'] = train['Country_Region'] + '_' + train['Province_State']
test['Area'] = test['Country_Region'] + '_' + test['Province_State']
print(train['Date'].max())
 print(test['Date'].min())
 print(train['days'].max())
 N_AREAS = train['Area'].nunique()
AREAS = np.sort(train['Area'].unique())
 TRAIN_N = 77
print(train[train['days'] < TRAIN_N]['Date'].max())
 train.head()<compute_train_metric>
def eval1(y, p):
val_len = y.shape[1] - TRAIN_N
return np.sqrt(mean_squared_error(y[:, TRAIN_N:TRAIN_N+val_len].flatten() , p[:, TRAIN_N:TRAIN_N+val_len].flatten()))
def run_c(params, X, test_size=50):
gr_base = []
gr_base_factor = []
x_min = np.ma.MaskedArray(X, X<1)
 x_min = x_min.argmin(axis=1)
 for i in range(X.shape[0]):
temp = X[i,:]
threshold = np.log(1+params['min cases for growth rate'])
 num_days = params['last N days']
if(temp > threshold ).sum() > num_days:
gr_base.append(np.clip(np.diff(temp[temp > threshold])[-num_days:].mean() , 0, params['growth rate max']))
gr_base_factor.append(np.clip(np.diff(np.diff(temp[temp > threshold])) [-num_days:].mean() , -0.2, params["growth rate factor max"]))
else:
gr_base.append(params['growth rate default'])
 gr_base_factor.append(params['growth rate factor'])
 gr_base = np.array(gr_base)
 gr_base_factor = np.array(gr_base_factor)
 preds = X.copy()
for i in range(test_size):
delta = np.clip(preds[:, -1], np.log(2), None)+ gr_base *(1 + params['growth rate factor']*(1 + params['growth rate factor factor'])**(i)) **(i)
 preds = np.hstack(( preds, delta.reshape(-1,1)))
 return preds
params = {
"min cases for growth rate": 30,
"last N days": 6,
"growth rate default": 0.3,
"growth rate max": 0.35,
"growth rate factor max": -0.01,
"growth rate factor": -0.05,
"growth rate factor factor": 0.005,
}
x = train_p_c[train_p_c.index=="China_Qinghai"]
x = train_p_c
preds_c_1 = run_c(params, np.log(1+x.values)[:,:TRAIN_N])
<compute_test_metric>
import numpy as np
import pandas as pd
import torch
import os
from torch import nn
from torch import optim
from torchvision import datasets, transforms, models
warnings.filterwarnings("ignore")
 def f(x, K, a, x0):
return K * x ** a * np.exp(-x/x0)
 def eval1(y, p):
val_len = y.shape[1] - TRAIN_N
return np.sqrt(mean_squared_error(y[:, TRAIN_N:TRAIN_N+val_len].flatten() , p[:, TRAIN_N:TRAIN_N+val_len].flatten()))
def run(params, X, X_change, test_size=50):
print(X)
 x_mins = np.ma.MaskedArray(X, X<10)
 x_mins = x_mins.argmin(axis=1)
 print(x_mins)
 popts = []
scores = []
for i in tqdm(range(X_change.shape[0])) :
if X[i,:].sum() == 0:
x_mins[i] = X.shape[1] - 1
best_score = 100
best_popt = [1,1,1]
x_min_max = X_change.shape[1]
x_min_max = np.minimum(x_mins[i] + 10, X_change.shape[1])
 early_stopping = 5
early_stopping_count = 0
for x_min in np.arange(x_mins[i], x_min_max):
x = np.arange(x_min, X_change.shape[1])- x_min
y = X_change[i, x_min:]
try:
popt, pcov = curve_fit(f, x,y, bounds=(0, [10, 5, np.max(x)]))
except:
popt = [1,1,1]
p = np.zeros(X_change.shape[1])
 p[x_min:] = f(x, *popt)
 p = np.cumsum(p, axis=0)
 score = np.sqrt(mean_squared_error(np.log1p(X[i,:]), np.log1p(p)))
 if score < best_score:
best_score = score
best_popt = popt
x_mins[i] = x_min
else:
early_stopping_count += 1
if early_stopping_count >= early_stopping:
continue
popts.append(best_popt)
 scores.append(best_score)
 preds = X_change.copy()
preds_new = np.zeros(( X.shape[0], test_size))
for i in range(X.shape[0]):
x = np.arange(X.shape[1], test_size+X.shape[1])- x_mins[i]
y = f(x, *popts[i])
 y = y[-test_size-X.shape[1]:]
preds_new[i,:] = y
preds = np.hstack(( preds, preds_new))
preds = np.cumsum(preds, axis=1)
 return preds, x_mins, scores
x1 = train_p_c
x = train_p_c.values[:,:TRAIN_N]
x_c = train_p_c_change.values[:,:TRAIN_N]
params = {}
preds_c_pl, x_mins, scores = run(params, x, x_c)
 preds_c_pl = np.log1p(preds_c_pl)
<prepare_output>
preds_c = preds_c_1.copy()
idx = np.where(x_mins<100)
 preds_c[idx] = 0.8 * preds_c_1[idx] + 0.2 * preds_c_pl[idx]
for i in range(N_AREAS):
if 'China' in AREAS[i] and preds_c[i, TRAIN_N-1] < np.log(31):
preds_c[i, TRAIN_N:] = preds_c[i, TRAIN_N-1] 
<prepare_x_and_y>
test_dir = '/kaggle/input/iwildcam-2020-fgvc7/test/'
train_dir = '/kaggle/input/iwildcam-2020-fgvc7/train/'
f_rate =(train_p_f / train_p_c ).fillna(0)
 X_c = np.log(1+train_p_c.values)[:,:TRAIN_N]
X_f = train_p_f.values[:,:TRAIN_N]<normalization>
nopen_train = ['/kaggle/input/iwildcam-2020-fgvc7/train/883572ba-21bc-11ea-a13a-137349068a90.jpg',
'/kaggle/input/iwildcam-2020-fgvc7/train/8792549a-21bc-11ea-a13a-137349068a90.jpg',
'/kaggle/input/iwildcam-2020-fgvc7/train/99136aa6-21bc-11ea-a13a-137349068a90.jpg',
'/kaggle/input/iwildcam-2020-fgvc7/train/8f17b296-21bc-11ea-a13a-137349068a90.jpg',
'/kaggle/input/iwildcam-2020-fgvc7/train/896c1198-21bc-11ea-a13a-137349068a90.jpg',
'/kaggle/input/iwildcam-2020-fgvc7/train/87022118-21bc-11ea-a13a-137349068a90.jpg']
def lin_w(sz):
res = np.linspace(0, 1, sz+1, endpoint=False)[1:]
return np.append(res, np.append([1], res[::-1]))
def run_f(params, X_c, X_f, X_f_r, test_size=50):
X_f_r = np.array(np.ma.mean(np.ma.masked_outside(X_f_r, 0.06, 0.4)[:,:], axis=1))
X_f_r = np.clip(X_f_r, params['fatality_rate_lower'], params['fatality_rate_upper'])
 X_c = np.clip(np.exp(X_c)-1, 0, None)
 preds = X_f.copy()
train_size = X_f.shape[1] - 1
for i in range(test_size):
t_lag = train_size+i-params['length']
t_wsize = 3
delta = np.average(np.diff(X_c, axis=1)[:, t_lag-t_wsize:t_lag+1+t_wsize], axis=1)
 delta = params['absolute growth'] + delta * X_f_r
preds = np.hstack(( preds, preds[:, -1].reshape(-1,1)+ delta.reshape(-1,1)))
 return preds
params = {
"length": 6,
"absolute growth": 0.02,
"fatality_rate_lower": 0.035,
"fatality_rate_upper": 0.40,
}
preds_f_1 = run_f(params, preds_c, X_f, f_rate.values[:,:TRAIN_N])
 preds_f_1 = np.log(1+preds_f_1)
 preds_f_1 = np.log1p(0.9*(np.exp(preds_f_1)-1)) 
<prepare_output>
nopen_train_id = [i[40:-4] for i in nopen_train]
preds_f = preds_f_1<compute_test_metric>
with open('/kaggle/input/iwildcam-2020-fgvc7/iwildcam2020_train_annotations.json', 'r', errors='ignore')as f:
train_annotations = json.load(f )
if False:
val_len = train_p_c.values.shape[1] - TRAIN_N
for i in range(val_len):
d = i + TRAIN_N
m1 = np.sqrt(mean_squared_error(np.log(1 + train_p_c.values[:, d]), preds_c[:, d]))
m2 = np.sqrt(mean_squared_error(np.log(1 + train_p_f.values[:, d]), preds_f[:, d]))
print(f"{d}: {(m1 + m2)/2:8.5f} [{m1:8.5f} {m2:8.5f}]")
 print()
m1 = np.sqrt(mean_squared_error(np.log(1 + train_p_c.values[:, TRAIN_N:TRAIN_N+val_len] ).flatten() , preds_c[:, TRAIN_N:TRAIN_N+val_len].flatten()))
m2 = np.sqrt(mean_squared_error(np.log(1 + train_p_f.values[:, TRAIN_N:TRAIN_N+val_len] ).flatten() , preds_f[:, TRAIN_N:TRAIN_N+val_len].flatten()))
print(f"{(m1 + m2)/2:8.5f} [{m1:8.5f} {m2:8.5f}]" )<categorify>
samp_sub = pd.read_csv('/kaggle/input/iwildcam-2020-fgvc7/sample_submission.csv' )
temp = pd.DataFrame(np.clip(np.exp(preds_c)- 1, 0, None))
temp['Area'] = AREAS
temp = temp.melt(id_vars='Area', var_name='days', value_name="ConfirmedCases")
 test = test.merge(temp, how='left', left_on=['Area', 'days'], right_on=['Area', 'days'])
 temp = pd.DataFrame(np.clip(np.exp(preds_f)- 1, 0, None))
temp['Area'] = AREAS
temp = temp.melt(id_vars='Area', var_name='days', value_name="Fatalities")
 test = test.merge(temp, how='left', left_on=['Area', 'days'], right_on=['Area', 'days'])
 test.head()<save_to_csv>
with open('/kaggle/input/iwildcam-2020-fgvc7/iwildcam2020_test_information.json', 'r', errors='ignore')as f:
test_information = json.load(f )
test.to_csv("submission.csv", index=False, columns=["ForecastId", "ConfirmedCases", "Fatalities"] )<sort_values>
train_ann = pd.DataFrame(train_annotations['annotations'] )
for i, rec in test.groupby('Area' ).last().sort_values("ConfirmedCases", ascending=False ).iterrows() :
print(f"{rec['ConfirmedCases']:10.1f} {rec['Fatalities']:10.1f} {rec['Country_Region']}, {rec['Province_State']}")
<set_options>
train_ann_image_index = train_ann.set_index('image_id' )
warnings.filterwarnings('ignore')
 plt.style.use('ggplot')
<set_options>
train_ann_filename_order = train_ann_image_index.loc[train_filenames]
pd.set_option('display.max_columns', 50 )<load_from_csv>
train = train_ann_filename_order.reset_index()
df_train = pd.read_csv('/kaggle/input/homework-for-students4plus/train.csv', index_col=0)
 df_test = pd.read_csv('/kaggle/input/homework-for-students4plus/test.csv', index_col=0 )<merge>
train_y = train['category_id'].values
df_train_earliest = pd.merge(df_train['issue_d'].str[-4:], df_train,left_index=True, right_index=True)
 df_train_earliest = df_train_earliest.rename(columns = {'issue_d_x':'issue_d_year'})
 df_train_earliest = pd.merge(df_train['issue_d'].str[:3], df_train_earliest,left_index=True, right_index=True)
 df_train_earliest = df_train_earliest.rename(columns = {'issue_d':'issue_d_month'})
 df_train_earliest = df_train_earliest.rename(columns = {'issue_d_y':'issue_d'})
 df_test_earliest = pd.merge(df_test['issue_d'].str[-4:], df_test,left_index=True, right_index=True)
 df_test_earliest = df_test_earliest.rename(columns = {'issue_d_x':'issue_d_year'})
 df_test_earliest = pd.merge(df_test['issue_d'].str[:3], df_test_earliest,left_index=True, right_index=True)
 df_test_earliest = df_test_earliest.rename(columns = {'issue_d':'issue_d_month'})
 df_test_earliest = df_test_earliest.rename(columns = {'issue_d_y':'issue_d'})
 df_train = df_train_earliest
df_test = df_test_earliest
df_train['issue_d_month_mm'] = df_train['issue_d_month'].replace({'Jan':'01','Feb':'02','Mar':'03','Apr':'04','May':'05','Jun':'06','Jul':'07','Aug': '08','Sep': '09','Oct': '10','Nov': '11','Dec': '12'})
 df_test['issue_d_month_mm'] = df_test['issue_d_month'].replace({'Jan':'01','Feb':'02','Mar':'03','Apr':'04','May':'05','Jun':'06','Jul':'07','Aug': '08','Sep': '09','Oct': '10','Nov': '11','Dec': '12'})
 df_train['issue_d_yyyymm'] = df_train['issue_d_year'].str.cat(df_train['issue_d_month_mm'])
 df_test['issue_d_yyyymm'] = df_test['issue_d_year'].str.cat(df_test['issue_d_month_mm'])
 df_train['issue_d_yyyymm'] = df_train['issue_d_yyyymm'].fillna(-9999)
 df_train['issue_d_yyyymm'] = df_train['issue_d_yyyymm'].astype(int)
 df_test['issue_d_yyyymm'] = df_test['issue_d_yyyymm'].fillna(-9999)
 df_test['issue_d_yyyymm'] = df_test['issue_d_yyyymm'].astype(int)
 df_train['issue_d_year'] = df_train['issue_d_year'].fillna(-9999)
 df_train['issue_d_year'] = df_train['issue_d_year'].astype(int)
 df_test['issue_d_year'] = df_test['issue_d_year'].fillna(-9999)
 df_test['issue_d_year'] = df_test['issue_d_year'].astype(int)
 df_train['issue_d_month'] = df_train['issue_d_month'].replace({'Jan':1,'Feb':2,'Mar':3,'Apr':4,'May':5,'Jun':6,'Jul':7,'Aug': 8,'Sep': 9,'Oct': 10,'Nov': 11,'Dec': 12})
 df_test['issue_d_month'] = df_test['issue_d_month'].replace({'Jan':1,'Feb':2,'Mar':3,'Apr':4,'May':5,'Jun':6,'Jul':7,'Aug': 8,'Sep': 9,'Oct': 10,'Nov': 11,'Dec': 12})
 df_train['issue_d_month'] = df_train['issue_d_month'].fillna(-9999)
 df_train['issue_d_month'] = df_train['issue_d_month'].astype(int)
 df_test['issue_d_month'] = df_test['issue_d_month'].fillna(-9999)
 df_test['issue_d_month'] = df_test['issue_d_month'].astype(int)
<filter>
df_train = df_train[df_train['issue_d_yyyymm'] >= 201401]<define_variables>
cat = []
num = []
for col in df_train.columns:
if df_train[col].dtype == 'object':
cat.append(col)
 else:
num.append(col )<define_variables>
train_torch_y = torch.tensor(train_y, dtype=torch.long ).view(2247, 97 )
df_train['mths_since_last_delinq']+ df_train['mths_since_last_major_derog'] +df_train['mths_since_last_record']<feature_engineering>
data_transforms_train = transforms.Compose([transforms.RandomResizedCrop(224),
transforms.ToTensor() ,
transforms.Normalize([0.485, 0.456, 0.406],
[0.229, 0.224, 0.225])])
 image_datasets_train = ImageFolder(train_dir, transform=data_transforms_train)
 dataloaders_train = torch.utils.data.DataLoader(image_datasets_train, batch_size=97 )
df_train.loc[df_train['tot_cur_bal'].isnull() , 'tot_cur_bal'] = df_train[df_train['tot_cur_bal'].isnull() ]['loan_amnt']
df_test.loc[df_test['tot_cur_bal'].isnull() , 'tot_cur_bal'] = df_test[df_test['tot_cur_bal'].isnull() ]['loan_amnt']<feature_engineering>
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
 model = models.vgg16_bn(pretrained=True)
 for param in model.parameters() :
param.requires_grad = False
df_train['installment/annual_inc'] = df_train['installment']/(df_train['annual_inc']/12)
 df_test['installment/annual_inc'] = df_test['installment']/(df_test['annual_inc']/12)
<feature_engineering>
model.classifier = nn.Sequential(nn.Linear(25088, 1024),
nn.ReLU() ,
nn.Dropout(0.2),
nn.Linear(1024, 572),
nn.LogSoftmax(dim=1))
df_train['loan_amnt/installment'] = df_train['loan_amnt']/df_train['installment']
df_test['loan_amnt/installment'] = df_test['loan_amnt']/df_test['installment'] 
<merge>
criterion = nn.NLLLoss()
optimizer = optim.Adam(model.classifier.parameters() , lr=0.003 )
sr_train_addr = df_train['addr_state'].str.cat(df_train['zip_code'])
 sr_test_addr = df_test['addr_state'].str.cat(df_test['zip_code'])
 df_train_addr = pd.DataFrame(sr_train_addr)
 df_test_addr = pd.DataFrame(sr_test_addr)
 df_train_addr = df_train_addr.rename(columns = {'addr_state':'address'})
 df_test_addr = df_test_addr.rename(columns = {'addr_state':'address'})
 df_train = pd.merge(df_train_addr, df_train,left_index=True, right_index=True)
 df_test = pd.merge(df_test_addr, df_test,left_index=True, right_index=True )<data_type_conversions>
model.to(device )
df_train['emp_title'] = df_train['emp_title'].str.lower()
df_test['emp_title'] = df_test['emp_title'].str.lower()<string_transform>
epochs = 2
steps = 0
running_loss = 0
print_every = 100
for epoch in range(epochs):
for inputs, labels in zip(dataloaders_train,train_torch_y):
steps += 1
inputs, labels = inputs[0].to(device), labels.to(device)
 optimizer.zero_grad()
logps = model.forward(inputs)
 loss = criterion(logps, labels)
 loss.backward()
optimizer.step()
running_loss += loss.item()
if steps % print_every == 0:
print(f"Epoch {epoch+1}/{epochs}.. "
f"Train loss: {running_loss/print_every:.3f}.. ")
 running_loss = 0
if steps % 200 == 0:
break
df_train_emp_title_split = df_train['emp_title'].str.split(' ', expand=True)
 df_test_emp_title_split = df_test['emp_title'].str.split(' ', expand=True)
 df_train_emp_title_split = df_train_emp_title_split.replace('',None)
 df_test_emp_title_split = df_test_emp_title_split.replace('',None)
 df_train_emp_title_split_count = df_train_emp_title_split.count(axis=1)
 df_test_emp_title_split_count = df_test_emp_title_split.count(axis=1)
 df_train_emp_title_split_count = pd.DataFrame(df_train_emp_title_split_count)
 df_test_emp_title_split_count = pd.DataFrame(df_test_emp_title_split_count)
 df_train_e = df_train_emp_title_split_count.rename(columns = {0:'emp_title_word_count'})
 df_test_e = df_test_emp_title_split_count.rename(columns = {0:'emp_title_word_count'})
 df_train = pd.merge(df_train_e, df_train,left_index=True, right_index=True)
 df_test = pd.merge(df_test_e, df_test,left_index=True, right_index=True)
<count_missing_values>
model.eval()
top_c = []
top_probs = []
with torch.no_grad() :
for inputs, labels in dataloaders_test:
inputs = inputs.to(device)
 logps = model.forward(inputs)
 ps = torch.exp(logps)
 top_p, top_class = ps.topk(1, dim=1)
 top_c.append(top_class)
 model.train()
df_train_nan_s = df_train.isnull().sum(axis=1)
 df_test_nan_s = df_test.isnull().sum(axis=1 )<create_dataframe>
topc_list = [torch.Tensor.cpu(i ).numpy().tolist() for i in top_c]
df_train_nan = pd.DataFrame(df_train_nan_s)
 df_test_nan = pd.DataFrame(df_test_nan_s )<rename_columns>
topc_list1 = reduce(lambda x,y: x+y, topc_list)
 topc_list2 = reduce(lambda x,y: x+y, topc_list1 )
df_train_nan = df_train_nan.rename(columns = {0:'nan_count'})
 df_test_nan = df_test_nan.rename(columns = {0:'nan_count'} )<merge>
sub = samp_sub.copy()
df_train = pd.merge(df_train_nan, df_train,left_index=True, right_index=True)
 df_test = pd.merge(df_test_nan, df_test,left_index=True, right_index=True )<create_dataframe>
sub_image_index = sub.set_index('Id' )
def len_col_add(column,change_column,df_train,df_test):
df_train_change_len = df_train[column].str.len().fillna(0)
 df_test_change_len = df_test[column].str.len().fillna(0)
 df_train_change_len_next = pd.DataFrame(df_train_change_len)
 df_test_change_len_next = pd.DataFrame(df_test_change_len)
 df_train_change_len_next = df_train_change_len_next.rename(columns = {column:change_column})
 df_test_change_len_next = df_test_change_len_next.rename(columns = {column:change_column})
 df_train = pd.merge(df_train_change_len_next, df_train,left_index=True, right_index=True)
 df_test = pd.merge(df_test_change_len_next, df_test,left_index=True, right_index=True)
 return df_train,df_test<concatenate>
test_fn_sub = [i for i in test_filenames if i in sub_image_index.index.values]
df_train,df_test = len_col_add('emp_title','emp_title_len',df_train,df_test )<concatenate>
not_in_sub = [i for i in test_filenames if i not in sub_image_index.index.values]
df_train,df_test = len_col_add('title','title_len',df_train,df_test )<concatenate>
extra_index = [test_filenames.index(i)for i in not_in_sub]
df_train,df_test = len_col_add('home_ownership','home_ownership_len',df_train,df_test )<concatenate>
topc_ser_drop_extra = topc_ser.drop(extra_index ).reset_index()
df_train,df_test = len_col_add('purpose','purpose_len',df_train,df_test )<merge>
sub_filename_order = sub_image_index.loc[test_fn_sub]
df_train_earliest = pd.merge(df_train['earliest_cr_line'].str[-4:], df_train,left_index=True, right_index=True)
 df_train_earliest = df_train_earliest.rename(columns = {'earliest_cr_line_x':'earliest_cr_line_year'})
 df_train_earliest = pd.merge(df_train['earliest_cr_line'].str[:3], df_train_earliest,left_index=True, right_index=True)
 df_train_earliest = df_train_earliest.rename(columns = {'earliest_cr_line':'earliest_cr_line_month'})
 df_train_earliest = df_train_earliest.rename(columns = {'earliest_cr_line_y':'earliest_cr_line'})
 df_test_earliest = pd.merge(df_test['earliest_cr_line'].str[-4:], df_test,left_index=True, right_index=True)
 df_test_earliest = df_test_earliest.rename(columns = {'earliest_cr_line_x':'earliest_cr_line_year'})
 df_test_earliest = pd.merge(df_test['earliest_cr_line'].str[:3], df_test_earliest,left_index=True, right_index=True)
 df_test_earliest = df_test_earliest.rename(columns = {'earliest_cr_line':'earliest_cr_line_month'})
 df_test_earliest = df_test_earliest.rename(columns = {'earliest_cr_line_y':'earliest_cr_line'})
 df_train = df_train_earliest
df_test = df_test_earliest<data_type_conversions>
sub_filename_order['Category'] = topc_ser_drop_extra[0].values
df_train['earliest_cr_line_year'] = df_train['earliest_cr_line_year'].fillna(-9999)
 df_train['earliest_cr_line_year'] = df_train['earliest_cr_line_year'].astype(int)
 df_test['earliest_cr_line_year'] = df_test['earliest_cr_line_year'].fillna(-9999)
 df_test['earliest_cr_line_year'] = df_test['earliest_cr_line_year'].astype(int )<categorify>
sub_filename_order_cat = sub_filename_order.reset_index()
<data_type_conversions><EOS> 
sub_filename_order_cat.to_csv('submission.csv', index=False )