00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2011 Shashwat Lal Das 00008 * Copyright (c) 2011 Berlin Institute of TechnosquaredHingey and Max-Planck-Society. 00009 */ 00010 00011 #ifndef _SQUAREDHINGELOSS_H__ 00012 #define _SQUAREDHINGELOSS_H__ 00013 00014 #include <shogun/loss/LossFunction.h> 00015 00016 namespace shogun 00017 { 00021 class CSquaredHingeLoss: public CLossFunction 00022 { 00023 public: 00027 CSquaredHingeLoss(): CLossFunction() {}; 00028 00032 ~CSquaredHingeLoss() {}; 00033 00042 float64_t loss(float64_t prediction, float64_t label); 00043 00052 virtual float64_t first_derivative(float64_t prediction, float64_t label); 00053 00062 virtual float64_t second_derivative(float64_t prediction, float64_t label); 00063 00074 virtual float64_t get_update(float64_t prediction, float64_t label, float64_t eta_t, float64_t norm); 00075 00084 virtual float64_t get_square_grad(float64_t prediction, float64_t label); 00085 00091 virtual ELossType get_loss_type() { return L_SQUAREDHINGELOSS; } 00092 00098 virtual const char* get_name() const { return "SquaredHingeLoss"; } 00099 }; 00100 00101 } 00102 00103 #endif // _SQUAREDHINGELOSS_H__