SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
metric
LMNN.h
浏览该文件的文档.
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) 2013 Fernando J. Iglesias Garcia
8
* Copyright (C) 2013 Fernando J. Iglesias Garcia
9
*/
10
11
#ifndef LMNN_H_
12
#define LMNN_H_
13
14
#include <
shogun/lib/config.h
>
15
16
#ifdef HAVE_EIGEN3
17
18
#include <
shogun/base/SGObject.h
>
19
#include <
shogun/distance/CustomMahalanobisDistance.h
>
20
#include <
shogun/features/DenseFeatures.h
>
21
#include <
shogun/labels/MulticlassLabels.h
>
22
#include <
shogun/lib/SGMatrix.h
>
23
24
namespace
shogun
25
{
26
27
// Forward declaration
28
class
CLMNNStatistics;
29
37
class
CLMNN
:
public
CSGObject
38
{
39
public
:
41
CLMNN
();
42
49
CLMNN
(
CDenseFeatures<float64_t>
* features,
CMulticlassLabels
* labels, int32_t k);
50
52
virtual
~CLMNN
();
53
55
virtual
const
char
*
get_name
()
const
;
56
64
void
train
(
SGMatrix<float64_t>
init_transform=
SGMatrix<float64_t>
());
65
70
SGMatrix<float64_t>
get_linear_transform
()
const
;
71
78
CCustomMahalanobisDistance
*
get_distance
()
const
;
79
84
int32_t
get_k
()
const
;
85
90
void
set_k
(
const
int32_t k);
91
96
float64_t
get_regularization
()
const
;
97
102
void
set_regularization
(
const
float64_t
regularization);
103
108
float64_t
get_stepsize
()
const
;
109
114
void
set_stepsize
(
const
float64_t
stepsize);
115
120
float64_t
get_stepsize_threshold
()
const
;
121
126
void
set_stepsize_threshold
(
const
float64_t
stepsize_threshold);
127
132
uint32_t
get_maxiter
()
const
;
133
138
void
set_maxiter
(
const
uint32_t maxiter);
139
144
uint32_t
get_correction
()
const
;
145
150
void
set_correction
(
const
uint32_t correction);
151
156
float64_t
get_obj_threshold
()
const
;
157
162
void
set_obj_threshold
(
const
float64_t
obj_threshold);
163
168
bool
get_diagonal
()
const
;
169
174
void
set_diagonal
(
const
bool
diagonal);
175
180
CLMNNStatistics
*
get_statistics
()
const
;
181
182
private
:
184
void
init();
185
186
private
:
188
SGMatrix<float64_t>
m_linear_transform;
189
191
CFeatures
* m_features;
192
194
CLabels
* m_labels;
195
200
float64_t
m_regularization;
201
203
int32_t m_k;
204
209
float64_t
m_stepsize;
210
216
float64_t
m_stepsize_threshold;
217
219
uint32_t m_maxiter;
220
225
uint32_t m_correction;
226
233
float64_t
m_obj_threshold;
234
239
bool
m_diagonal;
240
242
CLMNNStatistics
* m_statistics;
243
244
};
/* class CLMNN */
245
250
class
CLMNNStatistics
:
public
CSGObject
251
{
252
public
:
254
CLMNNStatistics
();
255
257
virtual
~CLMNNStatistics
();
258
260
virtual
const
char
*
get_name
()
const
;
261
268
void
resize
(int32_t size);
269
280
void
set
(
index_t
iter,
float64_t
obj_iter,
float64_t
stepsize_iter, uint32_t num_impostors_iter);
281
282
private
:
284
void
init();
285
286
public
:
288
SGVector<float64_t>
obj
;
289
291
SGVector<float64_t>
stepsize
;
292
294
SGVector<uint32_t>
num_impostors
;
295
};
296
297
}
/* namespace shogun */
298
299
#endif
/* HAVE_EIGEN3 */
300
301
#endif
/* LMNN_H_ */
SHOGUN
机器学习工具包 - 项目文档