I've created a model to predict housing prices in LA, and what should be a simple regression problem, is giving me headache because the loss is just too big and my accuracy wont change.

I've already tried normalizing, changing the architecture (decreasing layers, hidden units), adding dropout, changed the loss function, batch size, epochs and my accuracy is still only 0.022

input_shape = X_train_2[0].shape

model = tf.keras.models.Sequential([
    tf.keras.layers.Dense(units=300, activation=tf.nn.relu),
    tf.keras.layers.Dense(units=300, activation=tf.nn.relu),
    tf.keras.layers.Dense(units = 1, kernel_initializer = 'lecun_normal', activation='linear')

model.compile(optimizer='adam',loss='mean_squared_error', metrics=['accuracy'])
model.fit(X_train, y_train, epochs=5, batch_size=32)
model.evaluate(X_test_, y_test)

Training Log

Epoch 1/5 32444/32444 [==============================] - 1s
    38us/sample - loss: 90230324650039.5469 - acc: 0.0012 
Epoch 2/5
    32444/32444 [==============================] - 1s 28us/sample -
    loss: 90230315396180.2031 - acc: 0.0022 
Epoch 3/5 32444/32444
    [==============================] - 1s 27us/sample - loss:
    90230293267377.3438 - acc: 0.0022 
Epoch 4/5 32444/32444 [==============================] - 1s 27us/sample - loss:
    90230260607518.6250 - acc: 0.0022 
Epoch 5/5 32444/32444 [==============================] - 1s 28us/sample - loss:
    90230216684525.4375 - acc: 0.0022
  • $\begingroup$ Your loss seems very huge, but it is decreasing. Among the list of things you tried, I didn't see you try adjusting the learning rate. Could be that you need to increase it? $\endgroup$ Apr 9, 2019 at 1:34
  • $\begingroup$ Can you add a sample input? Are the inputs normalized/scaled? I can imagine if they are not and you have houses for 1e6, the NN will give huge loss like that because the numbers themselves are big... also, if the inputs are scaled to something like (0,1), can't hurt to add a sigmoid in last layer. $\endgroup$ Apr 9, 2019 at 1:39
  • $\begingroup$ Simply change the loss to mse (Mean square error) as accuracy is not loss we should be using in regression. $\endgroup$
    – thanatoz
    Apr 9, 2019 at 4:50
  • $\begingroup$ I normalized my inputs, but all my predictions are now 0.0 $\endgroup$
    – Biel Borba
    Apr 9, 2019 at 13:48

1 Answer 1


Your metric is accuracy although you are working on a regression problem, this doesn't make sense. You should use instead:

metrics = ['mean squared error']


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.