Guy P
Guy P

Reputation: 1423

Keras - Objective function for number in range [0-100]

Lets say I've ground truth (output) of a number in range [0-100]. Is it possible to learn to predict a number that minimize the delta from the original number (gt) according the input ?

The objective types of Keras are here http://keras.io/objectives/

Upvotes: 1

Views: 185

Answers (1)

1''
1''

Reputation: 27095

I think your best bet would be to use mean squared error (loss='mse'), which penalizes predictions based on the square of their difference from the ground truth. You would also want to use linear activations (the default) for the last layer.

If you're especially concerned about keeping the predictions within the range [0, 100], you could create a modified objective function that penalizes predictions outside [0, 100] even more than quadratically, but that's probably not necessary and you could instead just clip the predictions using np.clip(predictions, 0, 100).

Upvotes: 1

Related Questions