Feature Selection Toolbox FST4
UTIA · Czech Academy of Sciences
Loading...
Searching...
No Matches
fst4_cli Namespace Reference

Internals of the fst4 command-line tool: its type aliases, the option record, the run pipeline with its result types, the CLI-specific observers and adapters, and the output emitters. More...

Classes

class  Criterion_Counting
class  NullBuf
 swallows all output (used with --verbosity silent) More...
class  Stdin_Data_File
class  Observer_JSON
 --progress json: emits one JSON line per improved solution to the progress stream; free-text progress is dropped More...
class  Observer_Curve
struct  Config
 All fst4 CLI settings in one place: one field per command-line flag (plus a few derived/internal fields such as data_resolved), populated by CLI11 in add_options() and consumed by the factory functions and run_pipeline() below. Unless noted, string fields default to "" (flag omitted / feature off); concrete defaults live in the Config() constructor below. More...
struct  Pipeline
 everything the run phase needs, assembled by the factories below More...
struct  RunResult
struct  CompareResult
 everything produced by a --compare-config second scenario (the demo55 protocol) More...
struct  Svg_Panel

Typedefs

typedef double RETURNTYPE
 criterion/classifier/regressor return value type used throughout the CLI
typedef double DATATYPE
 raw sample value type read from the data file
typedef double REALTYPE
 intermediate real-valued computation type (always real, never integral)
typedef unsigned int IDXTYPE
 sample (row) index type
typedef unsigned int DIMTYPE
 feature (dimension) index type
typedef short BINTYPE
 per-feature membership flag type backing SUBSET
typedef FST::Subset< BINTYPE, DIMTYPE > SUBSET
 the concrete feature-subset type instantiated across the whole CLI
typedef FST::Data_Intervaller< std::vector< FST::Data_Interval< IDXTYPE > >, IDXTYPE > INTERVALLER
 concrete split-interval representation shared by every splitter
typedef std::shared_ptr< FST::Data_Splitter< INTERVALLER, IDXTYPE > > PSPLITTER
 shared pointer to the abstract Data_Splitter base, holding whichever concrete splitter --splitter/--splitter2 selects at runtime
typedef FST::Data_Accessor< DATATYPE, IDXTYPE > DATAACCESSOR
 abstract data-access seam: the base every format accessor (and the --features data-free universe accessor) implements
typedef FST::Criterion< RETURNTYPE, SUBSET > CRITERION
 abstract criterion seam: the base every --criterion implementation and internal adapter implements
typedef FST::Classifier< RETURNTYPE, DIMTYPE, SUBSET, DATAACCESSOR > CLASSIFIER
 abstract classifier seam: the base every --validate classifier and wrapper-* criterion's inner classifier implements
typedef FST::Sequential_Step< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > EVALUATOR
 abstract sequential-step seam: the base every --evaluator implementation implements
typedef FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > SEARCH
 abstract search seam: the base every --search algorithm implements
typedef FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALLER > ACCESSOR_MEM
 shared concrete-side base: initialize(), setSplittingDepth()
typedef FST::Data_Accessor_Splitting_MemTRN< DATATYPE, IDXTYPE, INTERVALLER > ACCESSOR_TRN
 TRN-format data accessor (--format trn).
typedef FST::Data_Accessor_Splitting_MemARFF< DATATYPE, IDXTYPE, INTERVALLER > ACCESSOR_ARFF
 ARFF-format (Weka) data accessor (--format arff).
typedef FST::Data_Accessor_Splitting_MemCSV< DATATYPE, IDXTYPE, INTERVALLER > ACCESSOR_CSV
 CSV/TSV-format data accessor (--format csv).
typedef FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALLER > ACCESSOR_UNIVERSE
 --features N: data-free set-function entry
typedef FST::Data_Splitter_5050< INTERVALLER, IDXTYPE > SPLITTER5050
 1st half train, 2nd half test, deterministic (--splitter/--splitter2 5050, the default)
typedef FST::Data_Splitter_CV< INTERVALLER, IDXTYPE > SPLITTERCV
 k-fold cross-validation splitter (--splitter/--splitter2 cv; --cv-folds/--splitter2-cv-folds)
typedef FST::Data_Splitter_Holdout< INTERVALLER, IDXTYPE > SPLITTERHOLDOUT
 percentage holdout splitter: first x% train, rest test (--splitter/--splitter2 holdout; --holdout-train/--splitter2-holdout-train)
typedef FST::Data_Splitter_Resub< INTERVALLER, IDXTYPE > SPLITTERRESUB
 resubstitution splitter: train = test = all data (--splitter/--splitter2 resub)
typedef FST::Data_Splitter_RandomRandom< INTERVALLER, IDXTYPE, BINTYPE > SPLITTERRR
 randrand splitter: independent random train/test percentages each split, disjoint, multi-split capable (--splitter/--splitter2 randrand)
typedef FST::Data_Splitter_TrainRandom_TestFixed< INTERVALLER, IDXTYPE, BINTYPE > SPLITTERRANDFIX
 randfix splitter: like randrand but with a fixed test part reused across splits (--splitter/--splitter2 randfix)
typedef FST::Data_Splitter_Leave1Out< INTERVALLER, IDXTYPE > SPLITTERL1O
 leave-one-out splitter, intended as the inner --splitter2 (--splitter/--splitter2 leave1out)
typedef FST::Criterion_Normal_Bhattacharyya< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > CRIT_BHAT
 bhattacharyya: normal-model filter, monotonic (B&B-compatible), two-class data only
typedef FST::Criterion_Normal_Divergence< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > CRIT_DIV
 divergence: normal-model filter, monotonic in theory but numerically unstable – prefer bhattacharyya; two-class only
typedef FST::Criterion_Normal_GMahalanobis< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > CRIT_GMAHA
 gmahalanobis: normal-model filter (generalized Mahalanobis distance), monotonic, two-class only
typedef FST::Distance_Euclid< DATATYPE, DIMTYPE, SUBSET > DIST_L2
 Euclidean (L2) distance, the kNN default (--knn-distance L2).
typedef FST::Distance_L1< DATATYPE, DIMTYPE, SUBSET > DIST_L1
 L1 (Manhattan) distance (--knn-distance L1).
typedef FST::Distance_Lp< DATATYPE, REALTYPE, DIMTYPE, SUBSET, 3, 2 > DIST_LP
 p=3/2, as used by demo40-43 (compile-time menu, see file header) (--knn-distance Lp)
typedef FST::Classifier_kNN< RETURNTYPE, DATATYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR, DIST_L2 > KNN_L2
 kNN classifier/wrapper-knn criterion using the L2 distance (--knn-distance L2, default)
typedef FST::Classifier_kNN< RETURNTYPE, DATATYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR, DIST_L1 > KNN_L1
 kNN classifier/wrapper-knn criterion using the L1 distance (--knn-distance L1)
typedef FST::Classifier_kNN< RETURNTYPE, DATATYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR, DIST_LP > KNN_LP
 kNN classifier/wrapper-knn criterion using the Lp distance (--knn-distance Lp)
typedef FST::Classifier_Normal_Bayes< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > BAYES
 normal Bayes classifier (wrapper-bayes)
typedef FST::Classifier_Multinomial_NaiveBayes< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > MULTINOM_NB
 multinomial naive-Bayes classifier, count/text data (wrapper-multinom)
typedef FST::Classifier_Logistic_Regression< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > LOGREG
 multinomial logistic regression classifier: deterministic damped-Newton training on internally standardized data (wrapper-logreg)
typedef FST::Classifier_Random_Forest< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > RF
 dependency-free Random Forest classifier: CART/Gini trees, bagging, sqrt-mtry node subsampling (wrapper-rf)
typedef FST::Classifier_Linear_SVM< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > LINSVM
 dependency-free linear SVM classifier: L2-regularized dual coordinate descent, no LibSVM needed (wrapper-linsvm)
typedef FST::Classifier_RBF_SVM< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > RBFSVM
 dependency-free RBF-kernel SVM classifier: kernel dual coordinate descent, no LibSVM needed (wrapper-rbfsvm)
typedef FST::Classifier_LDA< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > LDA
 shared-covariance linear discriminant classifier, parameterless and deterministic (wrapper-lda)
typedef FST::Classifier_Extern< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > EXTERN
 external-classifier bridge over a persistent-process line protocol (wrapper-extern; --extern-cmd)
typedef FST::Criterion_Extern_Value< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > CRIT_EXTVAL
 the external VALUE-mode criterion: the external tool returns the criterion value itself (extern-value; --extern-cmd)
typedef FST::Criterion_Multinomial_Bhattacharyya< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > CRIT_MBHAT
 multinom-bhattacharyya: multinomial-model filter, monotonic, count/text data
typedef FST::Criterion_Multinomial_MI< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > CRIT_MMI
 multinom-mi: multinomial individual mutual-information ranking criterion; subset value = sum of per-feature MI (monotonic, NOT a joint measure; intended for --search bif)
typedef FST::Classifier_LIBSVM< RETURNTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > SVM
 LibSVM-backed classifier (wrapper-svm; requires LibSVM, fetched separately per libsvm/readme.txt – only built when FST_SVM is defined).
typedef FST::Criterion_Wrapper< RETURNTYPE, SUBSET, CLASSIFIER, DATAACCESSOR > CRIT_WRAPPER
 the generic wrapper criterion: estimates a CLASSIFIER's accuracy/metric as the criterion value (instantiates every classification wrapper-* criterion)
typedef FST::Regressor< RETURNTYPE, DIMTYPE, SUBSET, DATAACCESSOR > REGRESSOR
 abstract regressor seam, separate from CLASSIFIER: the base wrapper-regressor/wrapper-ridge implement
typedef FST::Regressor_Weighted_Neighbours< RETURNTYPE, DATATYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR, DIST_L2 > RWN
 weighted-neighbours kNN regressor; dependent variable = the class label, "regression simulating classification" (wrapper-regressor, demo11reg protocol)
typedef FST::Regressor_Ridge< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > RIDGE
 closed-form ridge regressor: Cholesky-solved L2-regularized least squares (wrapper-ridge)
typedef FST::Criterion_Wrapper< RETURNTYPE, SUBSET, REGRESSOR, DATAACCESSOR > CRIT_WRAPPER_REG
 the generic wrapper criterion instantiated over REGRESSOR: estimates a regressor's metric as the criterion value (wrapper-regressor/wrapper-ridge)
typedef FST::Sequential_Step_Straight< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > EVAL_SEQ
 the default (straight) sequential step: plain in-line candidate evaluation (--evaluator straight)
typedef FST::Sequential_Step_Hybrid< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, CRITERION > EVAL_HYBRID
 the hybrid sequential step: --hybrid-prefilter pre-orders candidates, only the top --hybrid-keep-perc% reach the main criterion (--evaluator hybrid, demo53); prefilter bound to the abstract base too
typedef FST::Sequential_Step_Ensemble< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > EVAL_ENSEMBLE
 the ensemble sequential step: kNN wrappers at the --ensemble-knn-ks values vote on candidate ranking (--evaluator ensemble, demo50)
typedef FST::Result_Weighter_Sampled< RETURNTYPE, IDXTYPE, DIMTYPE, SUBSET > WEIGHTER_SAMPLED
 online per-feature statistics engine feeding the sampled (budgeted stochastic) sequential step
typedef FST::Sequential_Step_Sampled< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, WEIGHTER_SAMPLED > EVAL_SAMPLED
 the sampled sequential step: budgeted stochastic candidate proposals driven by WEIGHTER_SAMPLED's online per-feature statistics (--evaluator sampled, EXPERIMENTAL)
typedef FST::Criterion_Wrapper_Bias_Estimate< RETURNTYPE, SUBSET, CLASSIFIER, DATAACCESSOR > CRIT_BIAS
 the bias-estimate wrapper criterion decorator: estimates the wrapped classifier's train-vs-test optimism on the selected subset (--bias-estimate, demo56)
typedef FST::Candidate_Evaluator< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > ENGINE
 the candidate-evaluation engine seam (in-line sequential or thread-pooled), injected into searches and step evaluators
typedef std::shared_ptr< ENGINE > PENGINE
 shared pointer to ENGINE
typedef FST::Branch_And_Bound_Predictor_Averaging< RETURNTYPE, DIMTYPE > BBPREDICTOR
 averaging predictor used by the FBB/BBPP Branch & Bound variants (bb-fast/bb-bbpp) to decide predict-vs-compute per candidate
typedef FST::Result_Tracker_Dupless< RETURNTYPE, IDXTYPE, DIMTYPE, SUBSET > TRACKER
 the default (dupless) result tracker: best-k distinct subsets, feeds the top_k output block (--tracker dupless)
typedef FST::Result_Tracker_Regularizer< RETURNTYPE, IDXTYPE, DIMTYPE, SUBSET, CRITERION > TRACKER_REG
 the regularizer result tracker: records candidates for the --regularize-by/--regularize-margins post-search sweep (--tracker regularizer)
typedef FST::Result_Tracker_Stability_Evaluator< RETURNTYPE, IDXTYPE, DIMTYPE, SUBSET > TRACKER_STABIL
 the stability-evaluator result tracker: per-trial stability statistics, requires --repeat-over-splits (--tracker stabileval)
typedef FST::Result_Tracker_Feature_Stats< RETURNTYPE, IDXTYPE, DIMTYPE, SUBSET > TRACKER_STATS
 the feature-stats result tracker: probe statistics behind --daf-rank/--daf-pairs (--tracker feature-stats)
typedef FST::Criterion_Subset_Size< RETURNTYPE, SUBSET > CRIT_SUBSIZE
 adapter criterion returning the evaluated subset's size; wrapped in CRIT_NEG to build the --regularize-by subsetsize secondary criterion (maximizing -size prefers smaller subsets)
typedef FST::Criterion_Sum_Of_Weights< RETURNTYPE, DIMTYPE, SUBSET > CRIT_SUMW
 adapter criterion returning the sum of the selected features' --feature-costs; wrapped in CRIT_NEG to build the --regularize-by weights secondary criterion (maximizing -cost prefers cheaper subsets)
typedef FST::Criterion_Negative< CRITERION, RETURNTYPE, SUBSET > CRIT_NEG
 decorator criterion returning the negative of an inner criterion's value; used to turn CRIT_SUBSIZE/CRIT_SUMW's minimization goals into the maximization the regularizer sweep expects

Functions

static std::shared_ptr< FST::Search_Observer< RETURNTYPE, SUBSET > > make_observer (const Config &cfg, std::ostream &progress)
 builds the --progress observer; empty pointer = default text delivery (the library's own progress text)
static std::vector< std::string > split_csv (const std::string &s)
 splits a comma-separated flag value into tokens; empty fields are kept and an empty input yields one empty token
static std::vector< double > split_csv_doubles (const std::string &s, const std::string &flag)
 splits a comma-separated flag value into doubles, reporting the offending flag on parse failure
static FST::Metric_Spec< RETURNTYPE > make_metric_spec (const Config &cfg, const DIMTYPE classes)
static std::vector< DIMTYPE > subset_features (const std::shared_ptr< SUBSET > &sub)
static std::string fmt_double (const double v)
static std::string json_escape (const std::string &s)
static std::string infer_format (const std::string &path)
static std::shared_ptr< FST::Data_Scaler< DATATYPE > > make_scaler (const Config &cfg)
static PSPLITTER make_splitter_named (const std::string &name, const bool inner, const Config &cfg)
 constructs the splitter for one splitting depth; inner=true selects the --splitter2-* parameter set
static std::shared_ptr< ACCESSOR_MEM > make_accessor (const Config &cfg, const std::string &format)
static std::shared_ptr< CLASSIFIER > make_knn (const Config &cfg, const unsigned int k)
static std::shared_ptr< CRITERION > make_filter (const std::string &name, const std::shared_ptr< DATAACCESSOR > &da)
 constructs an initialize()d filter criterion by name (hybrid-evaluator prefilter)
static std::shared_ptr< CLASSIFIER > make_classifier (const std::string &name, const Config &cfg, const std::shared_ptr< DATAACCESSOR > &da, Pipeline *pipe=0)
template<class CRIT_T>
static std::shared_ptr< CRITERION > setup_filter_criterion (const std::shared_ptr< DATAACCESSOR > &da, std::function< bool(RETURNTYPE &, const std::shared_ptr< SUBSET > &)> &split_eval, std::function< void()> &crit_reinit)
static std::shared_ptr< CRITERION > make_criterion (const Config &cfg, Pipeline &p)
static PENGINE make_engine (const Config &cfg, Pipeline &p)
static std::shared_ptr< EVALUATOR > make_evaluator (const Config &cfg, Pipeline &p, const int eval_depth)
static void make_tracker (const Config &cfg, Pipeline &p)
static bool extract_curves (std::vector< std::pair< RETURNTYPE, DIMTYPE > > &sc, std::vector< RunResult::CurvePoint > &roc, std::vector< RunResult::CurvePoint > &pr)
static void extract_classifier_curves (const std::shared_ptr< CLASSIFIER > &vc, const std::shared_ptr< DATAACCESSOR > &da, std::vector< RunResult::ClassCurve > &curves)
static void write_scores_dump (const std::string &path, const std::shared_ptr< CLASSIFIER > &vc, const std::shared_ptr< DATAACCESSOR > &da, const std::string &label, const std::vector< DIMTYPE > &features)
static std::vector< RunResult::ValidationEntry > run_validation (const Config &cfg, Pipeline &p, const std::shared_ptr< SUBSET > &sub, RunResult *detail=nullptr, const bool is_final=false)
static std::shared_ptr< SEARCH > make_search (const Config &cfg, Pipeline &p, const std::shared_ptr< EVALUATOR > &eval)
static std::string list_constant_features (const std::shared_ptr< DATAACCESSOR > &da)
static FST::OutputDetail parse_verbosity (const std::string &v)
static void emit_invocation_json (std::ostream &os, const Config &cfg, const std::string &format)
template<typename T>
static void emit_array (std::ostream &os, const std::vector< T > &v)
static void emit_double_array (std::ostream &os, const std::vector< RETURNTYPE > &v)
 writes a JSON array of v's elements, each formatted through fmt_double()
static void emit_validation_json (std::ostream &os, const RunResult::ValidationEntry &e)
static void emit_json (std::ostream &os, const Config &cfg, const std::string &format, const Pipeline &p, const RunResult &r, const CompareResult *cmp=nullptr)
 Writes the complete --output json result: version, invocation echo, data summary, and every RunResult block that applies (validation, curve_over_d, curves, tuned parameters, trials, stability, top_k, regularization, DAF blocks, multiplier sweep, --compare-config, and the wall-time/evaluations stats block unless --stable-output). Called with the real, un-redirected stdout stream – with --output json this is the ONLY thing fst4 writes to stdout; all search/library prose goes to stderr (or is swallowed under --verbosity silent).
static void emit_csv (std::ostream &os, const Config &cfg, const RunResult &r, const CompareResult *cmp=nullptr)
 Writes the complete --output csv result: one long-format table, header "kind,rank,value,size,features", one row kind per RunResult block (result, top_k, per_split, validation, curve_over_d[validation], roc, pr, confusion, tuned, bias, classified, trial, stability, regularization[_validation], daf, daf_pair, daf_validation, multiplier_sweep[_validation], best_multiplier, and the b* / similarity rows under --compare-config), plus a trailing stats row unless --stable-output. Same real-stdout contract as emit_json(): with --output csv this is the only stdout content.
static void emit_text (std::ostream &os, const Config &cfg, const std::string &format, const Pipeline &p, const RunResult &r, const CompareResult *cmp=nullptr)
static std::string svg_num (double v)
 fixed-precision coordinate formatter — keeps the SVG byte-stable across runs
static std::string svg_tick (const double v)
 short axis-tick formatter (4 significant digits is plenty for a tick label)
static std::string svg_escape (const std::string &s)
 XML-escapes text destined for an SVG <text> element (classifier names come from --validate).
static bool write_curves_svg (const std::string &path, const RunResult &r)
static void print_components (std::ostream &os)
 --list: the component registry with one-line descriptions and validity notes
static void add_options (CLI::App &app, Config &cfg)
 Registers every fst4 CLI option/flag on app, binding each directly into a field of cfg (CLI11's add_option()/add_flag() write straight into the referenced variable on parse). Factored out of main() so that --compare-config can parse a second Config through an identical option set (the demo55 cross-scenario similarity protocol) – see parse_compare_config(). The third argument of each add_option()/add_flag() call is that option's authoritative help text (also what --help prints), so option semantics are best read there rather than duplicated in comments here.
static Config parse_compare_config (const std::string &path)

Variables

static const char * SVG_SERIES_COLORS [6] ={"#1f77b4","#d62728","#2ca02c","#9467bd","#ff7f0e","#8c564b"}
 fixed palette cycled (by index % 6) across the per-class ROC/PR polylines in --curves-svg output

Detailed Description

Internals of the fst4 command-line tool: its type aliases, the option record, the run pipeline with its result types, the CLI-specific observers and adapters, and the output emitters.

Nothing in here is library API – the library is namespace FST, which the tool uses through explicit qualification. The namespace keeps the tool's own types visibly apart from the library's, in the reference documentation as much as for the compiler; main() alone stays at global scope and imports this namespace.

Function Documentation

◆ emit_array()

template<typename T>
void fst4_cli::emit_array ( std::ostream & os,
const std::vector< T > & v )
static

writes a JSON array of v's elements via operator<<, e.g. feature-index vectors (RETURNTYPE values should go through emit_double_array() instead, for fmt_double() formatting)

◆ emit_invocation_json()

void fst4_cli::emit_invocation_json ( std::ostream & os,
const Config & cfg,
const std::string & format )
static

writes the "invocation" JSON object: an echo of the resolved configuration, restricted to options that actually apply to this run (criterion-specific/search-specific/non-default flags only) so the echo stays a faithful, minimal record of what produced the result – part of emit_json()'s output, so os is always the real-stdout stream, never the redirected std::cout

◆ emit_text()

void fst4_cli::emit_text ( std::ostream & os,
const Config & cfg,
const std::string & format,
const Pipeline & p,
const RunResult & r,
const CompareResult * cmp = nullptr )
static

writes the complete --output text result (the default, human-readable format): the fst4 report layout, extended with the --report detailed sections and the --compare-config scenario-B/similarity block when present. Unlike emit_json()/emit_csv(), text output is not machine-format-redirected – os is real stdout regardless of --output, since text mode never redirects std::cout to stderr

◆ emit_validation_json()

void fst4_cli::emit_validation_json ( std::ostream & os,
const RunResult::ValidationEntry & e )
static

writes one RunResult::ValidationEntry as a JSON object; the confusion matrix is included only when confusion_classes>0 (--report detailed final validation)

◆ extract_classifier_curves()

void fst4_cli::extract_classifier_curves ( const std::shared_ptr< CLASSIFIER > & vc,
const std::shared_ptr< DATAACCESSOR > & da,
std::vector< RunResult::ClassCurve > & curves )
static

--report detailed: ROC/PR curves of a trained classifier on the depth-0 holdout — binary from test_scores (positive class 1), K>2 one one-vs-rest curve per class from the score matrix; classifiers without classify_scores (extern) yield nothing

◆ extract_curves()

bool fst4_cli::extract_curves ( std::vector< std::pair< RETURNTYPE, DIMTYPE > > & sc,
std::vector< RunResult::CurvePoint > & roc,
std::vector< RunResult::CurvePoint > & pr )
static

walks (score, is_positive) pairs from the highest score down and emits one ROC and one PR point per distinct threshold (deterministic: stable sort keeps enumeration order in tie groups; the (0,0) ROC start point is implied). Sorts sc in place, descending by score. Returns false when either class is absent on the holdout — the curves are undefined then (the AUC convention).

◆ fmt_double()

std::string fst4_cli::fmt_double ( const double v)
static

formats a double at fixed 12-significant-digit precision – the one number formatter every emitter uses, so numeric output stays consistent (and reproducible) across text/json/csv

◆ infer_format()

std::string fst4_cli::infer_format ( const std::string & path)
static

infers the data format from a file's extension (.trn/.arff/.csv/.tsv, case-insensitive); throws when the extension is missing or unrecognized – the caller then needs an explicit --format

◆ json_escape()

std::string fst4_cli::json_escape ( const std::string & s)
static

escapes a string for embedding inside a JSON string literal (RFC 8259: quotes, backslash, the named short escapes, and all remaining control characters via \uXXXX)

◆ list_constant_features()

std::string fst4_cli::list_constant_features ( const std::shared_ptr< DATAACCESSOR > & da)
static

scans the current split's TRAIN data for features constant within some class - the cause of singular covariance matrices in normal-model criteria (4.4)

◆ make_accessor()

std::shared_ptr< ACCESSOR_MEM > fst4_cli::make_accessor ( const Config & cfg,
const std::string & format )
static

constructs and initialize()s the data accessor for the resolved format: builds the outer (and, under --splitter2, inner) splitter stack and the scaler, then dispatches to the data-free universe accessor or one of the three file-format loaders (trn/arff/csv)

Parameters
cfgthe resolved CLI configuration (data path, splitter/scaler/format flags, etc.)
formatthe resolved format string ("trn"|"arff"|"csv"), never used for the data-free entry
Returns
the initialize()d accessor; throws FST::fst_error on an unknown format

◆ make_classifier()

std::shared_ptr< CLASSIFIER > fst4_cli::make_classifier ( const std::string & name,
const Config & cfg,
const std::shared_ptr< DATAACCESSOR > & da,
Pipeline * pipe = 0 )
static

constructs a classifier by name (used by wrapper criteria and by --validate); when pipe is given, the concrete LibSVM / native RBF-SVM handle is stashed on it for the optimize protocols

◆ make_criterion()

std::shared_ptr< CRITERION > fst4_cli::make_criterion ( const Config & cfg,
Pipeline & p )
static

constructs the criterion (initialize()d on the accessor's current split) and fills the pipeline's split_eval / crit_reinit callbacks and classifier handles

◆ make_engine()

PENGINE fst4_cli::make_engine ( const Config & cfg,
Pipeline & p )
static

the candidate-evaluation engine for the non-sequential searches (exhaustive, Monte Carlo, B&B) and for every step evaluator (straight/hybrid/ensemble/sampled); each engine is registered on p so that Pipeline::invalidate_engine_clones() can drop its criterion clones when the criterion's evaluation context changes

◆ make_evaluator()

std::shared_ptr< EVALUATOR > fst4_cli::make_evaluator ( const Config & cfg,
Pipeline & p,
const int eval_depth )
static

constructs the sequential-step candidate evaluator selected by --evaluator (straight/hybrid/ ensemble/sampled), or – when --evaluator is left at its default and the search is not one of those step-evaluator families – the plain sequential/thread-pooled evaluator picked by --threads. sampled/hybrid/ensemble additionally stash engine/statistics handles on p so later phases (the --warmup-probes loop) can reuse them

Parameters
cfgthe resolved CLI configuration (--evaluator, --threads, and the sampled/hybrid/ensemble sub-flags)
pthe run's Pipeline, mutated in place to stash engine/statistics handles for later phases
eval_depththe splitting depth the constructed evaluator's criterion should run at (hybrid's prefilter is built at depth 0 regardless, then the main criterion resumes at this depth)

◆ make_knn()

std::shared_ptr< CLASSIFIER > fst4_cli::make_knn ( const Config & cfg,
const unsigned int k )
static

constructs a kNN classifier with k=k and the --knn-distance metric (L1/L2/Lp); shared by --criterion wrapper-knn, --validate, and the ensemble evaluator's per-k members

◆ make_metric_spec()

FST::Metric_Spec< RETURNTYPE > fst4_cli::make_metric_spec ( const Config & cfg,
const DIMTYPE classes )
static

builds the wrapper Metric_Spec from the CLI flags; the class-count-dependent checks (weights arity, two-class metrics) need the loaded data

◆ make_scaler()

std::shared_ptr< FST::Data_Scaler< DATATYPE > > fst4_cli::make_scaler ( const Config & cfg)
static

constructs the --scaler by name; the void scaler additionally implements --missing-value substitution (its two-argument constructor), so --missing-value with any other scaler is rejected here rather than silently ignored

Parameters
cfgthe parsed configuration (reads cfg.scaler and cfg.missing_value)
Returns
the constructed scaler; throws FST::fst_error on an unknown --scaler name or an unsupported --missing-value/--scaler combination

◆ make_search()

std::shared_ptr< SEARCH > fst4_cli::make_search ( const Config & cfg,
Pipeline & p,
const std::shared_ptr< EVALUATOR > & eval )
static

constructs the --search algorithm by name, applying its algorithm-specific parameters (delta/gamma/generalization-level/Monte Carlo stopping/...); eval is used only by the sequential-family searches (bif, exhaustive, Monte Carlo and the four B&B variants build their own engine internally via make_engine(), registered on p)

Returns
the constructed search; throws FST::fst_error on an unknown --search name

◆ make_tracker()

void fst4_cli::make_tracker ( const Config & cfg,
Pipeline & p )
static

constructs the result tracker; capacity 0 means the type default (dupless: top_k, others: unlimited)

◆ parse_compare_config()

Config fst4_cli::parse_compare_config ( const std::string & path)
static

parses a --compare-config file into a fresh Config through the full add_options() set – the file must be self-contained (it supplies --data, --criterion, --search, ... itself, since this parses a synthetic one-token "fst4" command line with no other arguments) – and applies the same wrapper-ridge default-metric normalization main() applies to the primary scenario, so both scenarios of a --compare-config run are treated identically

Returns
the second scenario's configuration; throws on a missing/malformed config file (app2.parse()'s CLI11 validation errors propagate as exceptions)

◆ parse_verbosity()

FST::OutputDetail fst4_cli::parse_verbosity ( const std::string & v)
static

maps --verbosity ("silent"|"normal"|"detailed") to the library's FST::OutputDetail enum; any other string (unreachable past CLI11's IsMember check) falls back to FST::NORMAL

◆ run_validation()

std::vector< RunResult::ValidationEntry > fst4_cli::run_validation ( const Config & cfg,
Pipeline & p,
const std::shared_ptr< SUBSET > & sub,
RunResult * detail = nullptr,
const bool is_final = false )
static

detail!=nullptr (--report detailed final validation): classification entries gain the confusion matrix, and the FIRST classification entry contributes the ROC/PR curves — the --validate step: trains each named classifier on the depth-0 train part and tests it on the depth-0 test part of the given subset (the demo final-validation protocol); both reuse the just-trained classifier, no extra training. final=true marks the final-subset validation, the only one --dump-scores writes for (the sweep and curve_over_d re-validations call this too)

◆ setup_filter_criterion()

template<class CRIT_T>
std::shared_ptr< CRITERION > fst4_cli::setup_filter_criterion ( const std::shared_ptr< DATAACCESSOR > & da,
std::function< bool(RETURNTYPE &, const std::shared_ptr< SUBSET > &)> & split_eval,
std::function< void()> & crit_reinit )
static

constructs and installs one filter criterion incl. the (uniform) per-split re-initialization callbacks — the five make_criterion filter blocks share it (the lambdas capture the CONCRETE type so that the per-split initialize() call binds statically, exactly as a hand-written per-criterion block would)

◆ subset_features()

std::vector< DIMTYPE > fst4_cli::subset_features ( const std::shared_ptr< SUBSET > & sub)
static

extracts a subset's selected feature indices as a plain, ascending-sorted vector – the shape every output emitter (text/json/csv) and result-file writer works from

◆ write_curves_svg()

bool fst4_cli::write_curves_svg ( const std::string & path,
const RunResult & r )
static

--curves-svg: renders whatever curves --report detailed produced into one self-contained SVG — the ROC and PR curves of the validated classifier (one polyline per class on multiclass data, one-vs-rest) and the criterion-vs-holdout curve over subset sizes. The over-d panel carries TWO y-axes, left = criterion value and right = validated accuracy, because the train-criterion axis and the validated axis measure different things and must never be conflated on one scale. Returns false when the result carries no curve at all.

◆ write_scores_dump()

void fst4_cli::write_scores_dump ( const std::string & path,
const std::shared_ptr< CLASSIFIER > & vc,
const std::shared_ptr< DATAACCESSOR > & da,
const std::string & label,
const std::vector< DIMTYPE > & features )
static

--dump-scores: the final subset's per-sample predictions on the depth-0 holdout — true label, predicted label, and one column per class score where the classifier exposes them. The walk is the class-major, block-order enumeration test_scores_matrix performs, so row i of the dump is point i of the ROC/PR input. The prediction comes from classify(), the classifier's OWN decision rule, not from an argmax over the score row: the two coincide for most classifiers but the LibSVM wrapper aggregates one-vs-one votes by its own convention. Classifiers without score support (the wrapper-extern label protocol) get the label columns only. Costs one extra pass over the holdout, no extra training.

Copyright © 2000–present ÚTIA, Institute of Information Theory and Automation of the Czech Academy of Sciences · Contacts · This site sets no cookies and uses no analytics.