SHOGUN  4.1.0
SquaredLoss.cpp
Go to the documentation of this file.
1 /*
3  embodied in the content of this file are licensed under the BSD
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
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  Modifications (w) 2012 Fernando José Iglesias García
15 */
16
19
20 using namespace shogun;
21
23 {
24  return (prediction - label) * (prediction - label);
25 }
26
28 {
29  return z*z;
30 }
31
33 {
34  return 2. * (prediction - label);
35 }
36
38 {
39  return 2. * z;
40 }
41
43 {
44  return 2;
45 }
46
48 {
49  return 2;
50 }
51
53 {
54  if (eta_t < 1e-6)
55  {
56  /* When exp(-eta_t)~= 1 we replace 1-exp(-eta_t)
57  * with its first order Taylor expansion around 0
58  * to avoid catastrophic cancellation.
59  */
60  return (label - prediction)*eta_t/norm;
61  }
62  return (label - prediction)*(1-exp(-eta_t))/norm;
63 }
64
66 {
67  return (prediction - label) * (prediction - label);
68 }
double norm(double *v, double p, int n)
Definition: epph.cpp:452
float64_t first_derivative(float64_t prediction, float64_t label)
Definition: SquaredLoss.cpp:32
virtual float64_t get_square_grad(float64_t prediction, float64_t label)
Definition: SquaredLoss.cpp:65
double float64_t
Definition: common.h:50
float64_t second_derivative(float64_t prediction, float64_t label)
Definition: SquaredLoss.cpp:42
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
float64_t loss(float64_t prediction, float64_t label)
Definition: SquaredLoss.cpp:22
virtual float64_t get_update(float64_t prediction, float64_t label, float64_t eta_t, float64_t norm)
Definition: SquaredLoss.cpp:52

SHOGUN Machine Learning Toolbox - Documentation