SmoothHingeLoss.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/SmoothHingeLoss.h>
00013 
00014 using namespace shogun;
00015 
00016 float64_t CSmoothHingeLoss::loss(float64_t z)
00017 {
00018     if (z < 0)
00019         return 0.5 - z;
00020     if (z < 1)
00021         return 0.5 * (1-z) * (1-z);
00022     return 0;
00023 }
00024 
00025 float64_t CSmoothHingeLoss::first_derivative(float64_t z)
00026 {
00027     if (z < 0)
00028         return -1;
00029     if (z < 1)
00030         return z-1;
00031     return 0;
00032 }
00033 
00034 float64_t CSmoothHingeLoss::second_derivative(float64_t z)
00035 {
00036     if (z < 0)
00037         return 0;
00038     if (z < 1)
00039         return 1;
00040     return 0;
00041 }
00042 
00043 float64_t CSmoothHingeLoss::get_update(float64_t prediction, float64_t label, float64_t eta_t, float64_t norm)
00044 {
00045     SG_NOTIMPLEMENTED;
00046     return -1;
00047 }
00048 
00049 float64_t CSmoothHingeLoss::get_square_grad(float64_t prediction, float64_t label)
00050 {
00051     SG_NOTIMPLEMENTED;
00052     return -1;
00053 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation