libqe-stats 0.1.2
QE C++ library
Loading...
Searching...
No Matches
qestats Namespace Reference

Namespaces

namespace  rho_fast
 
namespace  rho_standard
 

Classes

struct  BootstrapResult
 
struct  CMResult
 
struct  ConfusionMatrix
 
struct  FormulaRow
 
struct  Interval
 
struct  KappaPrecision
 
struct  MetricRange
 
struct  MetricRangeRow
 
struct  Metrics
 
struct  PsResult
 
struct  RhoOptions
 
struct  StdRng
 
struct  TTestResult
 

Enumerations

enum class  RhoMethod { Standard , Fast }
 

Functions

const std::vector< std::string > & metric_names ()
 
BootstrapResult bootstrap_metrics (const ConfusionMatrix &cm, int n_sample, const std::vector< std::string > &metrics={}, int n_set=0, int n_bootstrap=1000, double conf_level=0.95)
 
TTestResult welch_t (double m1, double m2, double s1, double s2, int n1, int n2, double tol=1e-9)
 
double p_diff (const ConfusionMatrix &cm1, const ConfusionMatrix &cm2, int n_sample, const std::string &metric, int n_set=0, int n_bootstrap=1000, double alpha=0.05)
 
int n_diff (const ConfusionMatrix &cm1, const ConfusionMatrix &cm2, const std::string &metric, int n_set=0, int n_bootstrap=1000, double alpha=0.05)
 
double interval_overlap (const MetricRange &r1, const MetricRange &r2)
 
MetricRange range_est (const ConfusionMatrix &cm, const std::string &metric, int N, double alpha=0.05)
 
int N_Diff2 (const ConfusionMatrix &cm1, const ConfusionMatrix &cm2, const std::string &metric, int N, double d=0.1, double alpha=0.05)
 
double ps_est_kappa (int n, double baserate, int N=0, int allowed_errors=0, double alpha=0.05)
 
PsResult ps_kappa (double kappa0, double baserate, double kappa1=0, int N=0, int allowed_errors=0, double alpha=0.05)
 
std::vector< FormulaRow > make_formula_table ()
 
const std::vector< FormulaRow > & formula_table ()
 
std::string normalize_metric_name (const std::string &n)
 
const FormulaRow * find_formula (const std::string &v1, const std::string &v2)
 
CMResult eval_formula (const FormulaRow &row, double v1, double v2, double key)
 
MetricRange range (const std::string &name1, double val1, const std::string &name2, double val2, const std::string &target)
 
Metrics derive (const std::string &name1, double val1, const std::string &name2, double val2, const std::string &name3, double val3)
 
Metrics derive_from_rates (double b1, double fdr, double for_)
 
double phyper (int q, int K, int N_minus_K, int n)
 
Interval hyper_range (int n_pos, int n, int N, double alpha=0.05)
 
PsResult ps_proportion (double x0, double x1=0, int N=0, int allowed_errors=0, double alpha=0.05)
 
double ps_est_proportion (int n, int N=0, int allowed_errors=0, double alpha=0.05)
 
std::vector< MetricRangeRow > metrics_range (double tp, double fp, double fn, double tn, int N, double baserate, double alpha=0.05)
 
QESTATS_R_ARITHMETIC_FN double kappa_from_counts (double tp, double fp, double fn, double tn)
 
Metrics metrics_from_cm (const ConfusionMatrix &cm)
 
Metrics calculate_metrics (double tp, double fp, double fn, double tn)
 
double get_metric (const Metrics &m, const std::string &name)
 
void check_rho_args (double observed_kappa, double baserate, const RhoOptions &o)
 
template<class Rng >
std::vector< KappaPrecision > rho_kps (double baserate, const RhoOptions &opts, Rng &rng)
 
template<class Rng , std::enable_if_t< std::is_class_v< Rng >, int > = 0>
double rho (double observed_kappa, double baserate, int test_set_length, const RhoOptions &opts, Rng &rng)
 
double rho (double observed_kappa, double baserate, int test_set_length, const RhoOptions &opts={}, std::uint64_t seed=5489u)
 

Variables

constexpr int RHO_MAX_ATTEMPTS = 10000
 
const char *const RHO_NO_VALID_SET
 

Enumeration Type Documentation

◆ RhoMethod

enum class qestats::RhoMethod
strong
Enumerator
Standard 
Fast 

Function Documentation

◆ bootstrap_metrics()

BootstrapResult qestats::bootstrap_metrics ( const ConfusionMatrix &  cm,
int  n_sample,
const std::vector< std::string > &  metrics = {},
int  n_set = 0,
int  n_bootstrap = 1000,
double  conf_level = 0.95 
)
inline

◆ calculate_metrics()

Metrics qestats::calculate_metrics ( double  tp,
double  fp,
double  fn,
double  tn 
)
inline

◆ check_rho_args()

void qestats::check_rho_args ( double  observed_kappa,
double  baserate,
const RhoOptions &  o 
)
inline

◆ derive()

Metrics qestats::derive ( const std::string &  name1,
double  val1,
const std::string &  name2,
double  val2,
const std::string &  name3,
double  val3 
)
inline

◆ derive_from_rates()

Metrics qestats::derive_from_rates ( double  b1,
double  fdr,
double  for_ 
)
inline

◆ eval_formula()

CMResult qestats::eval_formula ( const FormulaRow &  row,
double  v1,
double  v2,
double  key 
)
inline

◆ find_formula()

const FormulaRow * qestats::find_formula ( const std::string &  v1,
const std::string &  v2 
)
inline

◆ formula_table()

const std::vector< FormulaRow > & qestats::formula_table ( )
inline

◆ get_metric()

double qestats::get_metric ( const Metrics &  m,
const std::string &  name 
)
inline

◆ hyper_range()

Interval qestats::hyper_range ( int  n_pos,
int  n,
int  N,
double  alpha = 0.05 
)
inline

◆ interval_overlap()

double qestats::interval_overlap ( const MetricRange &  r1,
const MetricRange &  r2 
)
inline

◆ kappa_from_counts()

QESTATS_R_ARITHMETIC_FN double qestats::kappa_from_counts ( double  tp,
double  fp,
double  fn,
double  tn 
)
inline

◆ make_formula_table()

std::vector< FormulaRow > qestats::make_formula_table ( )
inline

◆ metric_names()

const std::vector< std::string > & qestats::metric_names ( )
inline

◆ metrics_from_cm()

Metrics qestats::metrics_from_cm ( const ConfusionMatrix &  cm)
inline

◆ metrics_range()

std::vector< MetricRangeRow > qestats::metrics_range ( double  tp,
double  fp,
double  fn,
double  tn,
int  N,
double  baserate,
double  alpha = 0.05 
)
inline

◆ n_diff()

int qestats::n_diff ( const ConfusionMatrix &  cm1,
const ConfusionMatrix &  cm2,
const std::string &  metric,
int  n_set = 0,
int  n_bootstrap = 1000,
double  alpha = 0.05 
)
inline

◆ N_Diff2()

int qestats::N_Diff2 ( const ConfusionMatrix &  cm1,
const ConfusionMatrix &  cm2,
const std::string &  metric,
int  N,
double  d = 0.1,
double  alpha = 0.05 
)
inline

◆ normalize_metric_name()

std::string qestats::normalize_metric_name ( const std::string &  n)
inline

◆ p_diff()

double qestats::p_diff ( const ConfusionMatrix &  cm1,
const ConfusionMatrix &  cm2,
int  n_sample,
const std::string &  metric,
int  n_set = 0,
int  n_bootstrap = 1000,
double  alpha = 0.05 
)
inline

◆ phyper()

double qestats::phyper ( int  q,
int  K,
int  N_minus_K,
int  n 
)
inline

◆ ps_est_kappa()

double qestats::ps_est_kappa ( int  n,
double  baserate,
int  N = 0,
int  allowed_errors = 0,
double  alpha = 0.05 
)
inline

◆ ps_est_proportion()

double qestats::ps_est_proportion ( int  n,
int  N = 0,
int  allowed_errors = 0,
double  alpha = 0.05 
)
inline

◆ ps_kappa()

PsResult qestats::ps_kappa ( double  kappa0,
double  baserate,
double  kappa1 = 0,
int  N = 0,
int  allowed_errors = 0,
double  alpha = 0.05 
)
inline

◆ ps_proportion()

PsResult qestats::ps_proportion ( double  x0,
double  x1 = 0,
int  N = 0,
int  allowed_errors = 0,
double  alpha = 0.05 
)
inline

◆ range()

MetricRange qestats::range ( const std::string &  name1,
double  val1,
const std::string &  name2,
double  val2,
const std::string &  target 
)
inline

◆ range_est()

MetricRange qestats::range_est ( const ConfusionMatrix &  cm,
const std::string &  metric,
int  N,
double  alpha = 0.05 
)
inline

◆ rho() [1/2]

template<class Rng , std::enable_if_t< std::is_class_v< Rng >, int > = 0>
double qestats::rho ( double  observed_kappa,
double  baserate,
int  test_set_length,
const RhoOptions &  opts,
Rng &  rng 
)

◆ rho() [2/2]

double qestats::rho ( double  observed_kappa,
double  baserate,
int  test_set_length,
const RhoOptions &  opts = {},
std::uint64_t  seed = 5489u 
)
inline

◆ rho_kps()

template<class Rng >
std::vector< KappaPrecision > qestats::rho_kps ( double  baserate,
const RhoOptions &  opts,
Rng &  rng 
)

◆ welch_t()

TTestResult qestats::welch_t ( double  m1,
double  m2,
double  s1,
double  s2,
int  n1,
int  n2,
double  tol = 1e-9 
)
inline

Variable Documentation

◆ RHO_MAX_ATTEMPTS

constexpr int qestats::RHO_MAX_ATTEMPTS = 10000
inlineconstexpr

◆ RHO_NO_VALID_SET

const char* const qestats::RHO_NO_VALID_SET
inline
Initial value:
=
"Could not generate a valid set given ranges of kappa and precision"