Kaggle competition: Natural Language Processing with Disaster Tweets
mean, std = np.mean(X), np.std(X)
 print('Mean: %.3f, Standard Deviation: %.3f' %(mean, std))<define_variables>
train_sales = pd.read_csv('/kaggle/input/m5-forecasting-accuracy/sales_train_validation.csv')
 calendar_df = pd.read_csv('/kaggle/input/m5-forecasting-accuracy/calendar.csv')
 submission_file = pd.read_csv('/kaggle/input/m5-forecasting-accuracy/sample_submission.csv' )
datagen = ImageDataGenerator(
 rotation_range=20,
zoom_range = 0.1,
width_shift_range=0.1,
height_shift_range=0.1,
horizontal_flip=False,
vertical_flip=False )<split>
pd.Series(series_data.max(axis=1)).value_counts().tail(20 )
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.15 )<train_model>
forecast = pd.DataFrame(series_data[:, -28:] ).mean(axis=1)
 forecast = pd.concat([forecast] * 28, axis=1)
 forecast.columns = [f'F{i}' for i in range(1, forecast.shape[1] + 1)]
forecast.head()
datagen.fit(X_train )<categorify>
validation_ids = train_sales['id'].values
evaluation_ids = [i.replace('validation', 'evaluation')for i in validation_ids]
y_train = to_categorical(y_train, num_classes=10)
 y_test = to_categorical(y_test, num_classes=10 )<choose_model_class>
ids = np.concatenate([validation_ids, evaluation_ids] )
model = Sequential()
model.add(Conv2D(filters=32, kernel_size=(3, 3), activation='relu', strides=1, padding='same', data_format='channels_last',
input_shape=(28,28,1)))
 model.add(BatchNormalization())
 model.add(MaxPooling2D(pool_size=(2, 2), strides=1, padding='valid'))
model.add(Conv2D(filters=32, kernel_size=(3, 3), activation='relu', strides=1, padding='same', data_format='channels_last'))
model.add(BatchNormalization())
 model.add(MaxPooling2D(pool_size=(2, 2), strides=1, padding='valid'))
model.add(Conv2D(filters=32, kernel_size=(3, 3), activation='relu', strides=1, padding='same', data_format='channels_last',
input_shape=(28,28,1)))
 model.add(BatchNormalization())
 model.add(MaxPooling2D(pool_size=(2, 2), strides=1, padding='valid'))
model.add(Conv2D(filters=32, kernel_size=(3, 3), activation='relu', strides=1, padding='same', data_format='channels_last'))
model.add(BatchNormalization())
 model.add(MaxPooling2D(pool_size=(2, 2), strides=1, padding='valid'))
model.add(Flatten())
 model.add(Dense(1024, activation='relu'))
model.add(BatchNormalization())
 model.add(Dense(512, activation='relu'))
model.add(BatchNormalization())
 model.add(Dense(10, activation='softmax'))<choose_model_class>
predictions = pd.DataFrame(ids, columns=['id'])
 forecast = pd.concat([forecast] * 2 ).reset_index(drop=True)
 predictions = pd.concat([predictions, forecast], axis=1 )
<choose_model_class><EOS> 
predictions.to_csv('submission.csv', index=False )