00001 /* 00002 Copyright (c) 2009 Yahoo! Inc. All rights reserved. The copyrights 00003 embodied in the content of this file are licensed under the BSD 00004 (revised) open source license. 00005 00006 Copyright (c) 2011 Berlin Institute of Technology and Max-Planck-Society. 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 Modifications (w) 2011 Shashwat Lal Das 00014 Modifications (w) 2012 Fernando José Iglesias García 00015 */ 00016 00017 #ifndef _HINGELOSS_H__ 00018 #define _HINGELOSS_H__ 00019 00020 #include <shogun/loss/LossFunction.h> 00021 00022 namespace shogun 00023 { 00027 class CHingeLoss: public CLossFunction 00028 { 00029 public: 00033 CHingeLoss(): CLossFunction() {}; 00034 00038 ~CHingeLoss() {}; 00039 00048 float64_t loss(float64_t prediction, float64_t label); 00049 00058 float64_t loss(float64_t z); 00059 00068 virtual float64_t first_derivative(float64_t prediction, float64_t label); 00069 00077 virtual float64_t first_derivative(float64_t z); 00078 00087 virtual float64_t second_derivative(float64_t prediction, float64_t label); 00088 00096 virtual float64_t second_derivative(float64_t z); 00097 00108 virtual float64_t get_update(float64_t prediction, float64_t label, float64_t eta_t, float64_t norm); 00109 00118 virtual float64_t get_square_grad(float64_t prediction, float64_t label); 00119 00125 virtual ELossType get_loss_type() { return L_HINGELOSS; } 00126 00127 virtual const char* get_name() const { return "HingeLoss"; } 00128 }; 00129 00130 } 00131 00132 #endif