ScalarClusterable clusters scalars with x^2 loss. More...
#include <clusterable-classes.h>
Public Member Functions | |
ScalarClusterable () | |
ScalarClusterable (BaseFloat x) | |
virtual std::string | Type () const |
Return a string that describes the inherited type. More... | |
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 Clusterable * | Copy () const |
Return a copy of this object. More... | |
virtual BaseFloat | Normalizer () const |
Return the normalizer (typically, count) associated with the stats. 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... | |
std::string | Info () |
BaseFloat | Mean () |
Public Member Functions inherited from Clusterable | |
virtual void | Scale (BaseFloat f) |
Scale the stats by a positive number f [not mandatory to supply this]. More... | |
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 | |
BaseFloat | x_ |
BaseFloat | x2_ |
BaseFloat | count_ |
ScalarClusterable clusters scalars with x^2 loss.
Definition at line 34 of file clusterable-classes.h.
|
inline |
Definition at line 36 of file clusterable-classes.h.
|
inlineexplicit |
Definition at line 37 of file clusterable-classes.h.
|
virtual |
Add other stats.
Implements Clusterable.
Definition at line 78 of file clusterable-classes.cc.
References KALDI_ASSERT, Clusterable::Type(), and ScalarClusterable::x_.
Referenced by ScalarClusterable::Copy(), ScalarClusterable::SetZero(), kaldi::TestAddToClustersOptimized(), and GaussClusterable::Type().
|
virtual |
Return a copy of this object.
Implements Clusterable.
Definition at line 96 of file clusterable-classes.cc.
References ScalarClusterable::Add().
Referenced by GaussClusterable::Normalizer(), ScalarClusterable::SetZero(), and kaldi::TestAddToClusters().
std::string Info | ( | ) |
Definition at line 122 of file clusterable-classes.cc.
Referenced by ScalarClusterable::Normalizer().
|
inline |
Definition at line 53 of file clusterable-classes.h.
References ScalarClusterable::count_, and ScalarClusterable::x_.
Referenced by kaldi::TestAddToClusters().
|
inlinevirtual |
Return the normalizer (typically, count) associated with the stats.
Implements Clusterable.
Definition at line 44 of file clusterable-classes.h.
References ScalarClusterable::count_, ScalarClusterable::Info(), ScalarClusterable::ReadNew(), and ScalarClusterable::Write().
|
virtual |
Return the objective function associated with the stats [assuming ML estimation].
Implements Clusterable.
Definition at line 69 of file clusterable-classes.cc.
References KALDI_ASSERT.
Referenced by kaldi::TestDistance(), kaldi::TestObjfMinus(), kaldi::TestObjfPlus(), kaldi::TestSumObjfAndSumNormalizer(), ScalarClusterable::Type(), and GaussClusterable::Type().
|
private |
Definition at line 115 of file clusterable-classes.cc.
References kaldi::ExpectToken(), and kaldi::ReadBasicType().
Referenced by ScalarClusterable::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 109 of file clusterable-classes.cc.
References ScalarClusterable::Read().
Referenced by ScalarClusterable::Normalizer(), and GaussClusterable::Normalizer().
|
inlinevirtual |
Set stats to empty.
Implements Clusterable.
Definition at line 40 of file clusterable-classes.h.
References ScalarClusterable::Add(), ScalarClusterable::Copy(), ScalarClusterable::count_, ScalarClusterable::Sub(), ScalarClusterable::x2_, and ScalarClusterable::x_.
Referenced by GaussClusterable::Type().
|
virtual |
Subtract other stats.
Implements Clusterable.
Definition at line 87 of file clusterable-classes.cc.
References KALDI_ASSERT, Clusterable::Type(), and ScalarClusterable::x_.
Referenced by ScalarClusterable::SetZero(), and GaussClusterable::Type().
|
inlinevirtual |
Return a string that describes the inherited type.
Implements Clusterable.
Definition at line 38 of file clusterable-classes.h.
References ScalarClusterable::Objf().
|
virtual |
Write data to stream.
Implements Clusterable.
Definition at line 102 of file clusterable-classes.cc.
References kaldi::WriteBasicType(), and kaldi::WriteToken().
Referenced by ScalarClusterable::Normalizer(), and GaussClusterable::Normalizer().
|
private |
Definition at line 57 of file clusterable-classes.h.
Referenced by GaussClusterable::count(), ScalarClusterable::Mean(), ScalarClusterable::Normalizer(), GaussClusterable::Normalizer(), ScalarClusterable::SetZero(), and GaussClusterable::SetZero().
|
private |
Definition at line 56 of file clusterable-classes.h.
Referenced by ScalarClusterable::SetZero().
|
private |
Definition at line 55 of file clusterable-classes.h.
Referenced by ScalarClusterable::Add(), ScalarClusterable::Mean(), ScalarClusterable::SetZero(), and ScalarClusterable::Sub().