application_vnd.jupyter.stderr_output_1.png
from keras.layers import Dense,Dropout, Activation,Lambda,Flatten

from keras.models import Sequential

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

train = pd.read_csv('../input/train.csv')

test = pd.read_csv('../input/test.csv')

x_train = train[:, 1:].values.astype('float32')
y_train = train[:, 0].values.astype('int32')
x_test = test.values.astype('float32')

x_train.shape

x_train = x_train.reshape(x_train.shape[0], 28, 28)

x_train.shape

x_train = x_train.reshape(x_train.shape[0], 28, 28, 1)
x_test = x_test.reshape(x_test.shape[0], 28, 28, 1)

(x_train.shape, x_test.shape)

mean_px = x_train.mean().astype(np.float32)
std_px = x_train.std().astype(np.float32)
def standardize(x):
    return (x - mean_px) / std_px

model = Sequential()
model.add(Lambda(standardize, input_shape=(28, 28, 1)))
model.add(Flatten())
model.add(Dense(10, activation='softmax'))

model.summary()