I face two problems when I implement 1D convnet for multi-channel sequential data.
(224 samples x 300 time sequential x 19 channels)
1) I set batch_size as 7 but it jumps with 5 times of that.
not 7 14 21 28, but 7, 56, 105, 147... what's wrong with mine?
2) when I look at the records of accuracy, it looks like to learn NOTHING.
is it impossible implement classifier for multi-channel sequential data with Conv1D?
If possible can you give me some advice from my code?
#result
x_train shape: (224, 300, 19)
224 train samples
28 test samples
Train on 224 samples, validate on 28 samples
Epoch 1/50
7/224 [..............................] - ETA: 68s - loss: 0.6945 - acc: 0.5714
56/224 [======>.......................] - ETA: 6s - loss: 0.6993 - acc: 0.4464
105/224 [=============>................] - ETA: 2s - loss: 0.6979 - acc: 0.4381
147/224 [==================>...........] - ETA: 1s - loss: 0.6968 - acc: 0.4422
189/224 [========================>.....] - ETA: 0s - loss: 0.6953 - acc: 0.4444
224/224 [==============================] - 2s - loss: 0.6953 - acc: 0.4420 - val_loss: 0.6956 - val_acc: 0.5000
Epoch 2/50
7/224 [..............................] - ETA: 0s - loss: 0.6759 - acc: 0.5714
63/224 [=======>......................] - ETA: 0s - loss: 0.6924 - acc: 0.5556
133/224 [================>.............] - ETA: 0s - loss: 0.6905 - acc: 0.5338
203/224 [==========================>...] - ETA: 0s - loss: 0.6903 - acc: 0.5567
224/224 [==============================] - 0s - loss: 0.6923 - acc: 0.5357 - val_loss: 0.6968 - val_acc: 0.5000
# code
from __future__ import print_function
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Activation
from keras.layers import Conv2D, MaxPooling2D, Conv1D, MaxPooling1D
import numpy as np
batch_size = 7
num_classes = 2
epochs = 50
# input data dimensions : 300 sequential x 19 channels
eeg_rows, num_ch = 300, 19
x_train = np.load('eeg_train.npy')
y_train = np.load('label_train.npy')
x_test = np.load('eeg_test.npy')
y_test = np.load('label_test.npy')
x_valid = np.load('eeg_valid.npy')
y_valid = np.load('label_valid.npy')
x_train = x_train.reshape(x_train.shape[0], eeg_rows, num_ch)
x_test = x_test.reshape(x_test.shape[0], eeg_rows,num_ch)
x_valid = x_valid.reshape(x_valid.shape[0], eeg_rows, num_ch)
input_shape = (eeg_rows, num_ch)
x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
x_valid = x_test.astype('float32')
x_train /= 100
x_test /= 100
x_valid /= 100
print('x_train shape:', x_train.shape)
print(x_train.shape[0], 'train samples')
print(x_test.shape[0], 'test samples')
# model
conv = Sequential()
conv.add(Conv1D(32, 3, input_shape=input_shape, activation='relu', padding='same'))
conv.add(Conv1D(32, 3, activation='relu', padding='same'))
conv.add(MaxPooling1D(pool_size=2, strides=2, padding='same'))
conv.add(Dropout(0.2))
conv.add(Flatten())
conv.add(Dense(16, activation='relu'))
conv.add(Dropout(0.5))
conv.add(Dense(2, activation='softmax'))
conv.compile(loss='categorical_crossentropy',
optimizer=keras.optimizers.Adam(),
metrics=['accuracy'])
# train
conv.fit(x_train, y_train,
batch_size=batch_size,
epochs=epochs,
verbose=1,
validation_data=(x_valid, y_valid))
score = conv.evaluate(x_valid, y_valid, verbose=0)
print(conv.summary())
print(conv.input_shape)
print(conv.output_shape)
print('Test loss:', score[0])
print('Test accuracy:', score[1])
Related
This is my code for this program. it is working correctly but suddenly not work please anyone can solve this problem
model = Sequential()
print(nb_filters[0], 'filters')
print('input shape', img_rows, 'rows', img_cols, 'cols', patch_size, 'patchsize')
model.add(Convolution3D(
nb_filters[0],
kernel_dim1=1, # depth
kernel_dim2=nb_conv[0], # rows
kernel_dim3=nb_conv[1], # cols
input_shape=(1, img_rows, img_cols, patch_size),
activation='relu'
))
model.add(MaxPooling3D(pool_size=(1, nb_pool[0], nb_pool[0])))
model.add(Dropout(0.2))
model.add(Flatten())
model.add(Dense(128, init='normal', activation='relu'))
model.add(Dropout(0.2))
model.add(Dense(nb_classes,init='normal'))
model.add(Activation('softmax'))
#optimizer adam,sgd,RMSprop,Adagrad,Adadelta,Nadam,
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
This error creates in my program. what is the problem I don't understand to solve this I search many times but not solve this problem?
--------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-112-671e85975992> in <module>
13 x = Dense(nb_classes, activation='softmax')(x)
14
---> 15 custom_model = Model(input=resnet_model.input, output=x)
16
17 for layer in custom_model.layers[:7]:
/usr/local/lib/python3.8/dist-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access
/usr/local/lib/python3.8/dist-packages/tensorflow/python/keras/engine/training.py in __init__(self, *args, **kwargs)
259 # self.trainable_weights
260 # self.non_trainable_weights
--> 261 generic_utils.validate_kwargs(kwargs, {'trainable', 'dtype', 'dynamic',
262 'name', 'autocast'})
263 super(Model, self).__init__(**kwargs)
/usr/local/lib/python3.8/dist-packages/tensorflow/python/keras/utils/generic_utils.py in validate_kwargs(kwargs, allowed_kwargs, error_message)
776 for kwarg in kwargs:
777 if kwarg not in allowed_kwargs:
--> 778 raise TypeError(error_message, kwarg)
779
780
TypeError: ('Keyword argument not understood:', 'input')
As suggested by Dr. Snoopy, the arguments to the tf.keras.Model are inputs and outputs but you are passing it as input and output respectively in custom_model = Model(input=resnet_model.input, output=x).
Code to reproduce the error -
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
X1 = tf.constant([2, 3, 4, 5, 6, 7])
X2 = tf.constant([2, 3, 4, 5, 6, 7])
yTrain = tf.constant([4, 6, 8, 10, 12, 14])
input1 = keras.Input(shape=(1,))
input2 = keras.Input(shape=(1,))
x = layers.concatenate([input1, input2])
x = layers.Dense(8, activation='relu')(x)
outputs = layers.Dense(2)(x)
mlp = keras.Model(input = [input1, input2], output = outputs)
mlp.summary()
mlp.compile(loss='mean_squared_error',
optimizer='adam', metrics=['accuracy'])
mlp.fit([X1, X2], yTrain, batch_size=1, epochs=10, validation_split=0.2,
shuffle=True)
mlp.evaluate([X1, X2], yTrain)
Output -
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-bec9ebbd1faf> in <module>()
14 x = layers.Dense(8, activation='relu')(x)
15 outputs = layers.Dense(2)(x)
---> 16 mlp = keras.Model(input = [input1, input2], output = outputs)
17
18 mlp.summary()
2 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/generic_utils.py in validate_kwargs(kwargs, allowed_kwargs, error_message)
776 for kwarg in kwargs:
777 if kwarg not in allowed_kwargs:
--> 778 raise TypeError(error_message, kwarg)
779
780
TypeError: ('Keyword argument not understood:', 'input')
To fix the error, change the arguments as inputs and outputs.
Fixed Code -
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
X1 = tf.constant([2, 3, 4, 5, 6, 7])
X2 = tf.constant([2, 3, 4, 5, 6, 7])
yTrain = tf.constant([4, 6, 8, 10, 12, 14])
input1 = keras.Input(shape=(1,))
input2 = keras.Input(shape=(1,))
x = layers.concatenate([input1, input2])
x = layers.Dense(8, activation='relu')(x)
outputs = layers.Dense(2)(x)
mlp = keras.Model(inputs = [input1, input2], outputs = outputs)
mlp.summary()
mlp.compile(loss='mean_squared_error',
optimizer='adam', metrics=['accuracy'])
mlp.fit([X1, X2], yTrain, batch_size=1, epochs=10, validation_split=0.2,
shuffle=True)
mlp.evaluate([X1, X2], yTrain)
Output -
Model: "functional_5"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_6 (InputLayer) [(None, 1)] 0
__________________________________________________________________________________________________
input_7 (InputLayer) [(None, 1)] 0
__________________________________________________________________________________________________
concatenate_34 (Concatenate) (None, 2) 0 input_6[0][0]
input_7[0][0]
__________________________________________________________________________________________________
dense_4 (Dense) (None, 8) 24 concatenate_34[0][0]
__________________________________________________________________________________________________
dense_5 (Dense) (None, 2) 18 dense_4[0][0]
==================================================================================================
Total params: 42
Trainable params: 42
Non-trainable params: 0
__________________________________________________________________________________________________
Epoch 1/10
4/4 [==============================] - 0s 32ms/step - loss: 54.3236 - accuracy: 0.0000e+00 - val_loss: 169.3114 - val_accuracy: 0.0000e+00
Epoch 2/10
4/4 [==============================] - 0s 6ms/step - loss: 53.4965 - accuracy: 0.0000e+00 - val_loss: 167.0008 - val_accuracy: 0.0000e+00
Epoch 3/10
4/4 [==============================] - 0s 6ms/step - loss: 52.7413 - accuracy: 0.0000e+00 - val_loss: 164.6473 - val_accuracy: 0.0000e+00
Epoch 4/10
4/4 [==============================] - 0s 6ms/step - loss: 51.8159 - accuracy: 0.0000e+00 - val_loss: 162.4427 - val_accuracy: 0.0000e+00
Epoch 5/10
4/4 [==============================] - 0s 6ms/step - loss: 51.0917 - accuracy: 0.0000e+00 - val_loss: 160.1798 - val_accuracy: 0.0000e+00
Epoch 6/10
4/4 [==============================] - 0s 6ms/step - loss: 50.4425 - accuracy: 0.0000e+00 - val_loss: 157.8355 - val_accuracy: 0.0000e+00
Epoch 7/10
4/4 [==============================] - 0s 6ms/step - loss: 49.5709 - accuracy: 0.0000e+00 - val_loss: 155.6147 - val_accuracy: 0.0000e+00
Epoch 8/10
4/4 [==============================] - 0s 6ms/step - loss: 48.7816 - accuracy: 0.0000e+00 - val_loss: 153.4298 - val_accuracy: 0.0000e+00
Epoch 9/10
4/4 [==============================] - 0s 6ms/step - loss: 47.9975 - accuracy: 0.0000e+00 - val_loss: 151.2858 - val_accuracy: 0.0000e+00
Epoch 10/10
4/4 [==============================] - 0s 6ms/step - loss: 47.3943 - accuracy: 0.0000e+00 - val_loss: 149.0254 - val_accuracy: 0.0000e+00
1/1 [==============================] - 0s 2ms/step - loss: 80.9333 - accuracy: 0.0000e+00
[80.93333435058594, 0.0]
I'm trying to create a model for time series analysis using LSTM layer, however accuracy is very low even when using Dense layers and no LSTM.
The data is time series (synthetic spectrum), which depends on 4 parameters. Changing the parameters enables to use different size datasets, where each sample is more or less different from the other. But no matter the size of dataset accuracy is always as low as 0.0 - 0.32 %.
Model with LSTM:
print(trainset.shape)
print(testset.shape)
print(trainlabels.shape)
model = Sequential()
model.add(Masking(mask_value=0.0, input_shape=(trainset.shape[1], trainset.shape[2])))
model.add(LSTM(10, activation='relu', stateful=False, return_sequences=False))
model.add(Dropout(0.3))
model.add(Dense(len(trainlabels), activation='relu'))
model.compile(loss='sparse_categorical_crossentropy',
optimizer='Adam', metrics=['accuracy'])
print(model.summary())
model.fit(trainset, trainlabels, validation_data=(testset, testlabels),
epochs=3, batch_size=10)
scores = model.evaluate(testset, testlabels, verbose=0)
print("Accuracy: %.2f%%" % (scores[1]*100))
OUTPUT:
(2478, 600, 1)
(620, 600, 1)
(2478,)
Model: "sequential_7"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
masking_7 (Masking) (None, 600, 1) 0
_________________________________________________________________
lstm_7 (LSTM) (None, 10) 480
_________________________________________________________________
dropout_7 (Dropout) (None, 10) 0
_________________________________________________________________
dense_7 (Dense) (None, 2478) 27258
=================================================================
Total params: 27,738
Trainable params: 27,738
Non-trainable params: 0
_________________________________________________________________
None
Train on 2478 samples, validate on 620 samples
Epoch 1/3
2478/2478 [==============================] - 53s 22ms/step - loss: 8.9022 - accuracy: 4.0355e-04 - val_loss: 7.8152 - val_accuracy: 0.0016
Epoch 2/3
2478/2478 [==============================] - 54s 22ms/step - loss: 7.8152 - accuracy: 4.0355e-04 - val_loss: 7.8152 - val_accuracy: 0.0016
Epoch 3/3
2478/2478 [==============================] - 53s 21ms/step - loss: 7.8152 - accuracy: 4.0355e-04 - val_loss: 7.8152 - val_accuracy: 0.0016
Accuracy: 0.16%
Some values in training data are 0.0, therefore Masking is used.
I have tried playing around with different loss, optimizer, activations, Dropout and layer parameters. The result is always the same even after adding more Dense layers, or changing batch size.
Model with Dense:
Data format is 2D instead of 3D.
model=keras.Sequential([
keras.layers.Masking(mask_value=0.0, input_shape=(trainset.shape[1],)),
keras.layers.Dense(128, activation='relu'),
keras.layers.Dropout(0.05),
keras.layers.Dense(64, activation='relu'),
keras.layers.Dropout(0.05),
keras.layers.Dense(len(labels), activation='softmax')
])
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.fit(np.uint8(trainset), np.uint8(trainlabels), epochs=100)
test_loss, test_acc=model.evaluate(np.uint8(testset), np.uint8(testlabels),
verbose=2)
print(test_acc)
OUTPUT:
Train on 1239 samples
Epoch 1/100
1239/1239 [==============================] - 1s 1ms/sample - loss: 8.5421 - accuracy: 0.0033
Epoch 2/100
1239/1239 [==============================] - 0s 371us/sample - loss: 6.2039 - accuracy: 0.0025
Epoch 3/100
1239/1239 [==============================] - 0s 347us/sample - loss: 5.6502 - accuracy: 0.0033
****
Epoch 97/100
1239/1239 [==============================] - 0s 380us/sample - loss: 0.1472 - accuracy: 0.9746
Epoch 98/100
1239/1239 [==============================] - 0s 364us/sample - loss: 0.1562 - accuracy: 0.9680
Epoch 99/100
1239/1239 [==============================] - 1s 408us/sample - loss: 0.1511 - accuracy: 0.9721
Epoch 100/100
1239/1239 [==============================] - 0s 378us/sample - loss: 0.1719 - accuracy: 0.9680
310/1 - 0s - loss: 18.6845 - accuracy: 0.0000e+00
0.0
With this model loss is very low but so is accuracy.
What kind of model architecture should be used for my data?
Thanks in advance for helping to learn this stuff!
I'm training a model to classify 3 types of vehicles. Everything seems like going well until I try to predict anything with my model. Results of prediction are completely random.
I'm using 15000 images of 3 classes (5000 each) to train and 6000 images of 3 classes (2000 each) to validate with some Data Augmentation.
I'm using Keras with Tensorflow-GPU backend, making classification report and confusion matrix with use of scikit-learn.
I have no idea why when I'm training the model loss and accuracy both in train and validation are low/high respectively, but confusion matrix is completely random.
Image Data Generators
img_width, img_height = 96, 96
train_data_dir = 'data/train'
validation_data_dir = 'data/validation'
nb_train_samples = 15000
nb_validation_samples = 6000
epochs = 200
batch_size = 64
train_datagen = ImageDataGenerator(
rescale=1./255,
shear_range=0.3,
zoom_range=0.3,
horizontal_flip=True
)
test_datagen = ImageDataGenerator(rescale=1./256)
train_generator = train_datagen.flow_from_directory(train_data_dir, target_size=(
img_width, img_height), batch_size=batch_size, class_mode='categorical', shuffle=True)
validation_generator = test_datagen.flow_from_directory(validation_data_dir, target_size=(
img_width, img_height), batch_size=batch_size, class_mode='categorical', shuffle=True)
Building model
model = Sequential()
model.add(Conv2D(32, (5, 5), input_shape=image_shape))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(32, (5, 5)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(100))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(100))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(3))
model.add(Activation('softmax'))
adam = optimizers.adam(lr=0.0016643)
model.compile(optimizer=adam, loss='categorical_crossentropy',
metrics=['accuracy'])
Model fitting
es = keras.callbacks.EarlyStopping(
monitor='val_loss', min_delta=0, patience=5, verbose=0, mode='auto')
history = model.fit_generator(train_generator, steps_per_epoch=nb_train_samples//batch_size, epochs=epochs,
validation_data=validation_generator, validation_steps=nb_validation_samples//batch_size, callbacks=[es], use_multiprocessing=False, workers=6)
Testing my model
Y_pred = model.predict_generator(
validation_generator, steps=nb_validation_samples // batch_size)
y_pred = np.argmax(Y_pred, axis=1)
print('Confusion Matrix')
cm = confusion_matrix(validation_generator.classes, y_pred)
print(cm)
print('Classification Report')
target_names = ['Car', 'Bus', 'Truck']
print(classification_report(validation_generator.classes,
y_pred, target_names=target_names))
The output I get looks something like this:
Output
Epoch 1/200
234/234 [==============================] - 35s 149ms/step - loss: 0.9103 - acc: 0.5645 - val_loss: 0.6354 - val_acc: 0.7419
Epoch 2/200
234/234 [==============================] - 30s 130ms/step - loss: 0.6804 - acc: 0.7181 - val_loss: 0.4679 - val_acc: 0.8117
Epoch 3/200
234/234 [==============================] - 30s 129ms/step - loss: 0.6027 - acc: 0.7573 - val_loss: 0.4401 - val_acc: 0.8238
.
.
.
Epoch 37/200
234/234 [==============================] - 30s 128ms/step - loss: 0.2667 - acc: 0.9018 - val_loss: 0.2095 - val_acc: 0.9276
Epoch 38/200
234/234 [==============================] - 30s 129ms/step - loss: 0.2711 - acc: 0.9037 - val_loss: 0.1995 - val_acc: 0.9353
##Here it breaks with an EarlyStopping
Confusion Matrix
[[659 680 661]
[684 636 680]
[657 658 685]]
Classification Report
precision recall f1-score support
Car 0.33 0.33 0.33 2000
Bus 0.32 0.32 0.32 2000
Truck 0.34 0.34 0.34 2000
micro avg 0.33 0.33 0.33 6000
macro avg 0.33 0.33 0.33 6000
weighted avg 0.33 0.33 0.33 6000
dict_keys(['val_loss', 'val_acc', 'loss', 'acc'])
I am trying to train on gray images. The batch_size = 32, image size = (48*48).
I define my network input_shape = (48,48,1). I get an error like below when I train the network.
Error :
ValueError: Error when checking input: expected conv2d_17_input to have 4 dimensions, but got array with shape (32, 48, 48)
model.add(Conv2D(32, kernel_size=(5, 5),
activation='relu',
input_shape=(48,48,1)
)
)
Let's say you have 1000 training images where each image is 48x48 greyscale. After you have loaded the images into a numpy array, you will end up with the shape : (1000, 48, 48).
This essentially means you have 1000 elements in your array and each element is a 48x48 matrix.
Now in order to feed this data to train a CNN, you have to reshape this list to (1000, 48, 48, 1) where 1 stands for channel dimension. Since you are having greyscaled images you have to use 1. If it was RGB it will be 3.
Consider the toy example given below,
x_train = np.random.rand(1000, 48, 48) #images
y_train = np.array([np.random.randint(0, 2) for x in range(1000)]) # labels
# simple model
model = Sequential()
model.add(Conv2D(32, kernel_size=(5, 5),
activation='relu',
input_shape=(48,48,1)
)
)
model.add(Flatten())
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam')
# fitting model
model.fit(x_train, y_train, epochs=10, batch_size=32)
This will throw an error,
Error when checking input: expected conv2d_3_input to have 4 dimensions, but got array with shape (1000, 48, 48)
To fix it reshape the x_train like this,
x_train = x_train.reshape(x_train.shape[0], x_train.shape[1], x_train.shape[2], 1)
Now fit the model,
model.fit(x_train, y_train, epochs=10, batch_size=32)
Epoch 1/10
1000/1000 [==============================] - 1s 1ms/step - loss: 0.7177
Epoch 2/10
1000/1000 [==============================] - 1s 882us/step - loss: 0.6762
Epoch 3/10
1000/1000 [==============================] - 1s 870us/step - loss: 0.5882
Epoch 4/10
1000/1000 [==============================] - 1s 888us/step - loss: 0.4588
Epoch 5/10
1000/1000 [==============================] - 1s 906us/step - loss: 0.3272
Epoch 6/10
1000/1000 [==============================] - 1s 910us/step - loss: 0.2228
Epoch 7/10
1000/1000 [==============================] - 1s 895us/step - loss: 0.1607
Epoch 8/10
1000/1000 [==============================] - 1s 879us/step - loss: 0.1172
Epoch 9/10
1000/1000 [==============================] - 1s 886us/step - loss: 0.0935
Epoch 10/10
1000/1000 [==============================] - 1s 888us/step - loss: 0.0638
Your input should have 4 dimenstions even if it is gray scale. So, you can use np.reshape(input,(32,48,48,1)) or np.expand_dims(input,axis=3).
Your images should be reshaped to (sample_length, 48, 48, 1) and your input_shape = (48, 48, 1)
x_train = x_train.reshape(x_train.shape[0], 48, 48, 1)
x_test = x_test.reshape(x_test.shape[0], 48, 48, 1)
input_shape = (48, 48, 1)
You can look at the MNIST example here, which is similar to your case.
i'm beginner studying neural network.
i'm doing kaggle project - bike sharing demand.
i want to use simple neural network by keras, but loss is not decreasing.
what should i do?
-----------code--------------
# dataset from pandas
feature_names = ["season", "holiday", "workingday", "weather",
"temp", "atemp", "humidity", "windspeed",
"datetime_year", "datetime_hour", "datetime_dayofweek"]
label_name = ["count"]
X_train = train[feature_names] #shape (10886, 11)
Y_train = train[label_name] #shape (10886, 1)
X_test = test[feature_names]
# layers
model = Sequential()
model.add(Dense(units = 50, kernel_initializer = 'uniform', activation = 'relu', input_dim=11))
model.add(Dropout(0.3))
model.add(Dense(units = 50, kernel_initializer = 'uniform', activation = 'relu'))
model.add(Dropout(0.3))
model.add(Dense(units = 5, kernel_initializer = 'uniform', activation = 'relu'))
model.add(Dropout(0.3))
model.add(Dense(units = 1, kernel_initializer = 'uniform', activation = 'sigmoid'))
model.compile(optimizer = 'adam', loss = 'mean_squared_error', metrics = ['accuracy'])
# Train
model.fit(X_train, Y_train, batch_size = 100, epochs = 200)
---------result------------
Epoch 1/200
10886/10886 [==============================] - 4s 325us/step - loss: 69206.2478 - acc: 0.0094
Epoch 2/200
10886/10886 [==============================] - 1s 93us/step - loss: 69184.5435 - acc: 0.0096
Epoch 3/200
10886/10886 [==============================] - 1s 89us/step - loss: 69181.6330 - acc: 0.0096
Epoch 4/200
10886/10886 [==============================] - 1s 93us/step - loss: 69179.0222 - acc: 0.0096
Epoch 5/200
10886/10886 [==============================] - 1s 91us/step - loss: 69175.7442 - acc: 0.0096
Epoch 6/200
10886/10886 [==============================] - 1s 109us/step - loss: 69171.9052 - acc: 0.0096
Epoch 7/200
10886/10886 [==============================] - 1s 122us/step - loss: 69171.6164 - acc: 0.0096
Epoch 8/200
10886/10886 [==============================] - 1s 92us/step - loss: 69167.6923 - acc: 0.0096
Epoch 9/200
10886/10886 [==============================] - 1s 91us/step - loss: 69166.2911 - acc: 0.0096
Epoch 10/200
10886/10886 [==============================] - 1s 94us/step - loss: 69164.1145 - acc: 0.0096
...
Try setting the learning rate in the model.compile section. Start with 0.0001, then 0.001 and 0.01 and see what happens.