Kaggle competition: Mechanisms of Action (MoA) Prediction
<SOS> metric: MeanColumnwiseLogLoss Kaggle data source: mechanisms-of-action-(moa)-prediction<load_from_csv>
!pip install --no-index --find-links /kaggle/input/pytorchtabnet/pytorch_tabnet-2.0.0-py3-none-any.whl pytorch-tabnet
test_df = pd.read_csv(".. /input/cassava-leaf-disease-classification/sample_submission.csv")
 image_path = ".. /input/cassava-leaf-disease-classification/test_images/"
test_targets = test_df.label.values
test_aug = albu.Compose([
albu.CenterCrop(512, 512, p=1.) ,
albu.Resize(384, 384),
albu.Normalize(
 mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225],
max_pixel_value=255.0,
p=1.0),
ToTensorV2() ], p=1.)
test_dataset=CassavaDataset(
 df=test_df,
imfolder=image_path,
train=False,
transforms=test_aug 
)
 test_loader = DataLoader(
 test_dataset,
batch_size=4,
num_workers=4,
shuffle=False,
)<categorify>
warnings.filterwarnings("ignore")
 sys.path.append(".. /input/rank-gauss")
 os.environ["CUDA_LAUNCH_BLOCKING"] = '1'
c_ = Fore.CYAN
m_ = Fore.MAGENTA
r_ = Fore.RED
b_ = Fore.BLUE
y_ = Fore.YELLOW
g_ = Fore.GREEN
predictions=[]
for imgs in test_loader:
imgs = imgs.to(device)
 with torch.no_grad() :
model=model.to(device)
 outputs = model(imgs)
 _, predicted = torch.max(outputs, dim=1)
 predicted=predicted.to('cpu')
 predictions.append(predicted)
<concatenate>
from sklearn.preprocessing import QuantileTransformer
test_df['label'] = np.concatenate(predictions)
<save_to_csv>
train_features = pd.read_csv('.. /input/lish-moa/train_features.csv')
 train_targets_scored = pd.read_csv('.. /input/lish-moa/train_targets_scored.csv')
 train_targets_nonscored = pd.read_csv('.. /input/lish-moa/train_targets_nonscored.csv')
 test_features = pd.read_csv('.. /input/lish-moa/test_features.csv')
 df = pd.read_csv('.. /input/lish-moa/sample_submission.csv' )
test_df.to_csv('submission.csv', index=False )<set_options>
train_features2=train_features.copy()
test_features2=test_features.copy()
np.random.seed(1)
 get_ipython().magic('matplotlib inline')
 print(tf.__version__ )<load_from_csv>
GENES = [col for col in train_features.columns if col.startswith('g-')]
CELLS = [col for col in train_features.columns if col.startswith('c-')]
train_path=".. /input/digit-recognizer/train.csv"
test_path=".. /input/digit-recognizer/test.csv"
train = pd.read_csv(train_path)
 test= pd.read_csv(test_path)
 print(train.shape)
 print(test.shape)
 train.head()<train_model>
qt = QuantileTransformer(n_quantiles=100,random_state=42,output_distribution='normal')
 train_features[GENES+CELLS] = qt.fit_transform(train_features[GENES+CELLS])
 test_features[GENES+CELLS] = qt.transform(test_features[GENES+CELLS] )
x = x.values.reshape(-1,28,28,1)
 print("x shape: ",x.shape)
 y = to_categorical(y, num_classes = 10)
 print("y shape: ",y.shape)
 print(y[10])
 plt.imshow(-x[10][:,:,0],cmap='gray')
 plt.axis(False)
 plt.show()<split>
seed = 42
def set_seed(seed):
random.seed(seed)
 np.random.seed(seed)
 torch.manual_seed(seed)
 os.environ["PYTHONHASHSEED"] = str(seed)
 if torch.cuda.is_available() :
torch.cuda.manual_seed(seed)
 torch.cuda.manual_seed_all(seed)
 torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
set_seed(seed )
X_train, X_val, Y_train, Y_val = train_test_split(x, y, test_size = 0.2, random_state=1)
 print("x_train shape",X_train.shape)
 print("x_val shape",X_val.shape)
 print("y_train shape",Y_train.shape)
 print("y_val shape",Y_val.shape )<train_model>
n_comp = 600
gpca= load(open('.. /input/moa-tabnet-train-inference/gpca.pkl', 'rb'))
train2=(gpca.transform(train_features[GENES]))
test2 =(gpca.transform(test_features[GENES]))
train_gpca = pd.DataFrame(train2, columns=[f'pca_G-{i}' for i in range(n_comp)])
 test_gpca = pd.DataFrame(test2, columns=[f'pca_G-{i}' for i in range(n_comp)])
 train_features = pd.concat(( train_features, train_gpca), axis=1)
 test_features = pd.concat(( test_features, test_gpca), axis=1 )
datagen = ImageDataGenerator(rotation_range = 10,
zoom_range = 0.1,
width_shift_range = 0.1,
height_shift_range = 0.1,
horizontal_flip = False,
vertical_flip = False)
 datagen.fit(X_train )<define_search_space>
n_comp = 50
cpca= load(open('.. /input/moa-tabnet-train-inference/cpca.pkl', 'rb'))
train2=(cpca.transform(train_features[CELLS]))
test2 =(cpca.transform(test_features[CELLS]))
train_cpca = pd.DataFrame(train2, columns=[f'pca_C-{i}' for i in range(n_comp)])
 test_cpca = pd.DataFrame(test2, columns=[f'pca_C-{i}' for i in range(n_comp)])
 train_features = pd.concat(( train_features, train_cpca), axis=1)
 test_features = pd.concat(( test_features, test_cpca), axis=1 )
Image = [[0,0,0],
[0,1,1],
[0,1,2]]
kernel = [[-4,0,0],
[0,0,0],
[0,0,4]]
result = signal.convolve(Image,kernel,'valid')
 result2 = 4*0 + 0*0 + 0*0 + 0*0 + 0*1 + 0*1 + 0*1 + 0*0 + -4*2
print("Result with scipy: {}
Result with manual calculs : {}".format(result,result2))
print("
With 'same':
{}".format(signal.convolve(Image,kernel,'same')))
 print("
With 'padding':
{}".format(signal.convolve(Image,kernel,'full')) )<choose_model_class>
c_n = [f for f in list(train_features.columns)if f not in ['sig_id', 'cp_type', 'cp_time', 'cp_dose']]
mask =(train_features[c_n].var() >= 0.85 ).values
tmp = train_features[c_n].loc[:, mask]
train_features = pd.concat([train_features[['sig_id', 'cp_type', 'cp_time', 'cp_dose']], tmp], axis=1)
 tmp = test_features[c_n].loc[:, mask]
test_features = pd.concat([test_features[['sig_id', 'cp_type', 'cp_time', 'cp_dose']], tmp], axis=1 )
def define_model(actifun="elu",actifundense1="elu",actifundense2="softsign",optimizer="Adam"):
model = model = Sequential([
Conv2D(32,(3, 3), padding = 'same', activation = 'relu', input_shape =(28,28,1)) ,
BatchNormalization() ,
Conv2D(32,(3, 3), padding = 'same', activation = 'relu'),
BatchNormalization() ,
MaxPool2D(2, 2),
Dropout(0.2),
Conv2D(64,(3, 3), padding = 'same', activation = 'relu'),
BatchNormalization() ,
Conv2D(64,(3, 3), padding = 'same', activation = 'relu'),
BatchNormalization() ,
MaxPool2D(2, 2),
Dropout(0.2),
Conv2D(128,(3, 3), padding = 'same', activation = 'relu'),
BatchNormalization() ,
Conv2D(128,(3, 3), padding = 'same', activation = 'relu'),
BatchNormalization() ,
MaxPool2D(2, 2),
Dropout(0.2),
Flatten() ,
Dense(256, activation = 'relu'),
Dropout(0.25),
Dense(10, activation = 'softmax')
 ])
 model.compile(optimizer = optimizer , loss = "categorical_crossentropy", metrics=["accuracy"])
 return model
model = define_model()
model.summary()<split>
def fe_cluster_genes(train, test, n_clusters_g = 22, SEED = 42):
features_g = GENES
def create_cluster(train, test, features, kind = 'g', n_clusters = n_clusters_g):
train_ = train[features].copy()
test_ = test[features].copy()
kmeans_genes = load(open('.. /input/moa-tabnet-train-inference/kmeans_genes.pkl', 'rb'))
train[f'clusters_{kind}'] = kmeans_genes.predict(train_.values)
 test[f'clusters_{kind}'] = kmeans_genes.predict(test_.values)
 train = pd.get_dummies(train, columns = [f'clusters_{kind}'])
 test = pd.get_dummies(test, columns = [f'clusters_{kind}'])
 return train, test
train, test = create_cluster(train, test, features_g, kind = 'g', n_clusters = n_clusters_g)
 return train, test
train_features2 ,test_features2=fe_cluster_genes(train_features2,test_features2 )
%%time
X_train_train, X_train_val, Y_train_train, Y_train_val = train_test_split(X_train, Y_train, test_size = 0.3, random_state = 0)
 models={}
history={}
optim_list = ["Adam","RMSprop"]
lr_sched = ReduceLROnPlateau(monitor = 'val_acc',
patience = 10,
verbose = 1,
factor = 0.1,
min_lr = 0.00001)
 early_stopping = EarlyStopping(monitor = 'val_acc',
patience = 10,
verbose = 1,
mode = 'auto',
restore_best_weights = True)
 epochs=50
batch_size = 200
for optim in optim_list:
for fun in ["elu","relu"]:
fun1 = fun
fun2 = fun
print(" ")
 print(" ")
 mtype = optim + ' + ' + fun1 + ' + ' + fun2 + ' + ' + "softsign"
print(mtype)
 print(" ")
 models[mtype] = define_model(fun1,fun2,"softsign",optim)
 history[mtype] = models[mtype].fit(X_train,Y_train,
validation_split=0.2,epochs=epochs
,shuffle=True,steps_per_epoch=X_train.shape[0] // batch_size,
callbacks=[lr_sched,early_stopping] )<compute_test_metric>
def fe_cluster_cells(train, test, n_clusters_c = 4, SEED = 42):
features_c = CELLS
def create_cluster(train, test, features, kind = 'c', n_clusters = n_clusters_c):
train_ = train[features].copy()
test_ = test[features].copy()
kmeans_cells = load(open('.. /input/moa-tabnet-train-inference/kmeans_cells.pkl', 'rb'))
train[f'clusters_{kind}'] = kmeans_cells.predict(train_.values)
 test[f'clusters_{kind}'] = kmeans_cells.predict(test_.values)
 train = pd.get_dummies(train, columns = [f'clusters_{kind}'])
 test = pd.get_dummies(test, columns = [f'clusters_{kind}'])
 return train, test
train, test = create_cluster(train, test, features_c, kind = 'c', n_clusters = n_clusters_c)
 return train, test
train_features2 ,test_features2=fe_cluster_cells(train_features2,test_features2 )
rslts={}
k=0
for optim in optim_list:
for fun in ["elu","relu"]:
fun1 = fun
fun2 = fun
fun3 = "softsign"
mtype = optim + ' + ' + fun1 + ' + ' + fun2 + ' + ' + fun3
rslts[mtype] =(models[mtype].evaluate(X_val, Y_val, verbose = 0)[1])
 k=k+1
for item in sorted(rslts.items() , key=lambda x: x[1],reverse=True):
print(item[0])
 print(item[1])
 print(" ")
 plt.figure(figsize=(30,30))
i=0
fun ="elu"
fun1 = fun
fun2 = fun
fun3 = "softsign"
mtype = optim + ' + ' + fun1 + ' + ' + fun2 + ' + ' + fun3
plt.subplot(2,1,i+1)
 plt.plot(history[mtype].history['loss'], label='loss')
 plt.plot(history[mtype].history['val_loss'], color='b', label='val_loss')
 plt.title("mtype")
 plt.xlabel("Number of Epochs")
 plt.ylabel("Loss")
 plt.legend()
i = i +1
plt.show()<train_model>
train_pca=pd.concat(( train_gpca,train_cpca),axis=1)
 test_pca=pd.concat(( test_gpca,test_cpca),axis=1 )
datagen.fit(x)
 X_train, X_val, Y_train, Y_val = train_test_split(x, y, test_size = 0.1, random_state = 0)
 lr_sched = ReduceLROnPlateau(monitor = 'val_acc',
patience = 10,
verbose = 1,
factor = 0.1,
min_lr = 0.00001)
 early_stopping = EarlyStopping(monitor = 'val_acc',
patience = 10,
verbose = 1,
mode = 'auto',
restore_best_weights = True)
 epochs=50
batch_size = 200
model = define_model("elu","elu","softsign","RMSprop")
 history_final = model.fit(datagen.flow(X_train,Y_train, batch_size = batch_size),
epochs = epochs,
steps_per_epoch = X_train.shape[0] // batch_size,
validation_data =(X_val, Y_val),
callbacks = [lr_sched, early_stopping] )<load_from_csv>
def fe_cluster_pca(train, test,n_clusters=5,SEED = 42):
kmeans_pca = load(open('.. /input/moa-tabnet-train-inference/kmeans_pca.pkl', 'rb'))
train[f'clusters_pca'] = kmeans_pca.predict(train.values)
 test[f'clusters_pca'] = kmeans_pca.predict(test.values)
 train = pd.get_dummies(train, columns = [f'clusters_pca'])
 test = pd.get_dummies(test, columns = [f'clusters_pca'])
 return train, test
train_cluster_pca ,test_cluster_pca = fe_cluster_pca(train_pca,test_pca )
test_path=".. /input/digit-recognizer/test.csv"
test = pd.read_csv(test_path)
 test = test / 255.0
test = test.values.reshape(-1,28,28,1)
 Y_pred_test = model.predict(test)
 Y_pred_classes_test = np.argmax(Y_pred_test,axis = 1)
 np.savetxt('submission.csv',
np.c_[range(1,len(test)+1), Y_pred_classes_test],
delimiter=',',
header = 'ImageId,Label',
comments = '',
fmt='%d' )<load_from_csv>
train_cluster_pca = train_cluster_pca.iloc[:,650:]
test_cluster_pca = test_cluster_pca.iloc[:,650:]
train = pd.read_csv('/kaggle/input/digit-recognizer/train.csv')
 test = pd.read_csv('/kaggle/input/digit-recognizer/test.csv' )<prepare_x_and_y>
train_features_cluster=train_features2.iloc[:,876:]
test_features_cluster=test_features2.iloc[:,876:]
X_train_raw = train.drop(columns=['label'] ).to_numpy()
y_train_raw = train['label'].to_numpy()<normalization>
gsquarecols=['g-574','g-211','g-216','g-0','g-255','g-577','g-153','g-389','g-60','g-370','g-248','g-167','g-203','g-177','g-301','g-332','g-517','g-6','g-744','g-224','g-162','g-3','g-736','g-486','g-283','g-22','g-359','g-361','g-440','g-335','g-106','g-307','g-745','g-146','g-416','g-298','g-666','g-91','g-17','g-549','g-145','g-157','g-768','g-568','g-396']
x_mean = np.mean(X_train_raw)
 x_std = np.std(X_train_raw)
 def standarize(X):
return(X - x_mean)/ x_std
X_train = np.reshape(X_train_raw,(-1,28,28,1))
X_train = standarize(X_train)
 y_train_cat = keras.utils.to_categorical(y_train_raw )<train_model>
def fe_stats(train, test):
features_g = GENES
features_c = CELLS
for df in train, test:
df['g_sum'] = df[features_g].sum(axis = 1)
 df['g_mean'] = df[features_g].mean(axis = 1)
 df['g_std'] = df[features_g].std(axis = 1)
 df['g_kurt'] = df[features_g].kurtosis(axis = 1)
 df['g_skew'] = df[features_g].skew(axis = 1)
 df['c_sum'] = df[features_c].sum(axis = 1)
 df['c_mean'] = df[features_c].mean(axis = 1)
 df['c_std'] = df[features_c].std(axis = 1)
 df['c_kurt'] = df[features_c].kurtosis(axis = 1)
 df['c_skew'] = df[features_c].skew(axis = 1)
 df['gc_sum'] = df[features_g + features_c].sum(axis = 1)
 df['gc_mean'] = df[features_g + features_c].mean(axis = 1)
 df['gc_std'] = df[features_g + features_c].std(axis = 1)
 df['gc_kurt'] = df[features_g + features_c].kurtosis(axis = 1)
 df['gc_skew'] = df[features_g + features_c].skew(axis = 1)
 df['c52_c42'] = df['c-52'] * df['c-42']
df['c13_c73'] = df['c-13'] * df['c-73']
df['c26_c13'] = df['c-23'] * df['c-13']
df['c33_c6'] = df['c-33'] * df['c-6']
df['c11_c55'] = df['c-11'] * df['c-55']
df['c38_c63'] = df['c-38'] * df['c-63']
df['c38_c94'] = df['c-38'] * df['c-94']
df['c13_c94'] = df['c-13'] * df['c-94']
df['c4_c52'] = df['c-4'] * df['c-52']
df['c4_c42'] = df['c-4'] * df['c-42']
df['c13_c38'] = df['c-13'] * df['c-38']
df['c55_c2'] = df['c-55'] * df['c-2']
df['c55_c4'] = df['c-55'] * df['c-4']
df['c4_c13'] = df['c-4'] * df['c-13']
df['c82_c42'] = df['c-82'] * df['c-42']
df['c66_c42'] = df['c-66'] * df['c-42']
df['c6_c38'] = df['c-6'] * df['c-38']
df['c2_c13'] = df['c-2'] * df['c-13']
df['c62_c42'] = df['c-62'] * df['c-42']
df['c90_c55'] = df['c-90'] * df['c-55']
for feature in features_c:
df[f'{feature}_squared'] = df[feature] ** 2
for feature in gsquarecols:
df[f'{feature}_squared'] = df[feature] ** 2
return train, test
train_features2,test_features2=fe_stats(train_features2,test_features2 )
data_generator = keras.preprocessing.image.ImageDataGenerator(
 rotation_range=10,
width_shift_range=0.1,
height_shift_range=0.1,
zoom_range=0.1 
)
 data_generator.fit(X_train )<choose_model_class>
train_features_stats=train_features2.iloc[:,902:]
test_features_stats=test_features2.iloc[:,902:]
def make_model() :
model = keras.models.Sequential()
model.add(keras.layers.Conv2D(32, kernel_size=3,activation='relu',kernel_initializer='he_normal',input_shape=(28, 28, 1)))
 model.add(keras.layers.BatchNormalization())
 model.add(keras.layers.Conv2D(32, kernel_size=3,activation='relu'))
model.add(keras.layers.BatchNormalization())
 model.add(keras.layers.Conv2D(32, kernel_size=5, strides=2, padding='same',activation='relu'))
model.add(keras.layers.BatchNormalization())
 model.add(keras.layers.Dropout(0.4))
model.add(keras.layers.Conv2D(64, kernel_size=3, activation ='relu'))
model.add(keras.layers.BatchNormalization())
 model.add(keras.layers.Conv2D(64, kernel_size=3, activation ='relu'))
model.add(keras.layers.BatchNormalization())
 model.add(keras.layers.Conv2D(64, kernel_size=5, strides=2, padding='same',activation='relu'))
model.add(keras.layers.BatchNormalization())
 model.add(keras.layers.Dropout(0.4))
model.add(keras.layers.Flatten())
 model.add(keras.layers.Dense(128, activation = "relu"))
model.add(keras.layers.BatchNormalization())
 model.add(keras.layers.Dropout(0.4))
model.add(keras.layers.Dense(10, activation = "softmax"))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
 return model<categorify>
train_features = pd.concat(( train_features, train_features_cluster,train_cluster_pca,train_features_stats), axis=1)
 test_features = pd.concat(( test_features, test_features_cluster,test_cluster_pca,test_features_stats), axis=1 )
ens_size=16
model = [0]*ens_size
for i in range(ens_size):
model[i] = make_model()<split>
train = train_features.merge(train_targets_scored, on='sig_id')
 train = train[train['cp_type']!='ctl_vehicle'].reset_index(drop=True)
 test = test_features[test_features['cp_type']!='ctl_vehicle'].reset_index(drop=True)
 target = train[train_targets_scored.columns]
history = [0]*ens_size
start = time.perf_counter()
for i in range(ens_size):
callbacks = [keras.callbacks.ModelCheckpoint('/kaggle/working/mdl-{}-of-{}.hdf5' 
.format(i,ens_size-1),save_best_only=True, monitor='val_accuracy', mode='max')]
X_train_ens, X_valid_ens, y_train_ens, y_valid_ens = train_test_split(X_train, y_train_cat, train_size=0.9)
 train_aug = data_generator.flow(X_train_ens, y_train_ens)
 history[i] = model[i].fit_generator(train_aug, epochs=40,
validation_data=(X_valid_ens, y_valid_ens),
callbacks=callbacks, verbose = 0)
 print("CNN {}: Train accuracy={:0.5f}, Validation accuracy={:0.5f}" 
.format(i,max(history[i].history['accuracy']),max(history[i].history['val_accuracy'])))
 stop = time.perf_counter()
print(f"{stop - start:0.4f}" )<normalization>
train = train.drop('cp_type', axis=1)
 test = test.drop('cp_type', axis=1 )
X_test = np.reshape(test.to_numpy() ,(-1,28,28,1))
X_test = standarize(X_test )<predict_on_test>
target_cols = target.drop('sig_id', axis=1 ).columns.values.tolist()
preds = np.zeros(( X_test.shape[0],10))
for i in range(ens_size):
mdl = keras.models.load_model('/kaggle/working/mdl-{}-of-{}.hdf5'.format(i,ens_size-1))
preds = preds + mdl.predict(X_test )<prepare_output>
target=target[target_cols]
submit_pred = np.argmax(preds,axis=1)
 submit_pred.shape<load_from_csv>
train = pd.get_dummies(train, columns=['cp_time','cp_dose'])
 test_ = pd.get_dummies(test, columns=['cp_time','cp_dose'] )
submition = pd.read_csv('/kaggle/input/digit-recognizer/sample_submission.csv')
 submition['Label'] = submit_pred<save_to_csv>
feature_cols = [c for c in train.columns if c not in target_cols]
feature_cols = [c for c in feature_cols if c not in ['sig_id']]
submition.to_csv('/kaggle/working/submition_ens3.csv', index=False )<import_modules>
train = train[feature_cols]
test = test_[feature_cols]
import pandas as pd
import numpy as np<import_modules>
X_test = test.values
import pandas as pd
import numpy as np<import_modules>
class LogitsLogLoss(Metric):
def __init__(self):
self._name = "logits_ll"
self._maximize = False
def __call__(self, y_true, y_pred):
logits = 1 /(1 + np.exp(-y_pred))
aux =(1 - y_true)* np.log(1 - logits + 5e-5)+ y_true * np.log(logits + 5e-5)
 return np.mean(-aux )
import tensorflow as tf
from tensorflow import keras<load_from_csv>
MAX_EPOCH = 200
tabnet_params = dict(
 n_d = 32,
n_a = 32,
n_steps = 1,
gamma = 1.3,
lambda_sparse = 0,
optimizer_fn = optim.Adam,
optimizer_params = dict(lr = 2e-2, weight_decay = 1e-5),
mask_type = "entmax",
scheduler_params = dict(mode = "min", patience = 5, min_lr = 1e-5, factor = 0.9),
scheduler_fn = ReduceLROnPlateau,
seed = seed,
verbose = 10
)
train = pd.read_csv('/kaggle/input/digit-recognizer/train.csv')
 train.head()<load_from_csv>
test_cv_preds = []
NB_SPLITS = 10
mskf = MultilabelStratifiedKFold(n_splits = NB_SPLITS, random_state = 0, shuffle = True)
 SEED = [20,21,22]
for s in SEED:
tabnet_params['seed'] = s
for fold_nb,(train_idx, val_idx)in enumerate(mskf.split(train, target)) :
model = TabNetRegressor()
model.load_model(f".. /input/moa-tabnet-train-inference/TabNet_seed_{s}_fold_{fold_nb+1}.zip")
 preds_test = model.predict(X_test)
 test_cv_preds.append(1 /(1 + np.exp(-preds_test)))
 test_preds_all = np.stack(test_cv_preds )
test = pd.read_csv('/kaggle/input/digit-recognizer/test.csv')
 test.head()<feature_engineering>
all_feat = [col for col in df.columns if col not in ["sig_id"]]
test = pd.read_csv(".. /input/lish-moa/test_features.csv")
 sig_id = test[test["cp_type"] != "ctl_vehicle"].sig_id.reset_index(drop = True)
 tmp = pd.DataFrame(test_preds_all.mean(axis = 0), columns = all_feat)
 tmp["sig_id"] = sig_id
submission = pd.merge(test[["sig_id"]], tmp, on = "sig_id", how = "left")
 submission.fillna(0, inplace = True)
 submission.to_csv("submission.csv", index = None)
 submission.head()
X_train /= 255
test /= 255<train_model>
check=pd.read_csv('.. /input/moa-tabnet-train-inference/submission.csv' )
<categorify><EOS> 
subm=pd.read_csv("./submission.csv" )