Data container with integrated cluster information management.
More...
#include <Datax.hpp>
|
| | Datax (const Params &p, std::vector< std::shared_ptr< ClusterInfo > > ci, const Eigen::VectorXi &initial_allocations=Eigen::VectorXi()) |
| void | set_allocation (int index, int cluster) override |
| | Assigns a point to a cluster.
|
| void | set_allocations (const Eigen::VectorXi &new_allocations) override |
| | Sets all cluster allocations at once.
|
| void | restore_state (Eigen::VectorXi &old_allocations, std::unordered_map< int, std::vector< int > > &old_cluster_members, int old_K) override |
| | Restores allocations, cluster memberships, and cluster count from a saved state.
|
| virtual | ~Datax ()=default |
| | Data (const Params &p, const Eigen::VectorXi &initial_allocations=Eigen::VectorXi()) |
| | Constructs a Data object with a distance matrix.
|
| virtual | ~Data ()=default |
| double | get_distance (int i, int j) const |
| | Getters.
|
| int | get_n () const |
| | Gets the total number of points.
|
| int | get_K () const |
| | Gets the current number of clusters.
|
| const Eigen::VectorXi & | get_allocations () const |
| | Gets the cluster allocations vector.
|
| int | get_cluster_size (unsigned cluster_index) const |
| | Gets the size of a specific cluster.
|
| int | get_cluster_assignment (int index) const |
| | Gets the cluster assignment of a specific point.
|
| Eigen::VectorXi | get_cluster_assignments (int cluster) const |
| | Gets all point indices assigned to a specific cluster.
|
| Eigen::Map< const Eigen::VectorXi > | get_cluster_assignments_ref (int cluster) const |
| | Gets all point indices assigned to a specific cluster (map form).
|
| std::unordered_map< int, std::vector< int > > | get_cluster_map_copy () const |
| | Gets the full mapping of clusters to their member points.
|
| const std::unordered_map< int, std::vector< int > > & | get_cluster_map () const |
| | Gets the full mapping of clusters to their member points.
|
|
| std::vector< std::shared_ptr< ClusterInfo > > | cluster_info |
| const Params & | params |
| | Reference to model parameters.
|
| Eigen::VectorXi | allocations |
| | Cluster allocation for each point.
|
| int | K |
| | Current number of clusters.
|
| std::unordered_map< int, std::vector< int > > | cluster_members |
| | Maps cluster indices to vectors of point indices in that cluster.
|
Data container with integrated cluster information management.
This class extends the base Data class to include a vector of ClusterInfo objects that can provide additional cluster-related computations or caching. It maintains synchronization between data allocations and cluster information.
◆ Datax()
| Datax::Datax |
( |
const Params & | p, |
|
|
std::vector< std::shared_ptr< ClusterInfo > > | ci, |
|
|
const Eigen::VectorXi & | initial_allocations = Eigen::VectorXi() ) |
|
inline |
◆ ~Datax()
| virtual Datax::~Datax |
( |
| ) |
|
|
virtualdefault |
◆ compact_cluster()
| void Datax::compact_cluster |
( |
int | old_cluster | ) |
|
|
protected |
◆ restore_state()
| void Datax::restore_state |
( |
Eigen::VectorXi & | old_allocations, |
|
|
std::unordered_map< int, std::vector< int > > & | old_cluster_members, |
|
|
int | old_K ) |
|
overridevirtual |
Restores allocations, cluster memberships, and cluster count from a saved state.
- Parameters
-
| old_allocations | Vector holding the saved allocations (swapped into place) |
| old_cluster_members | Map of saved cluster memberships (swapped into place) |
| old_K | Number of clusters in the saved state |
Reimplemented from Data.
◆ set_allocation()
| void Datax::set_allocation |
( |
int | index, |
|
|
int | cluster ) |
|
overridevirtual |
Assigns a point to a cluster.
- Parameters
-
| index | Index of the point to reassign |
| cluster | Target cluster index (K for new cluster, -1 for unallocated) |
- Exceptions
-
| std::out_of_range | if index or cluster is invalid |
Reimplemented from Data.
◆ set_allocations()
| void Datax::set_allocations |
( |
const Eigen::VectorXi & | new_allocations | ) |
|
|
overridevirtual |
Sets all cluster allocations at once.
- Parameters
-
| new_allocations | Vector of cluster assignments for all points |
- Exceptions
-
| std::invalid_argument | if vector size doesn't match number of points |
Reimplemented from Data.
◆ cluster_info
| std::vector<std::shared_ptr<ClusterInfo> > Datax::cluster_info |
|
protected |
The documentation for this class was generated from the following files: