SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LogLossMargin.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 Technology and Max-Planck-Society.
10  */
11 
13 #include <shogun/io/SGIO.h>
14 
15 using namespace shogun;
16 
18 {
19  if (z >= 1)
20  return log(1+exp(1-z));
21 
22  return 1-z + log(1+exp(z-1));
23 }
24 
26 {
27  if (z < 1)
28  return -1 / (exp(z-1) + 1);
29 
30  float64_t ez = exp(1-z);
31  return -ez / (ez + 1);
32 }
33 
35 {
36  float64_t ez = exp(z-1);
37 
38  return ez / (ez + 1)*(ez + 1);
39 }
40 
42 {
44  return -1;
45 }
46 
48 {
50  return -1;
51 }

SHOGUN Machine Learning Toolbox - Documentation