Kaggle competition: Digit Recognizer
<SOS> metric: categorizationaccuracy Kaggle data source: digit-recognizer<compute_test_metric>
!pip install tensorflow-gpu==2.0.0b1
score(Y, Y_pred )<prepare_output>
train = pd.read_csv(".. /input/train.csv")
 test = pd.read_csv(".. /input/test.csv" )
%%time
Y_pred = np.zeros(( test_size, n_classes))
Y_pred = pd.DataFrame(Y_pred, columns=Y.columns, index=X_test.index)
 for i in range(n_seeds):
for j in range(n_splits):
model = tf.keras.models.load_model(
 f"model_seed_{i}_fold_{j}.h5",
compile=False,
custom_objects={"ModelWithCutmix": ModelWithCutmix}, 
)
 Y_pred += model.predict(X_test)/ n_seeds / n_splits
Y_pred[test_features["cp_type"] == "ctl_vehicle"] = 0.0<save_to_csv>
X_train = X_train / 255.0
test = test / 255.0
Y_pred.to_csv("submission.csv" )<set_options>
datagen = keras.preprocessing.image.ImageDataGenerator(
 rotation_range=10,
zoom_range = 0.10,
width_shift_range=0.1,
height_shift_range=0.1 )
sns.set_theme()
sns.set_palette('muted')
 h2o.init()<load_from_csv>
model = keras.Sequential([
keras.layers.Conv2D(32,(3,3), activation ='relu', input_shape=(28, 28, 1)) ,
keras.layers.BatchNormalization() ,
keras.layers.Conv2D(32,(3,3), activation ='relu'),
keras.layers.MaxPool2D(( 2,2)) ,
keras.layers.BatchNormalization() ,
keras.layers.Conv2D(64,(3,3), activation ='relu'),
keras.layers.BatchNormalization() ,
keras.layers.Conv2D(64,(3,3), activation ='relu'),
keras.layers.BatchNormalization() ,
keras.layers.MaxPool2D(( 2,2)) ,
keras.layers.BatchNormalization() ,
keras.layers.Flatten() ,
keras.layers.Dense(1024, activation='relu'),
keras.layers.BatchNormalization() ,
keras.layers.Dense(10, activation='softmax')
 ] )
df = pd.read_csv('.. /input/house-prices-advanced-regression-techniques/train.csv')
 df<prepare_x_and_y>
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'] )
hf = h2o.H2OFrame(df)
 x = list(df.columns.difference(['Id', 'SalePrice'] ).values)
 y = "SalePrice"
aml = H2OAutoML(max_models=100, seed=1)
 aml.train(x=x, y=y, training_frame=hf)
 lb = aml.leaderboard
lb.head(rows=lb.nrows )<save_to_csv>
history = model.fit_generator(datagen.flow(X_train, Y_train, batch_size=1000), steps_per_epoch=300, epochs=50-5 )
df_test = pd.read_csv('.. /input/house-prices-advanced-regression-techniques/test.csv')
 hf_test = h2o.H2OFrame(df_test)
 x = list(df.columns.difference(['Id'] ).values)
 preds = aml.predict(hf_test);
h2o.h2o.download_csv(preds, 'h20_output.csv')
 df_SalePrice = pd.read_csv('./h20_output.csv')
 output_df = pd.DataFrame({
'Id': df_test['Id'],
'SalePrice': df_SalePrice['predict']
})
 output_df.to_csv('output.csv', index=False )<import_modules>
model.fit_generator(datagen.flow(X_train, Y_train, batch_size=1000), steps_per_epoch=300, epochs=5 )
import numpy
import pandas as pd
import torch
import torch.nn as nn<load_from_csv>
predictions = model.predict(test )
<define_search_space><EOS> 
submission = pd.concat([pd.Series(range(1,28001),name = "ImageId"),results],axis = 1)
 submission.to_csv("cnn_mnist_datagen.csv",index=False )