31 #ifndef SHARK_OBJECTIVEFUNCTIONS_LOSS_EPSILONHINGELOSS_H 32 #define SHARK_OBJECTIVEFUNCTIONS_LOSS_EPSILONHINGELOSS_H 61 {
return "EpsilonHingeLoss"; }
66 SIZE_CHECK(predictions.size1() == labels.size1());
67 SIZE_CHECK(predictions.size2() == labels.size2());
68 return sum(max(0.0,abs(labels-predictions)- m_epsilon));
72 SIZE_CHECK(predictions.size1() == labels.size1());
73 SIZE_CHECK(predictions.size2() == labels.size2());
74 std::size_t numInputs = predictions.size1();
75 std::size_t outputDim = predictions.size2();
77 gradient.resize(numInputs,outputDim);
79 for(std::size_t i = 0; i != numInputs;++i){
80 for(std::size_t o = 0; o != outputDim;++o){
81 double sampleLoss = std::max(0.0,std::abs(predictions(i,o)-labels(i,o))-m_epsilon);
85 if(predictions(i,o) > labels(i,o))