Exposes FST4 functionality as a command-line tool: data file, splitter, scaler, criterion, search algorithm and their settings are selected via command-line arguments. More...
#include <algorithm>#include <atomic>#include <cerrno>#include <chrono>#include <cstdio>#include <cstdlib>#include <cstring>#include <exception>#include <filesystem>#include <fstream>#include <functional>#include <iostream>#include <limits>#include <map>#include <memory>#include <string>#include <vector>#include "CLI11.hpp"#include "error.hpp"#include "global.hpp"#include "fst_rand.hpp"#include "subset.hpp"#include "data_intervaller.hpp"#include "data_splitter.hpp"#include "data_splitter_5050.hpp"#include "data_splitter_cv.hpp"#include "data_splitter_holdout.hpp"#include "data_splitter_resub.hpp"#include "data_splitter_randrand.hpp"#include "data_splitter_randfix.hpp"#include "data_splitter_leave1out.hpp"#include "data_scaler.hpp"#include "data_scaler_void.hpp"#include "data_scaler_to01.hpp"#include "data_scaler_white.hpp"#include "data_accessor_splitting_memTRN.hpp"#include "data_accessor_splitting_memARFF.hpp"#include "data_accessor_splitting_memCSV.hpp"#include "data_accessor_universe.hpp"#include "criterion_normal_bhattacharyya.hpp"#include "criterion_normal_divergence.hpp"#include "criterion_normal_gmahalanobis.hpp"#include "criterion_multinom_bhattacharyya.hpp"#include "classifier_multinom_naivebayes.hpp"#include "classifier_svm.hpp"#include "criterion_wrapper.hpp"#include "criterion_wrapper_bias_estimate.hpp"#include "regressor.hpp"#include "regressor_weighted_neighbours.hpp"#include "regressor_ridge.hpp"#include "distance_euclid.hpp"#include "distance_L1.hpp"#include "distance_Lp.hpp"#include "classifier_knn.hpp"#include "classifier_normal_bayes.hpp"#include "classifier_logreg.hpp"#include "classifier_rf.hpp"#include "classifier_linear_svm.hpp"#include "classifier_rbf_svm.hpp"#include "classifier_lda.hpp"#include "classifier_extern.hpp"#include "criterion_extern_value.hpp"#include "seq_step_straight.hpp"#include "seq_step_hybrid.hpp"#include "seq_step_ensemble.hpp"#include "result_weighter_sampled.hpp"#include "seq_step_sampled.hpp"#include "search_seq_sfs.hpp"#include "search_seq_sffs.hpp"#include "search_seq_sfrs.hpp"#include "search_seq_os.hpp"#include "search_seq_dos.hpp"#include "search_ranking_bif.hpp"#include "search_exhaustive.hpp"#include "search_monte_carlo.hpp"#include "search_branch_and_bound_basic.hpp"#include "search_branch_and_bound_improved.hpp"#include "search_branch_and_bound_fast.hpp"#include "search_branch_and_bound_partial_prediction.hpp"#include "branch_and_bound_predictor_averaging.hpp"#include "candidate_evaluator.hpp"#include "candidate_evaluator_sequential.hpp"#include "candidate_evaluator_threaded.hpp"#include "criterion_negative.hpp"#include "criterion_subsetsize.hpp"#include "criterion_sumofweights.hpp"#include "result_tracker_dupless.hpp"#include "result_tracker_regularizer.hpp"#include "result_tracker_stabileval.hpp"#include "result_tracker_feature_stats.hpp"Classes | |
| class | fst4_cli::Criterion_Counting |
| class | fst4_cli::NullBuf |
| swallows all output (used with --verbosity silent) More... | |
| class | fst4_cli::Stdin_Data_File |
| class | fst4_cli::Observer_JSON |
| --progress json: emits one JSON line per improved solution to the progress stream; free-text progress is dropped More... | |
| class | fst4_cli::Observer_Curve |
| struct | fst4_cli::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 | fst4_cli::Pipeline |
| everything the run phase needs, assembled by the factories below More... | |
| struct | fst4_cli::RunResult |
| struct | fst4_cli::RunResult::ValidationEntry |
| one classifier's/regressor's holdout validation outcome (--validate) More... | |
| struct | fst4_cli::RunResult::TopEntry |
| one entry of the dupless tracker's --top-k best distinct subsets More... | |
| struct | fst4_cli::RunResult::RegEntry |
| one --regularize-margins sweep point: the best subset within margin of the maximum by the secondary criterion More... | |
| struct | fst4_cli::RunResult::TrialEntry |
| one --repeat-over-splits trial's search outcome More... | |
| struct | fst4_cli::RunResult::StabilityEntry |
| one named stability/similarity measure computed by the stabileval tracker (see the FST4_STAB macro) More... | |
| struct | fst4_cli::RunResult::DafEntry |
| one --daf-rank ranked feature More... | |
| struct | fst4_cli::RunResult::PairDafEntry |
| one --daf-pairs pairwise (2-feature) DAF statistic More... | |
| struct | fst4_cli::RunResult::SweepEntry |
| one --regr-multipliers sweep point (demo11reg) More... | |
| struct | fst4_cli::RunResult::CurvePoint |
| one ROC/PR point at a given decision threshold (see extract_curves()) More... | |
| struct | fst4_cli::RunResult::ClassCurve |
| one class's ROC and PR curves (see extract_classifier_curves()) More... | |
| struct | fst4_cli::RunResult::CurveEntry |
| one curve_over_d point: the best subset of a given size plus its holdout re-validation (the overfitting curve) More... | |
| struct | fst4_cli::CompareResult |
| everything produced by a --compare-config second scenario (the demo55 protocol) More... | |
| struct | fst4_cli::Svg_Panel |
Namespaces | |
| namespace | fst4_cli |
| 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. | |
Macros | |
| #define | FST4_VERSION "4.2.0" |
| fst4 CLI version string; echoed in the text/JSON/CSV invocation block | |
| #define | FST4_STAB(NAME, EXPR) |
| Appends one RunResult::StabilityEntry{NAME, EXPR} to r.stability. | |
Typedefs | |
| typedef double | fst4_cli::RETURNTYPE |
| criterion/classifier/regressor return value type used throughout the CLI | |
| typedef double | fst4_cli::DATATYPE |
| raw sample value type read from the data file | |
| typedef double | fst4_cli::REALTYPE |
| intermediate real-valued computation type (always real, never integral) | |
| typedef unsigned int | fst4_cli::IDXTYPE |
| sample (row) index type | |
| typedef unsigned int | fst4_cli::DIMTYPE |
| feature (dimension) index type | |
| typedef short | fst4_cli::BINTYPE |
| per-feature membership flag type backing SUBSET | |
| typedef FST::Subset< BINTYPE, DIMTYPE > | fst4_cli::SUBSET |
| the concrete feature-subset type instantiated across the whole CLI | |
| typedef FST::Data_Intervaller< std::vector< FST::Data_Interval< IDXTYPE > >, IDXTYPE > | fst4_cli::INTERVALLER |
| concrete split-interval representation shared by every splitter | |
| typedef std::shared_ptr< FST::Data_Splitter< INTERVALLER, IDXTYPE > > | fst4_cli::PSPLITTER |
| shared pointer to the abstract Data_Splitter base, holding whichever concrete splitter --splitter/--splitter2 selects at runtime | |
| typedef FST::Data_Accessor< DATATYPE, IDXTYPE > | fst4_cli::DATAACCESSOR |
| abstract data-access seam: the base every format accessor (and the --features data-free universe accessor) implements | |
| typedef FST::Criterion< RETURNTYPE, SUBSET > | fst4_cli::CRITERION |
| abstract criterion seam: the base every --criterion implementation and internal adapter implements | |
| typedef FST::Classifier< RETURNTYPE, DIMTYPE, SUBSET, DATAACCESSOR > | fst4_cli::CLASSIFIER |
| abstract classifier seam: the base every --validate classifier and wrapper-* criterion's inner classifier implements | |
| typedef FST::Sequential_Step< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > | fst4_cli::EVALUATOR |
| abstract sequential-step seam: the base every --evaluator implementation implements | |
| typedef FST::Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > | fst4_cli::SEARCH |
| abstract search seam: the base every --search algorithm implements | |
| typedef FST::Data_Accessor_Splitting_Mem< DATATYPE, IDXTYPE, INTERVALLER > | fst4_cli::ACCESSOR_MEM |
| shared concrete-side base: initialize(), setSplittingDepth() | |
| typedef FST::Data_Accessor_Splitting_MemTRN< DATATYPE, IDXTYPE, INTERVALLER > | fst4_cli::ACCESSOR_TRN |
| TRN-format data accessor (--format trn). | |
| typedef FST::Data_Accessor_Splitting_MemARFF< DATATYPE, IDXTYPE, INTERVALLER > | fst4_cli::ACCESSOR_ARFF |
| ARFF-format (Weka) data accessor (--format arff). | |
| typedef FST::Data_Accessor_Splitting_MemCSV< DATATYPE, IDXTYPE, INTERVALLER > | fst4_cli::ACCESSOR_CSV |
| CSV/TSV-format data accessor (--format csv). | |
| typedef FST::Data_Accessor_Universe< DATATYPE, IDXTYPE, INTERVALLER > | fst4_cli::ACCESSOR_UNIVERSE |
| --features N: data-free set-function entry | |
| typedef FST::Data_Splitter_5050< INTERVALLER, IDXTYPE > | fst4_cli::SPLITTER5050 |
| 1st half train, 2nd half test, deterministic (--splitter/--splitter2 5050, the default) | |
| typedef FST::Data_Splitter_CV< INTERVALLER, IDXTYPE > | fst4_cli::SPLITTERCV |
| k-fold cross-validation splitter (--splitter/--splitter2 cv; --cv-folds/--splitter2-cv-folds) | |
| typedef FST::Data_Splitter_Holdout< INTERVALLER, IDXTYPE > | fst4_cli::SPLITTERHOLDOUT |
| percentage holdout splitter: first x% train, rest test (--splitter/--splitter2 holdout; --holdout-train/--splitter2-holdout-train) | |
| typedef FST::Data_Splitter_Resub< INTERVALLER, IDXTYPE > | fst4_cli::SPLITTERRESUB |
| resubstitution splitter: train = test = all data (--splitter/--splitter2 resub) | |
| typedef FST::Data_Splitter_RandomRandom< INTERVALLER, IDXTYPE, BINTYPE > | fst4_cli::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 > | fst4_cli::SPLITTERRANDFIX |
| randfix splitter: like randrand but with a fixed test part reused across splits (--splitter/--splitter2 randfix) | |
| typedef FST::Data_Splitter_Leave1Out< INTERVALLER, IDXTYPE > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::CRIT_GMAHA |
| gmahalanobis: normal-model filter (generalized Mahalanobis distance), monotonic, two-class only | |
| typedef FST::Distance_Euclid< DATATYPE, DIMTYPE, SUBSET > | fst4_cli::DIST_L2 |
| Euclidean (L2) distance, the kNN default (--knn-distance L2). | |
| typedef FST::Distance_L1< DATATYPE, DIMTYPE, SUBSET > | fst4_cli::DIST_L1 |
| L1 (Manhattan) distance (--knn-distance L1). | |
| typedef FST::Distance_Lp< DATATYPE, REALTYPE, DIMTYPE, SUBSET, 3, 2 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::BAYES |
| normal Bayes classifier (wrapper-bayes) | |
| typedef FST::Classifier_Multinomial_NaiveBayes< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > | fst4_cli::MULTINOM_NB |
| multinomial naive-Bayes classifier, count/text data (wrapper-multinom) | |
| typedef FST::Classifier_Logistic_Regression< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::LDA |
| shared-covariance linear discriminant classifier, parameterless and deterministic (wrapper-lda) | |
| typedef FST::Classifier_Extern< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::CRIT_MBHAT |
| multinom-bhattacharyya: multinomial-model filter, monotonic, count/text data | |
| typedef FST::Criterion_Multinomial_MI< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::RIDGE |
| closed-form ridge regressor: Cholesky-solved L2-regularized least squares (wrapper-ridge) | |
| typedef FST::Criterion_Wrapper< RETURNTYPE, SUBSET, REGRESSOR, DATAACCESSOR > | fst4_cli::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 > | fst4_cli::EVAL_SEQ |
| the default (straight) sequential step: plain in-line candidate evaluation (--evaluator straight) | |
| typedef FST::Sequential_Step_Hybrid< RETURNTYPE, DIMTYPE, SUBSET, CRITERION, CRITERION > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::ENGINE |
| the candidate-evaluation engine seam (in-line sequential or thread-pooled), injected into searches and step evaluators | |
| typedef std::shared_ptr< ENGINE > | fst4_cli::PENGINE |
| shared pointer to ENGINE | |
| typedef FST::Branch_And_Bound_Predictor_Averaging< RETURNTYPE, DIMTYPE > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::TRACKER_STATS |
| the feature-stats result tracker: probe statistics behind --daf-rank/--daf-pairs (--tracker feature-stats) | |
| typedef FST::Criterion_Subset_Size< RETURNTYPE, SUBSET > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::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 > | fst4_cli::make_metric_spec (const Config &cfg, const DIMTYPE classes) |
| static std::vector< DIMTYPE > | fst4_cli::subset_features (const std::shared_ptr< SUBSET > &sub) |
| static std::string | fst4_cli::fmt_double (const double v) |
| static std::string | fst4_cli::json_escape (const std::string &s) |
| static std::string | fst4_cli::infer_format (const std::string &path) |
| static std::shared_ptr< FST::Data_Scaler< DATATYPE > > | fst4_cli::make_scaler (const Config &cfg) |
| static PSPLITTER | fst4_cli::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 > | fst4_cli::make_accessor (const Config &cfg, const std::string &format) |
| static std::shared_ptr< CLASSIFIER > | fst4_cli::make_knn (const Config &cfg, const unsigned int k) |
| static std::shared_ptr< CRITERION > | fst4_cli::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 > | fst4_cli::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 > | 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 std::shared_ptr< CRITERION > | fst4_cli::make_criterion (const Config &cfg, Pipeline &p) |
| static PENGINE | fst4_cli::make_engine (const Config &cfg, Pipeline &p) |
| static std::shared_ptr< EVALUATOR > | fst4_cli::make_evaluator (const Config &cfg, Pipeline &p, const int eval_depth) |
| static void | fst4_cli::make_tracker (const Config &cfg, Pipeline &p) |
| static bool | fst4_cli::extract_curves (std::vector< std::pair< RETURNTYPE, DIMTYPE > > &sc, std::vector< RunResult::CurvePoint > &roc, std::vector< RunResult::CurvePoint > &pr) |
| static void | fst4_cli::extract_classifier_curves (const std::shared_ptr< CLASSIFIER > &vc, const std::shared_ptr< DATAACCESSOR > &da, std::vector< RunResult::ClassCurve > &curves) |
| static 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 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 std::shared_ptr< SEARCH > | fst4_cli::make_search (const Config &cfg, Pipeline &p, const std::shared_ptr< EVALUATOR > &eval) |
| static std::string | fst4_cli::list_constant_features (const std::shared_ptr< DATAACCESSOR > &da) |
| static FST::OutputDetail | fst4_cli::parse_verbosity (const std::string &v) |
| static void | fst4_cli::emit_invocation_json (std::ostream &os, const Config &cfg, const std::string &format) |
| template<typename T> | |
| static void | fst4_cli::emit_array (std::ostream &os, const std::vector< T > &v) |
| static void | fst4_cli::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 | fst4_cli::emit_validation_json (std::ostream &os, const RunResult::ValidationEntry &e) |
| static void | fst4_cli::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 | fst4_cli::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 | 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 std::string | fst4_cli::svg_num (double v) |
| fixed-precision coordinate formatter — keeps the SVG byte-stable across runs | |
| static std::string | fst4_cli::svg_tick (const double v) |
| short axis-tick formatter (4 significant digits is plenty for a tick label) | |
| static std::string | fst4_cli::svg_escape (const std::string &s) |
| XML-escapes text destined for an SVG <text> element (classifier names come from --validate). | |
| static bool | fst4_cli::write_curves_svg (const std::string &path, const RunResult &r) |
| static void | fst4_cli::print_components (std::ostream &os) |
| --list: the component registry with one-line descriptions and validity notes | |
| static void | fst4_cli::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 | fst4_cli::parse_compare_config (const std::string &path) |
| int | main (int argc, char *argv[]) |
| fst4 CLI entry point. | |
Exposes FST4 functionality as a command-line tool: data file, splitter, scaler, criterion, search algorithm and their settings are selected via command-line arguments.
======================================================================
Design: every component is instantiated ONCE against the abstract component bases (type erasure) and concrete implementations are chosen at runtime through string-keyed factories - total template instantiations stay linear in the number of components.
Component surface: fst4 --list prints the complete registry (data formats, splitters, scalers, criteria, searches, step evaluators, trackers) with validity notes, fst4 --help every flag; doc/FST4_CLI.md is the reference.
Results are sourced from the result tracker and the final subset, and printed as text (default), JSON, or CSV. --stable-output omits the timing/evaluation-count block so that output is reproducible byte for byte.
Compile-time menu notes: Classifier_kNN constructs its DISTANCE internally, so each distance is a separate kNN instantiation; Distance_Lp's exponent is a template parameter, so --knn-distance Lp means p=3/2 (the value used by the demos).
| #define FST4_STAB | ( | NAME, | |
| EXPR ) |
Appends one RunResult::StabilityEntry{NAME, EXPR} to r.stability.
Local sugar for the --repeat-over-splits post-processing block of main() only: reused as-is by 11 back-to-back invocations there, one per stabileval measure (value_mean/value_stddev/size_mean/size_stddev/CWrel/ATI/CW/ANHI/SH/PH/C), each calling a different Data_Splitter_Stabileval query on p.tracker_stabil. Defined immediately before its first use and #undef'd immediately after its last – it has no meaning outside that block. e is the enclosing scope's RunResult::StabilityEntry; each invocation is a full statement (the macro body supplies the trailing semicolons), so it is used as FST4_STAB("name", expr) with no semicolon of its own.
| int main | ( | int | argc, |
| char * | argv[] ) |
fst4 CLI entry point.
Parses the command line (add_options() via CLI11; --list short-circuits before parsing proper, since it needs no --data/--criterion/--search), then: