0
error on test set: [2442.239337101689, 29.913345202693232, 5162219874.342154]

These are the results on the test test for a regression problem. The first two scores are MSE and MAE, and the last one is MAPE, how is this possible ?

As a side question which might help answer, my dataset contains a good number of examples where the "good" answer is 0. How does Keras deal with it when computing MAPE since a division by 0 would occur ?

Tim
  • 108,699
  • 20
  • 212
  • 390
linSESH
  • 103
  • 4
  • I don't see how my question is unclear since Tim managed to answer it, my MAPE is probably very high because of epsilon parameter – linSESH Jun 28 '19 at 13:35

1 Answers1

3

Keras uses

def mean_absolute_percentage_error(y_true, y_pred):

    diff = K.abs((y_true - y_pred) / K.clip(K.abs(y_true),
                                            K.epsilon(),
                                            None))

    return 100. * K.mean(diff, axis=-1)

where K.epsilon() is a very small value. If you divide something, by something very small, you get a very big number.

If you have zeros you should not use MAPE as error measure.

Tim
  • 108,699
  • 20
  • 212
  • 390