ModErn Text Analysis
META Enumerates Textual Applications
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
include
stats
dirichlet.h
Go to the documentation of this file.
1
9
#ifndef META_STATS_DIRICHLET_H_
10
#define META_STATS_DIRICHLET_H_
11
12
#include <cstdint>
13
#include <memory>
14
#include "
util/sparse_vector.h
"
15
16
namespace
meta
17
{
18
namespace
stats
19
{
20
26
template
<
class
T>
27
class
dirichlet
28
{
29
public
:
37
dirichlet
(
double
alpha, uint64_t n);
38
47
template
<
class
Iter>
48
dirichlet
(Iter begin, Iter end);
49
53
dirichlet
(
const
dirichlet
& other);
54
58
dirichlet
(
dirichlet
&& other);
59
63
dirichlet
&
operator=
(
dirichlet
rhs);
64
68
~dirichlet
();
69
77
double
pseudo_counts
(
const
T& event)
const
;
78
83
double
pseudo_counts
()
const
;
84
89
void
swap
(
dirichlet
& other);
90
91
private
:
92
93
enum class
type
94
{
95
SYMMETRIC,
96
ASYMMETRIC
97
} type_;
98
99
union
parameters
100
{
101
parameters
()
102
{
103
// nothing
104
}
105
106
parameters
(
double
alpha)
107
{
108
fixed_alpha_ = alpha;
109
}
110
111
template
<
class
Iter>
112
parameters
(Iter begin, Iter end)
113
{
114
new
(&sparse_alpha_)
util::sparse_vector<T, double>
{begin, end};
115
}
116
117
~
parameters
()
118
{
119
// nothing
120
}
121
122
double
fixed_alpha_;
123
util::sparse_vector<T, double>
sparse_alpha_;
124
} params_;
125
126
double
alpha_sum_;
127
};
128
}
129
}
130
131
#include "
stats/dirichlet.tcc
"
132
#endif
meta::stats::dirichlet::operator=
dirichlet & operator=(dirichlet rhs)
Assignment operator.
Definition:
dirichlet.tcc:68
meta::stats::dirichlet
Represents a Dirichlet distribution.
Definition:
dirichlet.h:27
meta::stats::dirichlet::~dirichlet
~dirichlet()
Destructor.
Definition:
dirichlet.tcc:75
meta::stats::dirichlet::pseudo_counts
double pseudo_counts() const
Obtains the number of total "pseudo-counts" associated with this distribution when used as a prior fo...
Definition:
dirichlet.tcc:101
meta::stats::dirichlet::parameters
Definition:
dirichlet.h:99
meta::util::sparse_vector< T, double >
meta
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retreival, data mining, and other applications of text processing.
Definition:
analyzer.h:24
meta::stats::dirichlet::swap
void swap(dirichlet &other)
Swaps this dirichlet with the parameter.
Definition:
dirichlet.tcc:107
meta::stats::dirichlet::dirichlet
dirichlet(double alpha, uint64_t n)
Constructs a symmetric Dirichlet with concentration parameter and dimension .
Definition:
dirichlet.tcc:16
sparse_vector.h
dirichlet.tcc
Generated on Tue Mar 3 2015 23:20:16 for ModErn Text Analysis by
1.8.9.1