Kaggle competition: Microsoft Malware Prediction
X = X / 255.0
test_x = test_x / 255.0
X = X.reshape(-1,28,28,1)
 test_x = test_x.reshape(-1,28,28,1 )<split>
df_kaggle_test = pd.read_hdf(
 '.. /input/save-hdf-full/test.hdf',
key="test"
)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1, random_state=0 )<normalization>
def add_timestamps(df):
datedictAS = np.load('.. /input/timestamps/AvSigVersionTimestamps.npy')[() ]
df['DateAS'] = df['AvSigVersion'].map(datedictAS)
 datedictOS = np.load('.. /input/timestamps/OSVersionTimestamps.npy')[() ]
df['DateOS'] = df['Census_OSVersion'].map(datedictOS)
 def convert(x):
try:
d = datetime.strptime(x.split('.')[4],'%y%m%d-%H%M')
 except:
d = np.nan
return d
df['DateBL'] = df['OsBuildLab'].map(convert)
 add_timestamps(df_kaggle_test )
mean = np.mean(X_train)
 std = np.std(X_train)
 def standardize(x):
return(x-mean)/std<define_variables>
df_submission=pd.read_csv(".. /input/nffm-baseline-0-690-on-lb/nffm_submission.csv")
 df_submission.hist(bins=30)
 df_submission.head()
batch_size = 64<choose_model_class>
df_submission.to_csv("original_submission.csv",index=None )
model=Sequential()
model.add(Conv2D(filters=64, kernel_size =(3,3), activation="relu", input_shape=(28,28,1)))
 model.add(Conv2D(filters=64, kernel_size =(3,3), activation="relu"))
model.add(MaxPooling2D(pool_size=(2,2)))
 model.add(BatchNormalization())
 model.add(Conv2D(filters=128, kernel_size =(3,3), activation="relu"))
model.add(Conv2D(filters=128, kernel_size =(3,3), activation="relu"))
model.add(MaxPooling2D(pool_size=(2,2)))
 model.add(BatchNormalization())
 model.add(Conv2D(filters=256, kernel_size =(3,3), activation="relu"))
model.add(MaxPooling2D(pool_size=(2,2)))
 model.add(Flatten())
 model.add(BatchNormalization())
 model.add(Dense(512,activation="relu"))
model.add(Dense(10,activation="softmax"))
model.compile(loss="categorical_crossentropy", optimizer="adam", metrics=["accuracy"] )<define_variables>
df_private_submission.to_csv("private_lb_submission.csv",index=None )
<train_model><EOS> 
df_submission.to_csv("public_lb_submission.csv",index=None )