SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
loss
SmoothHingeLoss.cpp
浏览该文件的文档.
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
机器学习工具包 - 项目文档