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... | |
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.
|
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.
State | The state type of the cells in the map. |
NeighborsFunction | A callable object that, given a state, returns a range of neighboring cell hashes. |
map | A reference to the map where cells are stored. |
neighbors_function | A function that returns neighboring cell hashes for a given state. |
Definition at line 203 of file cluster_based_estimation.hpp.
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.
Range | The type of the input range containing the values. |
range | The input range of values from which to calculate the percentile threshold. |
percentile | The percentile (between 0 and 1) to calculate the threshold for. |
Definition at line 103 of file cluster_based_estimation.hpp.
|
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
.
States | The range type for particle states. |
Weights | The range type for particle weights. |
Hashes | The range type for particle spatial hashes. |
states | A range of particle states. |
weights | A range of particle weights. |
hashes | A range of particle spatial hashes. |
Definition at line 138 of file cluster_based_estimation.hpp.
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.
Map | The type of the associative container. |
Proj | The type of the projection invocable. |
map | The map containing the data to be inserted into the priority queue. |
proj | The projection function used to compute the priority of each element. |
Definition at line 72 of file cluster_based_estimation.hpp.
|
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.
State | The state type of the cells in the map. |
map | A reference to the map where cells are stored. |
percentile | The percentile threshold for capping the weights. |
Definition at line 174 of file cluster_based_estimation.hpp.