Public Member Functions | |
CompartmentalizedBottomUpClusterer (const vector< vector< Clusterable *> > &points, BaseFloat max_merge_thresh, int32 min_clust) | |
BaseFloat | Cluster (vector< vector< Clusterable *> > *clusters_out, vector< vector< int32 > > *assignments_out) |
~CompartmentalizedBottomUpClusterer () | |
Private Types | |
typedef std::priority_queue< CompBotClustElem, std::vector< CompBotClustElem >, std::greater< CompBotClustElem > > | QueueType |
Private Member Functions | |
void | Renumber (int32 compartment) |
void | InitializeAssignments () |
void | SetInitialDistances () |
Sets up distances and queue. More... | |
bool | CanMerge (int32 compartment, int32 i, int32 j, BaseFloat dist) |
CanMerge returns true if i and j are existing clusters, and the distance (negated objf-change) "dist" is accurate (i.e. More... | |
BaseFloat | MergeClusters (int32 compartment, int32 i, int32 j) |
Merge j into i and delete j. Returns obj function change. More... | |
void | ReconstructQueue () |
Reconstructs the priority queue from the distances. More... | |
void | SetDistance (int32 compartment, int32 i, int32 j) |
Private Attributes | |
const vector< vector< Clusterable * > > & | points_ |
BaseFloat | max_merge_thresh_ |
int32 | min_clust_ |
vector< vector< Clusterable * > > | clusters_ |
vector< vector< int32 > > | assignments_ |
vector< vector< BaseFloat > > | dist_vec_ |
int32 | ncompartments_ |
int32 | nclusters_ |
vector< int32 > | npoints_ |
QueueType | queue_ |
Definition at line 442 of file cluster-utils.cc.
|
private |
Definition at line 491 of file cluster-utils.cc.
|
inline |
Definition at line 444 of file cluster-utils.cc.
References BottomUpClusterer::Cluster(), BottomUpClusterer::nclusters_, and BottomUpClusterer::npoints_.
|
inline |
Definition at line 459 of file cluster-utils.cc.
References BottomUpClusterer::CanMerge(), BottomUpClusterer::clusters_, kaldi::DeletePointers(), rnnlm::i, BottomUpClusterer::InitializeAssignments(), rnnlm::j, BottomUpClusterer::MergeClusters(), BottomUpClusterer::ReconstructQueue(), BottomUpClusterer::Renumber(), BottomUpClusterer::SetDistance(), and BottomUpClusterer::SetInitialDistances().
CanMerge returns true if i and j are existing clusters, and the distance (negated objf-change) "dist" is accurate (i.e.
not outdated).
Definition at line 584 of file cluster-utils.cc.
References BottomUpClusterer::clusters_, BottomUpClusterer::dist_vec_, rnnlm::j, KALDI_ASSERT, and BottomUpClusterer::npoints_.
BaseFloat Cluster | ( | vector< vector< Clusterable *> > * | clusters_out, |
vector< vector< int32 > > * | assignments_out | ||
) |
Definition at line 495 of file cluster-utils.cc.
References BottomUpClusterer::assignments_, BottomUpClusterer::CanMerge(), BottomUpClusterer::clusters_, CompBotClustElem::compartment, CompBotClustElem::dist, BottomUpClusterer::InitializeAssignments(), BottomUpClusterer::MergeClusters(), BottomUpClusterer::min_clust_, BottomUpClusterer::nclusters_, CompBotClustElem::point1, CompBotClustElem::point2, BottomUpClusterer::queue_, BottomUpClusterer::Renumber(), and BottomUpClusterer::SetInitialDistances().
Referenced by kaldi::ClusterBottomUpCompartmentalized().
|
private |
Definition at line 561 of file cluster-utils.cc.
References BottomUpClusterer::assignments_, BottomUpClusterer::clusters_, rnnlm::i, BottomUpClusterer::npoints_, and BottomUpClusterer::points_.
Merge j into i and delete j. Returns obj function change.
Definition at line 593 of file cluster-utils.cc.
References BottomUpClusterer::assignments_, BottomUpClusterer::clusters_, BottomUpClusterer::dist_vec_, rnnlm::i, rnnlm::j, KALDI_ASSERT, BottomUpClusterer::nclusters_, BottomUpClusterer::npoints_, BottomUpClusterer::queue_, BottomUpClusterer::ReconstructQueue(), and BottomUpClusterer::SetDistance().
|
private |
Reconstructs the priority queue from the distances.
Definition at line 622 of file cluster-utils.cc.
References BottomUpClusterer::clusters_, rnnlm::i, rnnlm::j, BottomUpClusterer::npoints_, BottomUpClusterer::queue_, BottomUpClusterer::SetDistance(), and kaldi::swap().
|
private |
Definition at line 516 of file cluster-utils.cc.
References BottomUpClusterer::assignments_, BottomUpClusterer::clusters_, rnnlm::i, KALDI_ASSERT, BottomUpClusterer::nclusters_, BottomUpClusterer::npoints_, BottomUpClusterer::queue_, and kaldi::swap().
Definition at line 639 of file cluster-utils.cc.
References BottomUpClusterer::clusters_, BottomUpClusterer::dist_vec_, rnnlm::i, rnnlm::j, KALDI_ASSERT, BottomUpClusterer::max_merge_thresh_, BottomUpClusterer::npoints_, and BottomUpClusterer::queue_.
|
private |
Sets up distances and queue.
Definition at line 574 of file cluster-utils.cc.
References BottomUpClusterer::dist_vec_, rnnlm::i, rnnlm::j, BottomUpClusterer::npoints_, and BottomUpClusterer::SetDistance().
|
private |
Definition at line 485 of file cluster-utils.cc.
|
private |
Definition at line 484 of file cluster-utils.cc.
|
private |
Definition at line 486 of file cluster-utils.cc.
|
private |
Definition at line 482 of file cluster-utils.cc.
|
private |
Definition at line 483 of file cluster-utils.cc.
|
private |
Definition at line 487 of file cluster-utils.cc.
|
private |
Definition at line 487 of file cluster-utils.cc.
|
private |
Definition at line 488 of file cluster-utils.cc.
|
private |
Definition at line 481 of file cluster-utils.cc.
|
private |
Definition at line 492 of file cluster-utils.cc.