SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
latent
LatentModel.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) 2012 Viktor Gal
8
* Copyright (C) 2012 Viktor Gal
9
*/
10
11
#ifndef __LATENTMODEL_H__
12
#define __LATENTMODEL_H__
13
14
#include <
shogun/labels/LatentLabels.h
>
15
#include <
shogun/features/LatentFeatures.h
>
16
#include <
shogun/features/DotFeatures.h
>
17
#include <
shogun/features/DenseFeatures.h
>
18
19
namespace
shogun
20
{
31
class
CLatentModel
:
public
CSGObject
32
{
33
public
:
35
CLatentModel
();
36
43
CLatentModel
(
CLatentFeatures
* feats,
CLatentLabels
* labels,
bool
do_caching =
true
);
44
46
virtual
~CLatentModel
();
47
52
virtual
int32_t
get_num_vectors
()
const
;
53
58
virtual
int32_t
get_dim
()
const
=0;
59
64
void
set_labels
(
CLatentLabels
* labs);
65
70
CLatentLabels
*
get_labels
()
const
;
71
76
void
set_features
(
CLatentFeatures
* feats);
77
82
CLatentFeatures
*
get_features
()
const
;
83
88
virtual
CDotFeatures
*
get_psi_feature_vectors
()=0;
89
98
virtual
CData
*
infer_latent_variable
(
const
SGVector<float64_t>
& w,
index_t
idx)=0;
99
105
virtual
void
argmax_h
(
const
SGVector<float64_t>
& w);
106
110
void
cache_psi_features
();
111
116
CDotFeatures
*
get_cached_psi_features
()
const
;
117
122
inline
bool
get_caching
()
const
123
{
124
return
m_do_caching
;
125
}
126
131
inline
void
set_caching
(
bool
caching)
132
{
133
m_do_caching
= caching;
134
}
135
140
virtual
const
char
*
get_name
()
const
{
return
"LatentModel"
; }
141
142
protected
:
144
CLatentFeatures
*
m_features
;
146
CLatentLabels
*
m_labels
;
148
bool
m_do_caching
;
150
CDotFeatures
*
m_cached_psi
;
151
152
private
:
154
void
register_parameters();
155
};
156
}
157
158
#endif
/* __LATENTMODEL_H__ */
159
SHOGUN
机器学习工具包 - 项目文档