SHOGUN
3.2.1
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
distributions
Distribution.h
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) 1999-2009 Soeren Sonnenburg
8
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9
*/
10
11
#ifndef _DISTRIBUTION_H___
12
#define _DISTRIBUTION_H___
13
14
#include <
shogun/features/Features.h
>
15
#include <
shogun/mathematics/Math.h
>
16
#include <
shogun/base/SGObject.h
>
17
18
namespace
shogun
19
{
20
class
CFeatures;
21
class
CMath;
41
class
CDistribution
:
public
CSGObject
42
{
43
public
:
45
CDistribution
();
46
48
virtual
~CDistribution
();
49
58
virtual
bool
train
(
CFeatures
* data=NULL)=0;
59
66
virtual
int32_t
get_num_model_parameters
()=0;
67
73
virtual
int32_t
get_num_relevant_model_parameters
();
74
81
virtual
float64_t
get_log_model_parameter
(int32_t num_param)=0;
82
91
virtual
float64_t
get_log_derivative
(
92
int32_t num_param, int32_t num_example)=0;
93
101
virtual
float64_t
get_log_likelihood_example
(int32_t num_example)=0;
102
107
virtual
float64_t
get_log_likelihood_sample
();
108
113
virtual
SGVector<float64_t>
get_log_likelihood
();
114
120
virtual
float64_t
get_model_parameter
(int32_t num_param)
121
{
122
return
exp(
get_log_model_parameter
(num_param));
123
}
124
131
virtual
float64_t
get_derivative
(
132
int32_t num_param, int32_t num_example)
133
{
134
return
exp(
get_log_derivative
(num_param, num_example));
135
}
136
142
virtual
float64_t
get_likelihood_example
(int32_t num_example)
143
{
144
return
exp(
get_log_likelihood_example
(num_example));
145
}
146
151
virtual
SGVector<float64_t>
get_likelihood_for_all_examples
();
152
157
virtual
void
set_features
(
CFeatures
* f)
158
{
159
SG_REF
(f);
160
SG_UNREF
(
features
);
161
features
=f;
162
}
163
168
virtual
CFeatures
*
get_features
()
169
{
170
SG_REF
(
features
);
171
return
features
;
172
}
173
178
virtual
void
set_pseudo_count
(
float64_t
pseudo) {
pseudo_count
=pseudo; }
179
184
virtual
float64_t
get_pseudo_count
() {
return
pseudo_count
; }
185
186
protected
:
188
CFeatures
*
features
;
190
float64_t
pseudo_count
;
191
};
192
}
193
#endif
SHOGUN
Machine Learning Toolbox - Documentation