Classes | Typedefs | Functions
beluga::clusterizer_detail Namespace Reference

Classes

struct  ClusterCell
 A struct that holds the data of a single cell for the clusterization algorithm. More...
 

Typedefs

template<class State >
using ClusterMap = std::unordered_map< std::size_t, ClusterCell< State > >
 A map that holds the sparse data about the particles grouped in cells. More...
 

Functions

template<class State , class NeighborsFunction >
static void assign_clusters (ClusterMap< State > &map, NeighborsFunction &&neighbors_function)
 Assign cluster ids to an existing cluster map. More...
 
template<class Range >
auto calculate_percentile_threshold (Range &&range, double percentile)
 Calculates the threshold value at a specified percentile from a range. More...
 
template<class States , class Weights , class Hashes >
static auto make_cluster_map (States &&states, Weights &&weights, Hashes &&hashes)
 Create a cluster map from a range of particles and their corresponding spatial hashes. More...
 
template<class Map , class Proj >
auto make_priority_queue (const Map &map, Proj &&proj)
 Create a priority queue from a map using a specified projection. More...
 
template<class State >
static void normalize_and_cap_weights (ClusterMap< State > &map, double percentile)
 Normalize weights and cap them to a given percentile. More...
 

Typedef Documentation

◆ ClusterMap

template<class State >
using beluga::clusterizer_detail::ClusterMap = typedef std::unordered_map<std::size_t, ClusterCell<State> >

A map that holds the sparse data about the particles grouped in cells.

Definition at line 121 of file cluster_based_estimation.hpp.

Function Documentation

◆ assign_clusters()

template<class State , class NeighborsFunction >
static void beluga::clusterizer_detail::assign_clusters ( ClusterMap< State > &  map,
NeighborsFunction &&  neighbors_function 
)
static

Assign cluster ids to an existing cluster map.

This function implements a clustering algorithm that assigns cluster IDs to cells in a map based on their spatial relationships.

Notice that with this algorithm each cell will go through the priority queue at most twice.

Template Parameters
StateThe state type of the cells in the map.
NeighborsFunctionA callable object that, given a state, returns a range of neighboring cell hashes.
Parameters
mapA reference to the map where cells are stored.
neighbors_functionA function that returns neighboring cell hashes for a given state.

Definition at line 203 of file cluster_based_estimation.hpp.

◆ calculate_percentile_threshold()

template<class Range >
auto beluga::clusterizer_detail::calculate_percentile_threshold ( Range &&  range,
double  percentile 
)

Calculates the threshold value at a specified percentile from a range.

Find the value that is greater than the given percentage of the numbers in a range.

Template Parameters
RangeThe type of the input range containing the values.
Parameters
rangeThe input range of values from which to calculate the percentile threshold.
percentileThe percentile (between 0 and 1) to calculate the threshold for.
Returns
The value at the specified percentile in the sorted range.

Definition at line 103 of file cluster_based_estimation.hpp.

◆ make_cluster_map()

template<class States , class Weights , class Hashes >
static auto beluga::clusterizer_detail::make_cluster_map ( States &&  states,
Weights &&  weights,
Hashes &&  hashes 
)
static

Create a cluster map from a range of particles and their corresponding spatial hashes.

This method will populate all the relevant fields in the map except for the cluster ID, which has to be computed with a separate call to assign_clusters.

Template Parameters
StatesThe range type for particle states.
WeightsThe range type for particle weights.
HashesThe range type for particle spatial hashes.
Parameters
statesA range of particle states.
weightsA range of particle weights.
hashesA range of particle spatial hashes.
Returns
A map where each unique hash corresponds to a cell with accumulated weight, particle count, and representative state.

Definition at line 138 of file cluster_based_estimation.hpp.

◆ make_priority_queue()

template<class Map , class Proj >
auto beluga::clusterizer_detail::make_priority_queue ( const Map &  map,
Proj &&  proj 
)

Create a priority queue from a map using a specified projection.

This function template constructs a priority queue where the elements are ordered by a priority value derived from the map's values. The elements in the queue will contain a key that belongs to the map and the corresponding priority.

Template Parameters
MapThe type of the associative container.
ProjThe type of the projection invocable.
Parameters
mapThe map containing the data to be inserted into the priority queue.
projThe projection function used to compute the priority of each element.
Returns
A priority queue where elements are ordered by the priority computed from the map's values using the projection function.

Definition at line 72 of file cluster_based_estimation.hpp.

◆ normalize_and_cap_weights()

template<class State >
static void beluga::clusterizer_detail::normalize_and_cap_weights ( ClusterMap< State > &  map,
double  percentile 
)
static

Normalize weights and cap them to a given percentile.

Given a valid cluster map, normalize the accumulated weight by the number of particles in each cell to avoid biasing the clustering algorithm towards cells that randomly end up with more particles than others.

Then cap the values to a given percentile to flatten the top of the approximated density function and make the clustering algorithm more robust to estimation noise, by fusing together any adjacent peaks whose weight is above the threshold.

Template Parameters
StateThe state type of the cells in the map.
Parameters
mapA reference to the map where cells are stored.
percentileThe percentile threshold for capping the weights.

Definition at line 174 of file cluster_based_estimation.hpp.



beluga
Author(s):
autogenerated on Tue Jul 16 2024 02:59:54