Math functions and classes.
More...
|
class | BasicStatistics< RealT > |
| Calculates some basic statistical parameters of a distribution: sum, mean, variance, and provides the normal approximation. More...
|
|
class | GammaDistributionFitter |
| Implements a fitter for the Gamma distribution. More...
|
|
class | GaussFitter |
| Implements a fitter for Gaussian functions. More...
|
|
class | GumbelMaxLikelihoodFitter |
| Implements a fitter for the Gumbel distribution. More...
|
|
class | Histogram< ValueType, BinSizeType > |
| Representation of a histogram. More...
|
|
class | PosteriorErrorProbabilityModel |
| Implements a mixture model of the inverse gumbel and the gauss distribution or a gaussian mixture. More...
|
|
class | CrossValidation |
| Lightweight K-fold / LOO cross-validation utilities and 1-D grid search. More...
|
|
class | BilinearInterpolation< Key, Value > |
| Provides access to bilinearly interpolated values (and derivatives) from discrete data points. Values beyond the given range of data points are implicitly taken as zero. More...
|
|
class | LinearInterpolation< Key, Value > |
| Provides access to linearly interpolated values (and derivatives) from discrete data points. Values beyond the given range of data points are implicitly taken as zero. More...
|
|
class | LinearRegression |
| This class offers functions to perform least-squares fits to a straight line model, \( Y(c,x) = c_0 + c_1 x \). More...
|
|
class | LinearRegressionWithoutIntercept |
| This class offers functions to perform least-squares fits to a straight line model, \( Y(c,x) = c_0 + c_1 x \). More...
|
|
class | ROCCurve |
| ROCCurves show the trade-off in sensitivity and specificity for binary classifiers using different cutoff values. More...
|
|
|
static std::vector< std::vector< Size > > | makeKFolds (Size n, Size K) |
| Build K folds for indices [0, n). More...
|
|
template<typename CandIter , typename TrainEval , typename ScoreFn > |
static std::pair< typename std::iterator_traits< CandIter >::value_type, double > | gridSearch1D (CandIter cbegin, CandIter cend, const std::vector< std::vector< Size >> &folds, TrainEval train_eval, ScoreFn score, double tie_tol=1e-12, CandidateTieBreak tie_break=CandidateTieBreak::PreferLarger) |
| One-dimensional grid search with external cross-validation evaluation. More...
|
|
Math functions and classes.
◆ CandidateTieBreak
Tie-breaking preference for equal (within tolerance) CV scores.
- PreferLarger : choose the larger candidate value on ties
- PreferSmaller : choose the smaller candidate value on ties
- PreferAny : keep the first encountered (stable, no size preference)
Enumerator |
---|
PreferLarger | |
PreferSmaller | |
PreferAny | |
◆ gridSearch1D()
static std::pair<typename std::iterator_traits<CandIter>::value_type, double> gridSearch1D |
( |
CandIter |
cbegin, |
|
|
CandIter |
cend, |
|
|
const std::vector< std::vector< Size >> & |
folds, |
|
|
TrainEval |
train_eval, |
|
|
ScoreFn |
score, |
|
|
double |
tie_tol = 1e-12 , |
|
|
CandidateTieBreak |
tie_break = CandidateTieBreak::PreferLarger |
|
) |
| |
|
inlinestatic |
One-dimensional grid search with external cross-validation evaluation.
Iterates candidates [cbegin
, cend
), calls train_eval(candidate, folds, abs_errs)
to append absolute errors from all validation points, then scores them via score(abs_errs)
(lower is better). Returns the best (candidate, score).
Tie-breaking:
- If |score - best_score| <=
tie_tol
, choose by prefer_larger
(true → larger wins).
- Template Parameters
-
CandIter | Random-access or forward iterator over candidate values |
TrainEval | Callable of signature void(const Cand&, const std::vector<std::vector<Size>>&, std::vector<double>&) |
ScoreFn | Callable of signature double(const std::vector<double>&) |
- Parameters
-
cbegin | Begin iterator of candidate grid |
cend | End iterator of candidate grid |
folds | Fold index sets (e.g., from makeKFolds) |
train_eval | Callback: fit on train folds and append |error| for all held-out points |
score | Callback: convert accumulated errors to a scalar loss (lower is better) |
tie_tol | Absolute tolerance for tie detection (default: 1e-12) |
tie_break | Preference for ties (default: PreferLarger) |
- Returns
- (best_candidate, best_score)
- Exceptions
-
References CrossValidation::PreferAny, CrossValidation::PreferLarger, and CrossValidation::PreferSmaller.
◆ makeKFolds()
static std::vector<std::vector<Size> > makeKFolds |
( |
Size |
n, |
|
|
Size |
K |
|
) |
| |
|
inlinestatic |
Build K
folds for indices [0, n).
Deterministic round-robin assignment: fold(i) = i % K. For leave-one-out (LOO), use K = n.
- Parameters
-
n | Number of samples |
K | Requested number of folds (clamped to [1, n]) |
- Exceptions
-