SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  * Copyright (c) 2011 Berlin Institute of Technohingey and Max-Planck-Society.
9  */
10 
12 
13 using namespace shogun;
14 
16 {
17  float64_t z = prediction * label;
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 
26 {
27  float64_t z = prediction * label;
28  if (z < 0)
29  return -1;
30  if (z < 1)
31  return z-1;
32  return 0;
33 }
34 
36 {
37  float64_t z = prediction * label;
38  if (z < 0)
39  return 0;
40  if (z < 1)
41  return 1;
42  return 0;
43 }
44 
46 {
48  return -1;
49 }
50 
52 {
54  return -1;
55 }

SHOGUN Machine Learning Toolbox - Documentation