The AgglomerativeClusterer class contains the necessary mechanisms for the actual clustering algorithm. More...
#include <agglomerative-clustering.h>
Public Member Functions | |
AgglomerativeClusterer (const Matrix< BaseFloat > &costs, BaseFloat threshold, int32 min_clusters, int32 first_pass_max_points, BaseFloat max_cluster_fraction, std::vector< int32 > *assignments_out) | |
void | Cluster () |
void | ClusterSinglePass () |
void | ClusterTwoPass () |
Private Types | |
typedef std::pair< BaseFloat, uint32 > | QueueElement |
typedef std::priority_queue< QueueElement, std::vector< QueueElement >, std::greater< QueueElement > > | QueueType |
Private Member Functions | |
uint32 | EncodePair (int32 i, int32 j) |
std::pair< int32, int32 > | DecodePair (uint32 key) |
void | InitializeClusters (int32 first, int32 last) |
void | ComputeClusters (int32 min_clusters) |
void | AddClustersToSecondPass () |
void | AssignClusters () |
void | MergeClusters (int32 i, int32 j) |
Private Attributes | |
const Matrix< BaseFloat > & | costs_ |
BaseFloat | threshold_ |
int32 | min_clusters_ |
int32 | first_pass_max_points_ |
std::vector< int32 > * | assignments_ |
int32 | num_points_ |
int32 | max_cluster_size_ |
int32 | count_ |
int32 | second_pass_count_ |
QueueType | queue_ |
QueueType | second_pass_queue_ |
std::unordered_map< uint32, BaseFloat > | cluster_cost_map_ |
std::unordered_map< int32, AhcCluster * > | clusters_map_ |
std::set< int32 > | active_clusters_ |
std::unordered_map< uint32, BaseFloat > | second_pass_cluster_cost_map_ |
std::unordered_map< int32, AhcCluster * > | second_pass_clusters_map_ |
std::set< int32 > | second_pass_active_clusters_ |
The AgglomerativeClusterer class contains the necessary mechanisms for the actual clustering algorithm.
Definition at line 55 of file agglomerative-clustering.h.
|
private |
Definition at line 125 of file agglomerative-clustering.h.
|
private |
Definition at line 127 of file agglomerative-clustering.h.
|
inline |
Definition at line 57 of file agglomerative-clustering.h.
References rnnlm::i, rnnlm::j, and MatrixBase< Real >::NumRows().
|
private |
Definition at line 155 of file agglomerative-clustering.cc.
References AgglomerativeClusterer::active_clusters_, AgglomerativeClusterer::cluster_cost_map_, AgglomerativeClusterer::clusters_map_, AgglomerativeClusterer::costs_, count, AgglomerativeClusterer::EncodePair(), AgglomerativeClusterer::second_pass_active_clusters_, AgglomerativeClusterer::second_pass_cluster_cost_map_, AgglomerativeClusterer::second_pass_clusters_map_, AgglomerativeClusterer::second_pass_count_, AgglomerativeClusterer::second_pass_queue_, AhcCluster::size, AgglomerativeClusterer::threshold_, and AhcCluster::utt_ids.
Referenced by AgglomerativeClusterer::ClusterTwoPass().
|
private |
Definition at line 205 of file agglomerative-clustering.cc.
References AgglomerativeClusterer::active_clusters_, AgglomerativeClusterer::assignments_, AgglomerativeClusterer::clusters_map_, AgglomerativeClusterer::num_points_, and AhcCluster::utt_ids.
Referenced by AgglomerativeClusterer::ClusterSinglePass(), and AgglomerativeClusterer::ClusterTwoPass().
void Cluster | ( | ) |
Definition at line 27 of file agglomerative-clustering.cc.
References AgglomerativeClusterer::ClusterSinglePass(), AgglomerativeClusterer::ClusterTwoPass(), AgglomerativeClusterer::first_pass_max_points_, and AgglomerativeClusterer::num_points_.
Referenced by kaldi::AgglomerativeCluster().
void ClusterSinglePass | ( | ) |
Definition at line 34 of file agglomerative-clustering.cc.
References AgglomerativeClusterer::AssignClusters(), AgglomerativeClusterer::ComputeClusters(), AgglomerativeClusterer::InitializeClusters(), AgglomerativeClusterer::min_clusters_, and AgglomerativeClusterer::num_points_.
Referenced by AgglomerativeClusterer::Cluster().
void ClusterTwoPass | ( | ) |
Definition at line 40 of file agglomerative-clustering.cc.
References AgglomerativeClusterer::active_clusters_, AgglomerativeClusterer::AddClustersToSecondPass(), AgglomerativeClusterer::AssignClusters(), AgglomerativeClusterer::cluster_cost_map_, AgglomerativeClusterer::clusters_map_, AgglomerativeClusterer::ComputeClusters(), AgglomerativeClusterer::count_, AgglomerativeClusterer::first_pass_max_points_, AgglomerativeClusterer::InitializeClusters(), AgglomerativeClusterer::min_clusters_, rnnlm::n, AgglomerativeClusterer::num_points_, AgglomerativeClusterer::queue_, AgglomerativeClusterer::second_pass_active_clusters_, AgglomerativeClusterer::second_pass_cluster_cost_map_, AgglomerativeClusterer::second_pass_clusters_map_, AgglomerativeClusterer::second_pass_count_, and AgglomerativeClusterer::second_pass_queue_.
Referenced by AgglomerativeClusterer::Cluster().
|
private |
Definition at line 109 of file agglomerative-clustering.cc.
References AgglomerativeClusterer::active_clusters_, AgglomerativeClusterer::clusters_map_, AgglomerativeClusterer::DecodePair(), rnnlm::i, rnnlm::j, AgglomerativeClusterer::max_cluster_size_, AgglomerativeClusterer::MergeClusters(), and AgglomerativeClusterer::queue_.
Referenced by AgglomerativeClusterer::ClusterSinglePass(), and AgglomerativeClusterer::ClusterTwoPass().
Definition at line 78 of file agglomerative-clustering.cc.
Referenced by AgglomerativeClusterer::ComputeClusters().
Definition at line 71 of file agglomerative-clustering.cc.
References rnnlm::j.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), AgglomerativeClusterer::InitializeClusters(), and AgglomerativeClusterer::MergeClusters().
Definition at line 83 of file agglomerative-clustering.cc.
References AgglomerativeClusterer::active_clusters_, AgglomerativeClusterer::cluster_cost_map_, AgglomerativeClusterer::clusters_map_, AgglomerativeClusterer::costs_, AgglomerativeClusterer::EncodePair(), rnnlm::i, rnnlm::j, KALDI_ASSERT, AgglomerativeClusterer::queue_, and AgglomerativeClusterer::threshold_.
Referenced by AgglomerativeClusterer::ClusterSinglePass(), and AgglomerativeClusterer::ClusterTwoPass().
Definition at line 124 of file agglomerative-clustering.cc.
References AgglomerativeClusterer::active_clusters_, AgglomerativeClusterer::cluster_cost_map_, AgglomerativeClusterer::clusters_map_, AgglomerativeClusterer::count_, AgglomerativeClusterer::EncodePair(), rnnlm::i, AhcCluster::id, rnnlm::j, AhcCluster::parent1, AhcCluster::parent2, AgglomerativeClusterer::queue_, AhcCluster::size, AgglomerativeClusterer::threshold_, and AhcCluster::utt_ids.
Referenced by AgglomerativeClusterer::ComputeClusters().
|
private |
Definition at line 135 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), AgglomerativeClusterer::AssignClusters(), AgglomerativeClusterer::ClusterTwoPass(), AgglomerativeClusterer::ComputeClusters(), AgglomerativeClusterer::InitializeClusters(), and AgglomerativeClusterer::MergeClusters().
|
private |
Definition at line 116 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AssignClusters().
|
private |
Definition at line 131 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), AgglomerativeClusterer::ClusterTwoPass(), AgglomerativeClusterer::InitializeClusters(), and AgglomerativeClusterer::MergeClusters().
|
private |
Definition at line 133 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), AgglomerativeClusterer::AssignClusters(), AgglomerativeClusterer::ClusterTwoPass(), AgglomerativeClusterer::ComputeClusters(), AgglomerativeClusterer::InitializeClusters(), and AgglomerativeClusterer::MergeClusters().
Definition at line 112 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), and AgglomerativeClusterer::InitializeClusters().
|
private |
Definition at line 120 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::ClusterTwoPass(), and AgglomerativeClusterer::MergeClusters().
|
private |
Definition at line 115 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::Cluster(), and AgglomerativeClusterer::ClusterTwoPass().
|
private |
Definition at line 119 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::ComputeClusters().
|
private |
Definition at line 114 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::ClusterSinglePass(), and AgglomerativeClusterer::ClusterTwoPass().
|
private |
Definition at line 118 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AssignClusters(), AgglomerativeClusterer::Cluster(), AgglomerativeClusterer::ClusterSinglePass(), and AgglomerativeClusterer::ClusterTwoPass().
|
private |
Definition at line 128 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::ClusterTwoPass(), AgglomerativeClusterer::ComputeClusters(), AgglomerativeClusterer::InitializeClusters(), and AgglomerativeClusterer::MergeClusters().
|
private |
Definition at line 142 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), and AgglomerativeClusterer::ClusterTwoPass().
|
private |
Definition at line 138 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), and AgglomerativeClusterer::ClusterTwoPass().
|
private |
Definition at line 140 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), and AgglomerativeClusterer::ClusterTwoPass().
|
private |
Definition at line 121 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), and AgglomerativeClusterer::ClusterTwoPass().
|
private |
Definition at line 128 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), and AgglomerativeClusterer::ClusterTwoPass().
|
private |
Definition at line 113 of file agglomerative-clustering.h.
Referenced by AgglomerativeClusterer::AddClustersToSecondPass(), AgglomerativeClusterer::InitializeClusters(), and AgglomerativeClusterer::MergeClusters().