matchbin_selectors.hpp
Selector structs that can be plugged into MatchBin.
-
struct CacheStateBase
- #include <matchbin_selectors.hpp>
Subclassed by RankedCacheState, RouletteCacheState, SieveCacheState
-
struct RouletteCacheState : public CacheStateBase
- #include <matchbin_selectors.hpp>
Public Functions
-
RouletteCacheState() = default
-
RouletteCacheState() = default
-
struct SieveCacheState : public CacheStateBase
- #include <matchbin_selectors.hpp>
-
struct RankedCacheState : public CacheStateBase
- #include <matchbin_selectors.hpp>
Public Functions
-
RankedCacheState() = default
-
RankedCacheState() = default
-
template<typename CacheType>
struct SelectorBase - #include <matchbin_selectors.hpp>
Abstract base class for selectors.
-
template<typename ThreshRatio = std::ratio<-1, 1>, size_t DefaultN = 1>
struct RankedSelector : public SelectorBase<RankedCacheState> - #include <matchbin_selectors.hpp>
Returns matches within the threshold ThreshRatio sorted by match quality.
Public Types
-
using cache_state_t = RankedCacheState
-
using cache_state_t = RankedCacheState
-
template<typename ThreshRatio = std::ratio<-1, 1>, typename SkewRatio = std::ratio<1, 10>, typename MaxBaselineRatio = std::ratio<1, 1>, size_t DefaultN = 1>
struct RouletteSelector : public SelectorBase<RouletteCacheState> - #include <matchbin_selectors.hpp>
Selector chooses probabilistically based on match quality with replacement. ThreshRatio: what is the raw maximum score to even be considered to match SkewRatio: how much more heavily should the best matches be weighted in terms of match probability; must be greater than 0 (close to zero: very heavily, large: mostly even weighting) MaxBaselineRatio: maximum score that all scores will be normalized to baseline = min(min_score, MaxBaselineRatio) normalized_score = score - baseline … overall, p_match ~ 1 / (skew + score - baseline)
Public Types
-
using cache_state_t = RouletteCacheState
Public Functions
-
inline virtual RouletteCacheState operator()(vector<std::pair<size_t, double>> scores, size_t n) override
-
using cache_state_t = RouletteCacheState
-
template<typename ThreshRatio = std::ratio<13, 10>, typename BRatio = std::ratio<1, 100>, typename CRatio = std::ratio<4, 1>, typename ZRatio = std::ratio<4, 1>, typename MaxBaselineRatio = std::ratio<5, 4>, size_t DefaultN = 1>
struct ExpRouletteSelector : public SelectorBase<RouletteCacheState> - #include <matchbin_selectors.hpp>
Selector chooses probabilistically based on match quality with replacement using exponentially. ThreshRatio: what is the minimum probability of matching to even be considered for a match BRatio, CRatio, ZRatio: p_match ~ b ^ (c * normalized_score) ^ z MaxBaselineRatio: maximum score that all scores will be normalized to baseline = min(min_score, MaxBaselineRatio) normalized_score = score - baseline
Public Types
-
using cache_state_t = RouletteCacheState
Public Functions
-
inline virtual RouletteCacheState operator()(vector<std::pair<size_t, double>> scores, size_t n) override
-
using cache_state_t = RouletteCacheState
-
template<typename StochasticRatio = std::ratio<1, 10>, typename LockInRatio = std::ratio<-1, 1>, size_t DefaultN = std::numeric_limits<size_t>::max()>
struct SieveSelector : public SelectorBase<SieveCacheState> - #include <matchbin_selectors.hpp>
Selector treats each element of the MatchBin independently. As match distance increases, each element passes through a regime where selection is guaranteed, a regime where selection is stochastic, and then a regime where non-selection is guaranteed.
Public Types
-
using cache_state_t = SieveCacheState
Public Functions
-
inline virtual SieveCacheState operator()(vector<std::pair<size_t, double>> scores, size_t n) override
-
using cache_state_t = SieveCacheState