SHOGUN
v2.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
loss
SmoothHingeLoss.cpp
Go to the documentation of this file.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Written (W) 2011 Shashwat Lal Das
8
* Written (W) 2012 Fernando José Iglesias García
9
* Copyright (c) 2011 Berlin Institute of Technohingey and Max-Planck-Society.
10
*/
11
12
#include <
shogun/loss/SmoothHingeLoss.h
>
13
14
using namespace
shogun;
15
16
float64_t
CSmoothHingeLoss::loss
(
float64_t
z)
17
{
18
if
(z < 0)
19
return
0.5 - z;
20
if
(z < 1)
21
return
0.5 * (1-z) * (1-z);
22
return
0;
23
}
24
25
float64_t
CSmoothHingeLoss::first_derivative
(
float64_t
z)
26
{
27
if
(z < 0)
28
return
-1;
29
if
(z < 1)
30
return
z-1;
31
return
0;
32
}
33
34
float64_t
CSmoothHingeLoss::second_derivative
(
float64_t
z)
35
{
36
if
(z < 0)
37
return
0;
38
if
(z < 1)
39
return
1;
40
return
0;
41
}
42
43
float64_t
CSmoothHingeLoss::get_update
(
float64_t
prediction,
float64_t
label,
float64_t
eta_t,
float64_t
norm
)
44
{
45
SG_NOTIMPLEMENTED
;
46
return
-1;
47
}
48
49
float64_t
CSmoothHingeLoss::get_square_grad
(
float64_t
prediction,
float64_t
label)
50
{
51
SG_NOTIMPLEMENTED
;
52
return
-1;
53
}
SHOGUN
Machine Learning Toolbox - Documentation