I've started playing a bit with reinforcement learning (in the context of Neural Networks) and I'm having some difficulties with reward functions.

I've seen that for classification problems what people simply do is give a reward of 1 when the classification is correct, and give a reward of 0 when it's wrong. Say that I'm trying to solve a regression problem in which RL is involved (one can think of the MNIST autoencoder for example), how would you define the reward in that case?

The most intuitive thing I can come up with is to look at 1/(norm of the error), so the closer the two vectors are the larger the reward would be, but I'm sure there are much better solutions without the problematic boundaries.

Would be happy to hear a suggestion or get a reference to a related work.

  • $\begingroup$ Are you sure that you want to use RL for classification? It is possible, just not usual, that's why I ask. $\endgroup$
    – rcpinto
    Apr 3, 2016 at 20:35
  • $\begingroup$ Specifically, I'm interested in RL for regression, but I've seen some works that cleverly use RL to train a non-differentiable part of a NN, even for classification tasks. $\endgroup$
    – eladrich
    Apr 4, 2016 at 7:50
  • $\begingroup$ Did you come around a paper (or implementation), where RL is used for regression problems? $\endgroup$
    – Lukas
    Mar 28, 2017 at 13:07

1 Answer 1


From what I understood about your problem, in such a case I think cosine similarity between the two vectors would be better fit for the task. Due to the (possibly) high-dimensional space where the vector is defined, this measure would, intuitively, take in higher regard the variations alongside all the space dimensions than the norm.

  • $\begingroup$ So in that case, the similarity won't measure the scaling between the vectors, right? It does seem like a cleaner metric for that case $\endgroup$
    – eladrich
    Apr 4, 2016 at 7:51
  • $\begingroup$ That's correct! You may think about it in terms of favoring lower angle between multiple vectors. $\endgroup$ Apr 4, 2016 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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