Docs
Loading...
Searching...
No Matches
ContinuosCache Class Reference

Cache for spatial model with continuous covariates. More...

#include <continuos_cache.hpp>

Inheritance diagram for ContinuosCache:
ClusterInfo

Classes

struct  ClusterStats
 Structure to hold statistics for each cluster. More...

Public Member Functions

 ContinuosCache (Eigen::VectorXi &initial_allocations, const Eigen::VectorXd &continuos_covariates)
void set_allocation (int index, int cluster, int old_cluster) override
 Assigns a point to a cluster.
ClusterStats get_cluster_stats (int cluster) const
 Get cluster statistics for a specific cluster.
const ClusterStatsget_cluster_stats_ref (int cluster) const
 Get cluster statistics reference for a specific cluster.
void recompute (const int K, const Eigen::VectorXi &allocations) override
 Recomputes all cluster information from current allocations.
void move_cluster_info (int from_cluster, int to_cluster) override
 Moves cluster information from one cluster to another.
void remove_info (int cluster) override
 Removes information related to a specific cluster.
Public Member Functions inherited from ClusterInfo
 ClusterInfo ()=default
virtual ~ClusterInfo ()=default

Public Attributes

const Eigen::VectorXd continuos_covariates

Private Attributes

std::vector< ClusterStatscluster_stats

Detailed Description

Cache for spatial model with continuous covariates.

This class maintains cluster statistics for a spatial model that includes continuous covariates.

Constructor & Destructor Documentation

◆ ContinuosCache()

ContinuosCache::ContinuosCache ( Eigen::VectorXi & initial_allocations,
const Eigen::VectorXd & continuos_covariates )
inline

Member Function Documentation

◆ get_cluster_stats()

ClusterStats ContinuosCache::get_cluster_stats ( int cluster) const
inline

Get cluster statistics for a specific cluster.

Parameters
clusterIndex of the cluster
Returns
ClusterStats struct

◆ get_cluster_stats_ref()

const ClusterStats & ContinuosCache::get_cluster_stats_ref ( int cluster) const
inline

Get cluster statistics reference for a specific cluster.

Parameters
clusterIndex of the cluster
Returns
Const reference to ClusterStats struct

◆ move_cluster_info()

void ContinuosCache::move_cluster_info ( int from_cluster,
int to_cluster )
inlineoverridevirtual

Moves cluster information from one cluster to another.

Parameters
from_clusterIndex of the source cluster
to_clusterIndex of the target cluster

Implements ClusterInfo.

◆ recompute()

void ContinuosCache::recompute ( const int K,
const Eigen::VectorXi & allocations )
overridevirtual

Recomputes all cluster information from current allocations.

Parameters
KCurrent number of clusters
allocationsCurrent allocations vector

Implements ClusterInfo.

◆ remove_info()

void ContinuosCache::remove_info ( int cluster)
overridevirtual

Removes information related to a specific cluster.

Parameters
clusterIndex of the cluster to remove

Implements ClusterInfo.

◆ set_allocation()

void ContinuosCache::set_allocation ( int index,
int cluster,
int old_cluster )
overridevirtual

Assigns a point to a cluster.

Parameters
indexIndex of the point to reassign
clusterTarget cluster index (K for new cluster, -1 for unallocated)
old_clusterPrevious cluster index of the point
Exceptions
std::out_of_rangeif index or cluster is invalid

Implements ClusterInfo.

Member Data Documentation

◆ cluster_stats

std::vector<ClusterStats> ContinuosCache::cluster_stats
private

◆ continuos_covariates

const Eigen::VectorXd ContinuosCache::continuos_covariates

The documentation for this class was generated from the following files: