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 */ 00015 00016 #ifndef _SQUAREDLOSS_H__ 00017 #define _SQUAREDLOSS_H__ 00018 00019 #include <shogun/loss/LossFunction.h> 00020 00021 namespace shogun 00022 { 00026 class CSquaredLoss: public CLossFunction 00027 { 00028 public: 00032 CSquaredLoss(): CLossFunction() {}; 00033 00037 ~CSquaredLoss() {}; 00038 00047 virtual float64_t loss(float64_t prediction, float64_t label); 00048 00057 virtual float64_t first_derivative(float64_t prediction, float64_t label); 00058 00067 virtual float64_t second_derivative(float64_t prediction, float64_t label); 00068 00079 virtual float64_t get_update(float64_t prediction, float64_t label, float64_t eta_t, float64_t norm); 00080 00089 virtual float64_t get_square_grad(float64_t prediction, float64_t label); 00090 00096 virtual ELossType get_loss_type() { return L_SQUAREDLOSS; } 00097 00098 virtual const char* get_name() const { return "SquaredLoss"; } 00099 }; 00100 00101 } 00102 00103 #endif