GaussClusterable wraps Gaussian statistics in a form accessible to generic clustering algorithms. More...
#include <clusterable-classes.h>
Public Member Functions | |
GaussClusterable () | |
GaussClusterable (int32 dim, BaseFloat var_floor) | |
GaussClusterable (const Vector< BaseFloat > &x_stats, const Vector< BaseFloat > &x2_stats, BaseFloat var_floor, BaseFloat count) | |
virtual std::string | Type () const |
Return a string that describes the inherited type. More... | |
void | AddStats (const VectorBase< BaseFloat > &vec, BaseFloat weight=1.0) |
virtual BaseFloat | Objf () const |
Return the objective function associated with the stats [assuming ML estimation]. More... | |
virtual void | SetZero () |
Set stats to empty. More... | |
virtual void | Add (const Clusterable &other_in) |
Add other stats. More... | |
virtual void | Sub (const Clusterable &other_in) |
Subtract other stats. More... | |
virtual BaseFloat | Normalizer () const |
Return the normalizer (typically, count) associated with the stats. More... | |
virtual Clusterable * | Copy () const |
Return a copy of this object. More... | |
virtual void | Scale (BaseFloat f) |
Scale the stats by a positive number f [not mandatory to supply this]. More... | |
virtual void | Write (std::ostream &os, bool binary) const |
Write data to stream. More... | |
virtual Clusterable * | ReadNew (std::istream &is, bool binary) const |
Read data from a stream and return the corresponding object (const function; it's a class member because we need access to the vtable so generic code can read derived types). More... | |
virtual | ~GaussClusterable () |
BaseFloat | count () const |
SubVector< double > | x_stats () const |
SubVector< double > | x2_stats () const |
Public Member Functions inherited from Clusterable | |
virtual | ~Clusterable () |
virtual BaseFloat | ObjfPlus (const Clusterable &other) const |
Return the objective function of the combined object this + other. More... | |
virtual BaseFloat | ObjfMinus (const Clusterable &other) const |
Return the objective function of the subtracted object this - other. More... | |
virtual BaseFloat | Distance (const Clusterable &other) const |
Return the objective function decrease from merging the two clusters, negated to be a positive number (or zero). More... | |
Private Member Functions | |
void | Read (std::istream &is, bool binary) |
Private Attributes | |
double | count_ |
Matrix< double > | stats_ |
double | var_floor_ |
GaussClusterable wraps Gaussian statistics in a form accessible to generic clustering algorithms.
Definition at line 65 of file clusterable-classes.h.
|
inline |
Definition at line 67 of file clusterable-classes.h.
|
inline |
|
inline |
Definition at line 107 of file clusterable-classes.h.
References MatrixBase< Real >::Row(), and GaussClusterable::stats_.
|
inlinevirtual |
Definition at line 86 of file clusterable-classes.h.
|
virtual |
Add other stats.
Implements Clusterable.
Definition at line 144 of file clusterable-classes.cc.
References GaussClusterable::count_, KALDI_ASSERT, and Clusterable::Type().
Referenced by GaussClusterable::Copy(), and VectorClusterable::SetZero().
void AddStats | ( | const VectorBase< BaseFloat > & | vec, |
BaseFloat | weight = 1.0 |
||
) |
Definition at line 137 of file clusterable-classes.cc.
Referenced by kaldi::GenRandStats().
|
virtual |
Return a copy of this object.
Implements Clusterable.
Definition at line 160 of file clusterable-classes.cc.
References GaussClusterable::Add(), and KALDI_ASSERT.
Referenced by VectorClusterable::Normalizer().
|
inline |
Definition at line 88 of file clusterable-classes.h.
References ScalarClusterable::count_.
Referenced by kaldi::ClusterGaussiansToUbm(), DiagGmm::DiagGmm(), kaldi::InitAmGmm(), and DiagGmm::MergeKmeans().
|
inlinevirtual |
Return the normalizer (typically, count) associated with the stats.
Implements Clusterable.
Definition at line 81 of file clusterable-classes.h.
References ScalarClusterable::Copy(), ScalarClusterable::count_, ScalarClusterable::ReadNew(), Clusterable::Scale(), and ScalarClusterable::Write().
|
virtual |
Return the objective function associated with the stats [assuming ML estimation].
Implements Clusterable.
Definition at line 193 of file clusterable-classes.cc.
References rnnlm::d, KALDI_ISNAN, KALDI_WARN, M_LOG_2PI, and VectorBase< Real >::SumLog().
Referenced by VectorClusterable::Type().
|
private |
Definition at line 186 of file clusterable-classes.cc.
References kaldi::ExpectToken(), and kaldi::ReadBasicType().
Referenced by GaussClusterable::ReadNew().
|
virtual |
Read data from a stream and return the corresponding object (const function; it's a class member because we need access to the vtable so generic code can read derived types).
Implements Clusterable.
Definition at line 180 of file clusterable-classes.cc.
References GaussClusterable::Read().
Referenced by VectorClusterable::Normalizer().
|
virtual |
Scale the stats by a positive number f [not mandatory to supply this].
Reimplemented from Clusterable.
Definition at line 167 of file clusterable-classes.cc.
References KALDI_ASSERT.
Referenced by VectorClusterable::Normalizer().
|
inlinevirtual |
Set stats to empty.
Implements Clusterable.
Definition at line 102 of file clusterable-classes.h.
References ScalarClusterable::count_.
|
virtual |
Subtract other stats.
Implements Clusterable.
Definition at line 152 of file clusterable-classes.cc.
References GaussClusterable::count_, KALDI_ASSERT, and Clusterable::Type().
Referenced by VectorClusterable::SetZero().
|
inlinevirtual |
Return a string that describes the inherited type.
Implements Clusterable.
Definition at line 75 of file clusterable-classes.h.
References ScalarClusterable::Add(), ScalarClusterable::Objf(), ScalarClusterable::SetZero(), and ScalarClusterable::Sub().
|
virtual |
Write data to stream.
Implements Clusterable.
Definition at line 173 of file clusterable-classes.cc.
References kaldi::WriteBasicType(), and kaldi::WriteToken().
Referenced by VectorClusterable::Normalizer().
|
inline |
Definition at line 91 of file clusterable-classes.h.
Referenced by kaldi::ClusterGaussiansToUbm(), DiagGmm::DiagGmm(), and DiagGmm::MergeKmeans().
|
inline |
Definition at line 90 of file clusterable-classes.h.
Referenced by kaldi::ClusterGaussiansToUbm(), DiagGmm::DiagGmm(), and DiagGmm::MergeKmeans().
|
private |
Definition at line 93 of file clusterable-classes.h.
Referenced by GaussClusterable::Add(), and GaussClusterable::Sub().
|
private |
Definition at line 94 of file clusterable-classes.h.
Referenced by GaussClusterable::GaussClusterable(), and VectorClusterable::SetZero().
|
private |
Definition at line 95 of file clusterable-classes.h.