SquaredHingeLoss.cpp

Go to the documentation of this file.
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  * Written (W) 2012 Fernando José Iglesias García
00009  * Copyright (c) 2011 Berlin Institute of Technohingey and Max-Planck-Society.
00010  */
00011 
00012 #include <shogun/loss/SquaredHingeLoss.h>
00013 
00014 using namespace shogun;
00015 
00016 float64_t CSquaredHingeLoss::loss(float64_t z)
00017 {
00018     return (z < 1) ? 0.5 * (1-z) * (1-z) : 0;
00019 }
00020 
00021 float64_t CSquaredHingeLoss::first_derivative(float64_t z)
00022 {
00023     return (z < 1) ? z-1 : 0;
00024 }
00025 
00026 float64_t CSquaredHingeLoss::second_derivative(float64_t z)
00027 {
00028     return (z < 1) ? 1 : 0;
00029 }
00030 
00031 float64_t CSquaredHingeLoss::get_update(float64_t prediction, float64_t label, float64_t eta_t, float64_t norm)
00032 {
00033     SG_NOTIMPLEMENTED;
00034     return -1;
00035 }
00036 
00037 float64_t CSquaredHingeLoss::get_square_grad(float64_t prediction, float64_t label)
00038 {
00039     SG_NOTIMPLEMENTED;
00040     return -1;
00041 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation