Public Member Functions | |
BottomUpClusterer (const std::vector< Clusterable *> &points, BaseFloat max_merge_thresh, int32 min_clust, std::vector< Clusterable *> *clusters_out, std::vector< int32 > *assignments_out) | |
BaseFloat | Cluster () |
~BottomUpClusterer () | |
Private Types | |
typedef std::pair< BaseFloat, std::pair< uint_smaller, uint_smaller > > | QueueElement |
typedef std::priority_queue< QueueElement, std::vector< QueueElement >, std::greater< QueueElement > > | QueueType |
Private Member Functions | |
void | Renumber () |
void | InitializeAssignments () |
void | SetInitialDistances () |
Sets up distances and queue. More... | |
bool | CanMerge (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... | |
void | MergeClusters (int32 i, int32 j) |
Merge j into i and delete j. More... | |
void | ReconstructQueue () |
Reconstructs the priority queue from the distances. More... | |
void | SetDistance (int32 i, int32 j) |
BaseFloat & | Distance (int32 i, int32 j) |
Private Attributes | |
BaseFloat | ans_ |
const std::vector< Clusterable * > & | points_ |
BaseFloat | max_merge_thresh_ |
int32 | min_clust_ |
std::vector< Clusterable * > * | clusters_ |
std::vector< int32 > * | assignments_ |
std::vector< Clusterable * > | tmp_clusters_ |
std::vector< int32 > | tmp_assignments_ |
std::vector< BaseFloat > | dist_vec_ |
int32 | nclusters_ |
int32 | npoints_ |
QueueType | queue_ |
Definition at line 193 of file cluster-utils.cc.
|
private |
Definition at line 242 of file cluster-utils.cc.
|
private |
Definition at line 245 of file cluster-utils.cc.
|
inline |
Definition at line 195 of file cluster-utils.cc.
References BottomUpClusterer::Cluster(), BottomUpClusterer::dist_vec_, BottomUpClusterer::nclusters_, and BottomUpClusterer::npoints_.
|
inline |
Definition at line 209 of file cluster-utils.cc.
References BottomUpClusterer::CanMerge(), kaldi::DeletePointers(), rnnlm::i, BottomUpClusterer::InitializeAssignments(), rnnlm::j, BottomUpClusterer::MergeClusters(), BottomUpClusterer::ReconstructQueue(), BottomUpClusterer::Renumber(), BottomUpClusterer::SetDistance(), BottomUpClusterer::SetInitialDistances(), and BottomUpClusterer::tmp_clusters_.
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 337 of file cluster-utils.cc.
References BottomUpClusterer::clusters_, BottomUpClusterer::dist_vec_, rnnlm::j, KALDI_ASSERT, and BottomUpClusterer::npoints_.
Referenced by BottomUpClusterer::Cluster(), CompartmentalizedBottomUpClusterer::Cluster(), BottomUpClusterer::~BottomUpClusterer(), and CompartmentalizedBottomUpClusterer::~CompartmentalizedBottomUpClusterer().
BaseFloat Cluster | ( | ) |
Definition at line 249 of file cluster-utils.cc.
References BottomUpClusterer::ans_, BottomUpClusterer::CanMerge(), rnnlm::i, BottomUpClusterer::InitializeAssignments(), rnnlm::j, KALDI_VLOG, BottomUpClusterer::MergeClusters(), BottomUpClusterer::min_clust_, BottomUpClusterer::nclusters_, BottomUpClusterer::queue_, BottomUpClusterer::Renumber(), and BottomUpClusterer::SetInitialDistances().
Referenced by BottomUpClusterer::BottomUpClusterer(), kaldi::ClusterBottomUp(), and CompartmentalizedBottomUpClusterer::CompartmentalizedBottomUpClusterer().
Definition at line 224 of file cluster-utils.cc.
References BottomUpClusterer::dist_vec_, rnnlm::j, KALDI_ASSERT, and BottomUpClusterer::npoints_.
|
private |
Definition at line 316 of file cluster-utils.cc.
References BottomUpClusterer::assignments_, BottomUpClusterer::clusters_, rnnlm::i, BottomUpClusterer::npoints_, and BottomUpClusterer::points_.
Referenced by BottomUpClusterer::Cluster(), CompartmentalizedBottomUpClusterer::Cluster(), BottomUpClusterer::~BottomUpClusterer(), and CompartmentalizedBottomUpClusterer::~CompartmentalizedBottomUpClusterer().
Merge j into i and delete j.
Definition at line 345 of file cluster-utils.cc.
References BottomUpClusterer::ans_, BottomUpClusterer::clusters_, BottomUpClusterer::dist_vec_, rnnlm::i, rnnlm::j, KALDI_ASSERT, BottomUpClusterer::nclusters_, BottomUpClusterer::npoints_, and BottomUpClusterer::SetDistance().
Referenced by BottomUpClusterer::Cluster(), CompartmentalizedBottomUpClusterer::Cluster(), BottomUpClusterer::~BottomUpClusterer(), and CompartmentalizedBottomUpClusterer::~CompartmentalizedBottomUpClusterer().
|
private |
Reconstructs the priority queue from the distances.
Definition at line 368 of file cluster-utils.cc.
References BottomUpClusterer::clusters_, BottomUpClusterer::dist_vec_, rnnlm::i, rnnlm::j, BottomUpClusterer::max_merge_thresh_, BottomUpClusterer::npoints_, BottomUpClusterer::queue_, and kaldi::swap().
Referenced by CompartmentalizedBottomUpClusterer::MergeClusters(), BottomUpClusterer::SetDistance(), BottomUpClusterer::~BottomUpClusterer(), and CompartmentalizedBottomUpClusterer::~CompartmentalizedBottomUpClusterer().
|
private |
Definition at line 268 of file cluster-utils.cc.
References BottomUpClusterer::assignments_, BottomUpClusterer::clusters_, BottomUpClusterer::dist_vec_, rnnlm::i, KALDI_ASSERT, KALDI_VLOG, BottomUpClusterer::nclusters_, and BottomUpClusterer::npoints_.
Referenced by BottomUpClusterer::Cluster(), CompartmentalizedBottomUpClusterer::Cluster(), BottomUpClusterer::~BottomUpClusterer(), and CompartmentalizedBottomUpClusterer::~CompartmentalizedBottomUpClusterer().
Definition at line 389 of file cluster-utils.cc.
References BottomUpClusterer::clusters_, BottomUpClusterer::dist_vec_, rnnlm::i, rnnlm::j, KALDI_ASSERT, BottomUpClusterer::max_merge_thresh_, BottomUpClusterer::npoints_, BottomUpClusterer::queue_, and BottomUpClusterer::ReconstructQueue().
Referenced by BottomUpClusterer::MergeClusters(), CompartmentalizedBottomUpClusterer::MergeClusters(), CompartmentalizedBottomUpClusterer::ReconstructQueue(), CompartmentalizedBottomUpClusterer::SetInitialDistances(), BottomUpClusterer::~BottomUpClusterer(), and CompartmentalizedBottomUpClusterer::~CompartmentalizedBottomUpClusterer().
|
private |
Sets up distances and queue.
Definition at line 325 of file cluster-utils.cc.
References BottomUpClusterer::clusters_, BottomUpClusterer::dist_vec_, rnnlm::i, rnnlm::j, BottomUpClusterer::max_merge_thresh_, BottomUpClusterer::npoints_, and BottomUpClusterer::queue_.
Referenced by BottomUpClusterer::Cluster(), CompartmentalizedBottomUpClusterer::Cluster(), BottomUpClusterer::~BottomUpClusterer(), and CompartmentalizedBottomUpClusterer::~CompartmentalizedBottomUpClusterer().
|
private |
Definition at line 229 of file cluster-utils.cc.
Referenced by BottomUpClusterer::Cluster(), TreeClusterer::Cluster(), BottomUpClusterer::MergeClusters(), RefineClusterer::ProcessPoint(), RefineClusterer::Refine(), and RefineClusterer::RefineClusterer().
|
private |
Definition at line 234 of file cluster-utils.cc.
Referenced by CompartmentalizedBottomUpClusterer::Cluster(), BottomUpClusterer::InitializeAssignments(), CompartmentalizedBottomUpClusterer::InitializeAssignments(), CompartmentalizedBottomUpClusterer::MergeClusters(), RefineClusterer::MovePoint(), BottomUpClusterer::Renumber(), and CompartmentalizedBottomUpClusterer::Renumber().
|
private |
Definition at line 233 of file cluster-utils.cc.
Referenced by BottomUpClusterer::CanMerge(), CompartmentalizedBottomUpClusterer::CanMerge(), CompartmentalizedBottomUpClusterer::Cluster(), BottomUpClusterer::InitializeAssignments(), CompartmentalizedBottomUpClusterer::InitializeAssignments(), BottomUpClusterer::MergeClusters(), CompartmentalizedBottomUpClusterer::MergeClusters(), BottomUpClusterer::ReconstructQueue(), CompartmentalizedBottomUpClusterer::ReconstructQueue(), RefineClusterer::RefineClusterer(), BottomUpClusterer::Renumber(), CompartmentalizedBottomUpClusterer::Renumber(), BottomUpClusterer::SetDistance(), CompartmentalizedBottomUpClusterer::SetDistance(), BottomUpClusterer::SetInitialDistances(), and CompartmentalizedBottomUpClusterer::~CompartmentalizedBottomUpClusterer().
|
private |
Definition at line 239 of file cluster-utils.cc.
Referenced by BottomUpClusterer::BottomUpClusterer(), BottomUpClusterer::CanMerge(), CompartmentalizedBottomUpClusterer::CanMerge(), BottomUpClusterer::Distance(), BottomUpClusterer::MergeClusters(), CompartmentalizedBottomUpClusterer::MergeClusters(), BottomUpClusterer::ReconstructQueue(), BottomUpClusterer::Renumber(), BottomUpClusterer::SetDistance(), CompartmentalizedBottomUpClusterer::SetDistance(), BottomUpClusterer::SetInitialDistances(), and CompartmentalizedBottomUpClusterer::SetInitialDistances().
|
private |
Definition at line 231 of file cluster-utils.cc.
Referenced by BottomUpClusterer::ReconstructQueue(), BottomUpClusterer::SetDistance(), CompartmentalizedBottomUpClusterer::SetDistance(), and BottomUpClusterer::SetInitialDistances().
|
private |
Definition at line 232 of file cluster-utils.cc.
Referenced by BottomUpClusterer::Cluster(), and CompartmentalizedBottomUpClusterer::Cluster().
|
private |
Definition at line 240 of file cluster-utils.cc.
Referenced by BottomUpClusterer::BottomUpClusterer(), BottomUpClusterer::Cluster(), CompartmentalizedBottomUpClusterer::Cluster(), CompartmentalizedBottomUpClusterer::CompartmentalizedBottomUpClusterer(), BottomUpClusterer::MergeClusters(), CompartmentalizedBottomUpClusterer::MergeClusters(), BottomUpClusterer::Renumber(), and CompartmentalizedBottomUpClusterer::Renumber().
|
private |
Definition at line 241 of file cluster-utils.cc.
Referenced by BottomUpClusterer::BottomUpClusterer(), BottomUpClusterer::CanMerge(), CompartmentalizedBottomUpClusterer::CanMerge(), CompartmentalizedBottomUpClusterer::CompartmentalizedBottomUpClusterer(), BottomUpClusterer::Distance(), BottomUpClusterer::InitializeAssignments(), CompartmentalizedBottomUpClusterer::InitializeAssignments(), BottomUpClusterer::MergeClusters(), CompartmentalizedBottomUpClusterer::MergeClusters(), BottomUpClusterer::ReconstructQueue(), CompartmentalizedBottomUpClusterer::ReconstructQueue(), BottomUpClusterer::Renumber(), CompartmentalizedBottomUpClusterer::Renumber(), BottomUpClusterer::SetDistance(), CompartmentalizedBottomUpClusterer::SetDistance(), BottomUpClusterer::SetInitialDistances(), and CompartmentalizedBottomUpClusterer::SetInitialDistances().
|
private |
Definition at line 230 of file cluster-utils.cc.
Referenced by TreeClusterer::CreateAssignmentsOutput(), TreeClusterer::Init(), BottomUpClusterer::InitializeAssignments(), CompartmentalizedBottomUpClusterer::InitializeAssignments(), RefineClusterer::InitPoint(), RefineClusterer::MovePoint(), RefineClusterer::RefineClusterer(), and RefineClusterer::UpdateInfo().
|
private |
Definition at line 246 of file cluster-utils.cc.
Referenced by BottomUpClusterer::Cluster(), CompartmentalizedBottomUpClusterer::Cluster(), TreeClusterer::Cluster(), TreeClusterer::FindBestSplit(), CompartmentalizedBottomUpClusterer::MergeClusters(), BottomUpClusterer::ReconstructQueue(), CompartmentalizedBottomUpClusterer::ReconstructQueue(), CompartmentalizedBottomUpClusterer::Renumber(), BottomUpClusterer::SetDistance(), CompartmentalizedBottomUpClusterer::SetDistance(), and BottomUpClusterer::SetInitialDistances().
|
private |
Definition at line 237 of file cluster-utils.cc.
|
private |
Definition at line 236 of file cluster-utils.cc.
Referenced by BottomUpClusterer::~BottomUpClusterer().