SHOGUN
v1.1.0
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
shogun
loss
LossFunction.h
Go to the documentation of this file.
1
/*
2
Copyright (c) 2009 Yahoo! Inc. All rights reserved. The copyrights
3
embodied in the content of this file are licensed under the BSD
4
(revised) open source license.
5
6
Copyright (c) 2011 Berlin Institute of Technology and Max-Planck-Society.
7
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3 of the License, or
11
(at your option) any later version.
12
13
Modifications (w) 2011 Shashwat Lal Das
14
*/
15
16
#ifndef _LOSSFUNCTION_H__
17
#define _LOSSFUNCTION_H__
18
19
#include <
shogun/base/SGObject.h
>
20
#include <
shogun/lib/common.h
>
21
#include <math.h>
22
23
namespace
shogun
24
{
26
enum
ELossType
27
{
28
L_HINGELOSS
= 0,
29
L_SMOOTHHINGELOSS
= 10,
30
L_SQUAREDHINGELOSS
= 20,
31
L_SQUAREDLOSS
= 30,
32
L_LOGLOSS
= 100,
33
L_LOGLOSSMARGIN
= 110
34
};
35
}
36
37
namespace
shogun
38
{
52
class
CLossFunction
:
public
CSGObject
53
{
54
public
:
55
59
CLossFunction
():
CSGObject
() {}
60
64
virtual
~CLossFunction
() {};
65
74
virtual
float64_t
loss
(
float64_t
prediction,
float64_t
label) = 0;
75
84
virtual
float64_t
first_derivative
(
float64_t
prediction,
float64_t
label) = 0;
85
94
virtual
float64_t
second_derivative
(
float64_t
prediction,
float64_t
label) = 0;
95
106
virtual
float64_t
get_update
(
float64_t
prediction,
float64_t
label,
float64_t
eta_t,
float64_t
norm) = 0;
107
116
virtual
float64_t
get_square_grad
(
float64_t
prediction,
float64_t
label) = 0;
117
125
virtual
ELossType
get_loss_type
()=0;
126
132
virtual
const
char
*
get_name
()
const
{
return
"LossFunction"
; }
133
};
134
}
135
#endif // _LOSSFUNCTION_H__
SHOGUN
Machine Learning Toolbox - Documentation