2

I am finetuning imagenet for a regression problem in caffe. At present I am using Eucliden Loss, but I don't think it is any good in my case.
I want the loss values to be the spearman coefficient between predicted labels and actual labels. How can I do so?

Please help!

Shai
  • 111,146
  • 38
  • 238
  • 371
Deven
  • 617
  • 2
  • 6
  • 20
  • 1
    If I'm not mistaken, in order to compute the Spearman Coefficient you need to rank (=sort) your predictions. Are you going to sort them globally? by batch? Given a batch and its predicted labels, would you be able to compute the Spearman Coefficient in, say, python? – Shai Jan 04 '16 at 19:14
  • I don't know about python, but given a vector of predicted labels and groundtruth labels, in matlab, I just use corr(predLables,groundLables,'Type','Spearman') for calculating rho. – Deven Jan 04 '16 at 19:24
  • and what is its derivative w.r.t the scores? I'm not sure it's differentiable – Shai Jan 04 '16 at 19:36
  • I lost you there, why do we need to have concern for derivatives and differentiability? – Deven Jan 04 '16 at 19:39
  • because you need the gradients for the optimization. you can't train without gradients: it's SGD: Stochastic GRADIENT Descent – Shai Jan 04 '16 at 19:53
  • ok, that means I can't use this as a loss function, guess I will have to do with mse. – Deven Jan 04 '16 at 20:37
  • there's hinge loss and l1 loss... there are quite a few to pick from... – Shai Jan 04 '16 at 20:38

1 Answers1

1

As cleared in the comment section, since the loss function needs to be differentiable, and spearman coefficient isn't, we can't use it as a loss function.

Deven
  • 617
  • 2
  • 6
  • 20