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 _SQUAREDLOSS_H__ 00018 #define _SQUAREDLOSS_H__ 00019 00020 #include <shogun/loss/LossFunction.h> 00021 00022 namespace shogun 00023 { 00027 class CSquaredLoss: public CLossFunction 00028 { 00029 public: 00033 CSquaredLoss(): CLossFunction() {}; 00034 00038 ~CSquaredLoss() {}; 00039 00048 float64_t loss(float64_t prediction, float64_t label); 00049 00057 float64_t loss(float64_t z); 00058 00067 float64_t first_derivative(float64_t prediction, float64_t label); 00068 00076 float64_t first_derivative(float64_t z); 00077 00086 float64_t second_derivative(float64_t prediction, float64_t label); 00087 00095 float64_t second_derivative(float64_t z); 00096 00107 virtual float64_t get_update(float64_t prediction, float64_t label, float64_t eta_t, float64_t norm); 00108 00117 virtual float64_t get_square_grad(float64_t prediction, float64_t label); 00118 00124 virtual ELossType get_loss_type() { return L_SQUAREDLOSS; } 00125 00126 virtual const char* get_name() const { return "SquaredLoss"; } 00127 }; 00128 00129 } 00130 00131 #endif