SHOGUN
v2.0.0
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
virtual
~CDistribution
();
47
56
virtual
bool
train
(
CFeatures
* data=NULL)=0;
57
64
virtual
int32_t
get_num_model_parameters
()=0;
65
71
virtual
int32_t
get_num_relevant_model_parameters
();
72
79
virtual
float64_t
get_log_model_parameter
(int32_t num_param)=0;
80
89
virtual
float64_t
get_log_derivative
(
90
int32_t num_param, int32_t num_example)=0;
91
99
virtual
float64_t
get_log_likelihood_example
(int32_t num_example)=0;
100
105
virtual
float64_t
get_log_likelihood_sample
();
106
111
virtual
SGVector<float64_t>
get_log_likelihood
();
112
118
virtual
inline
float64_t
get_model_parameter
(int32_t num_param)
119
{
120
return
exp(
get_log_model_parameter
(num_param));
121
}
122
129
virtual
inline
float64_t
get_derivative
(
130
int32_t num_param, int32_t num_example)
131
{
132
return
exp(
get_log_derivative
(num_param, num_example));
133
}
134
140
virtual
inline
float64_t
get_likelihood_example
(int32_t num_example)
141
{
142
return
exp(
get_log_likelihood_example
(num_example));
143
}
144
149
virtual
inline
void
set_features
(
CFeatures
* f)
150
{
151
SG_UNREF
(
features
);
152
SG_REF
(f);
153
features
=f;
154
}
155
160
virtual
inline
CFeatures
*
get_features
()
161
{
162
SG_REF
(
features
);
163
return
features
;
164
}
165
170
virtual
inline
void
set_pseudo_count
(
float64_t
pseudo) {
pseudo_count
=pseudo; }
171
176
virtual
inline
float64_t
get_pseudo_count
() {
return
pseudo_count
; }
177
178
protected
:
180
CFeatures
*
features
;
182
float64_t
pseudo_count
;
183
};
184
}
185
#endif
SHOGUN
Machine Learning Toolbox - Documentation