Docs
Toggle main menu visibility
Loading...
Searching...
No Matches
spatial_module_cache.hpp
Go to the documentation of this file.
1
5
6
#pragma once
7
8
#include "
../../utils/Data.hpp
"
9
#include "
../../utils/Module.hpp
"
10
#include "
../caches/spatial_cache.hpp
"
11
23
class
SpatialModuleCache
:
public
Module
{
24
protected
:
25
const
Data
&
data_module
;
26
const
double
spatial_weight
= 1.0;
27
28
SpatialCache
&
cache
;
29
30
public
:
44
SpatialModuleCache
(
const
Data
&data_,
SpatialCache
&spatial_cache_,
double
spatial_coeff,
45
const
Eigen::VectorXi *old_alloc_provider =
nullptr
,
46
const
std::unordered_map<
int
, std::vector<int>> *old_cluster_members_provider_ =
nullptr
)
47
:
data_module
(data_),
cache
(spatial_cache_),
spatial_weight
(spatial_coeff),
48
Module
(old_alloc_provider, old_cluster_members_provider_) {
49
cache
.set_allocation_ptr(&
data_module
.get_allocations());
50
}
51
56
66
Eigen::VectorXd
compute_similarity_obs
(
int
obs_idx)
const override
;
67
81
double
compute_similarity_cls
(
int
cls_idx,
bool
old_allo =
false
)
const override
;
82
94
double
compute_similarity_obs
(
int
obs_idx,
int
cls_idx)
const override
;
96
};
Data.hpp
Data structure for managing point distances and cluster allocations.
Module.hpp
Base class for modules used in processes.
Data
Manages distance matrices and cluster allocations for points.
Definition
Data.hpp:26
Module::Module
Module(const Eigen::VectorXi *old_allocations_provider_=nullptr, const std::unordered_map< int, std::vector< int > > *old_cluster_members_provider_=nullptr)
Definition
Module.hpp:33
SpatialCache
Cache for spatial model with spatial covariates.
Definition
spatial_cache.hpp:18
SpatialModuleCache::compute_similarity_cls
double compute_similarity_cls(int cls_idx, bool old_allo=false) const override
Counts internal edges within a cluster.
Definition
spatial_module_cache.cpp:23
SpatialModuleCache::spatial_weight
const double spatial_weight
Weighting factor for spatial similarity.
Definition
spatial_module_cache.hpp:26
SpatialModuleCache::SpatialModuleCache
SpatialModuleCache(const Data &data_, SpatialCache &spatial_cache_, double spatial_coeff, const Eigen::VectorXi *old_alloc_provider=nullptr, const std::unordered_map< int, std::vector< int > > *old_cluster_members_provider_=nullptr)
Constructs a SpatialModuleCache with parameter and data references.
Definition
spatial_module_cache.hpp:44
SpatialModuleCache::data_module
const Data & data_module
Reference to data object with cluster assignments.
Definition
spatial_module_cache.hpp:25
SpatialModuleCache::compute_similarity_obs
Eigen::VectorXd compute_similarity_obs(int obs_idx) const override
Counts neighbors of an observation grouped by cluster membership.
Definition
spatial_module_cache.cpp:49
SpatialModuleCache::cache
SpatialCache & cache
Spatial cache for additional optimizations.
Definition
spatial_module_cache.hpp:28
spatial_cache.hpp
Cache for spatial model with spatial covariates.
BNPClust
processes
module
spatial_module_cache.hpp
Generated by
1.17.0