The Feature Selection Toolbox 4 library: every library component – data access, criteria and classifiers, search algorithms, result trackers and the global infrastructure – lives in this namespace. More...
Classes | |
| class | Branch_And_Bound_Predictor |
| Defines Interface for Implementations of Prediction Mechanism in Fast Branch and Bound & Branch and Bound with Partial Prediction. More... | |
| class | Branch_And_Bound_Predictor_Averaging |
| Averaging Prediction Mechanism in Fast Branch and Bound & Branch and Bound with Partial Prediction. More... | |
| class | Candidate_Evaluator |
| Abstract candidate-evaluation strategy (sequential-inline vs. thread-pooled). More... | |
| class | Candidate_Evaluator_Sequential |
| Implements sequential in-line evaluation of a criterion on a set of subset candidates. More... | |
| class | Candidate_Evaluator_Threaded |
| Implements concurrent evaluation of a criterion on a set of subset candidates. More... | |
| class | Classifier |
| abstract class, defines interface for classifier implementations (mainly to be used in wrappers) More... | |
| class | Classifier_Extern |
| Bridge classifier delegating training and prediction to a user-supplied external command. More... | |
| class | Classifier_kNN |
| Implements k-Nearest Neighbor classifier. More... | |
| class | Classifier_LDA |
| Linear (Fisher/Gaussian shared-covariance) discriminant classifier. More... | |
| class | Classifier_LIBSVM |
| Wraps external Support Vector Machine implementation (in LibSVM) to serve as FST4 classifier. More... | |
| class | Classifier_Linear_SVM |
| Dependency-free linear SVM trained by dual coordinate descent (the method of Hsieh et al., ICML 2008, as popularized by LIBLINEAR — implemented from scratch, no external code). More... | |
| class | Classifier_Logistic_Regression |
| Implements multinomial (softmax) logistic regression classifier. More... | |
| class | Classifier_Multinomial_NaiveBayes |
| Implements Naive-like Bayes classifier based on multinomial model. More... | |
| class | Classifier_Normal_Bayes |
| Implements Bayes classifier based on normal (gaussian) model. More... | |
| class | Classifier_Random_Forest |
| Dependency-free Random Forest classifier (CART trees, Gini impurity, bagging, per-node feature subsampling), deterministic by design. More... | |
| class | Classifier_RBF_SVM |
| Dependency-free RBF kernel SVM trained by kernel dual coordinate descent (implemented from scratch, no LibSVM code; C-SVC with the RBF kernel only, deliberately NOT a LibSVM replacement: no nu-variants, no SVR, no one-class, no probability estimates, no shrinking). More... | |
| class | Clonable |
| Abstract class, defines interface for classes that may need to get cloned. More... | |
| class | Clonable_Impl |
| CRTP mixin implementing the Clonable protocol for a concrete class. More... | |
| class | Criterion |
| Abstract class, defines interface for feature selection criterion classes. More... | |
| class | Criterion_Extern_Value |
| External-tool criterion: a user-supplied command computes the criterion value itself - unlike wrapper-extern, which exchanges labels and computes accuracy on the FST4 side. More... | |
| class | Criterion_Filter |
| Abstract class, defines interface for classes implementing "independent" feature selection criteria. More... | |
| class | Criterion_Multinomial |
| Abstract class, defines interface for feature selection criterion implementations based on multinomial model. More... | |
| class | Criterion_Multinomial_Bhattacharyya |
| Implements Bhattacharyya distance based on multinomial model to serve as feature selection criterion. More... | |
| class | Criterion_Multinomial_MI |
| Implements individual Mutual Information based on multinomial model to serve as feature selection criterion in Best Individual Feature setting (feature ranking). More... | |
| class | Criterion_Negative |
| Returns the negative of another Criterion's result. More... | |
| class | Criterion_Normal |
| Abstract class, defines interface for feature selection criterion implementations based on normal model. More... | |
| class | Criterion_Normal_Bhattacharyya |
| Implements Bhattacharyya distance based on normal (gaussian) model to serve as feature selection criterion. More... | |
| class | Criterion_Normal_Divergence |
| Implements Divergence (distance) based on normal (gaussian) model to serve as feature selection criterion. More... | |
| class | Criterion_Normal_GMahalanobis |
| Implements Generalized Mahalanobis distance based on normal (gaussian) model to serve as feature selection criterion. More... | |
| class | Criterion_Subset_Size |
| Returns the (positive) subset size sub->get_d() - since FST4 searches maximize, this rates LARGER subsets higher. Wrap in Criterion_Negative to favor smaller subsets instead. More... | |
| class | Criterion_Sum_Of_Weights |
| Returns sum of pre-specified feature weights for features in the evaluated subset. More... | |
| class | Criterion_Wrapper |
| Wraps Classifier objects to serve as feature selection criterion. More... | |
| class | Criterion_Wrapper_Bias_Estimate |
| Wrapper Bias Evaluator - returns bias estimate (difference of classifier accuracy on training and validation data parts). More... | |
| class | Data_Accessor |
| abstract class, defines interface for data access implementations More... | |
| class | Data_Accessor_Splitting |
| partly-abstract class, defines support for data splitting More... | |
| class | Data_Accessor_Splitting_Mem |
| Implements data access to data cached entirely in memory, concrete file type support is delegated to derived classes. More... | |
| class | Data_Accessor_Splitting_MemARFF |
| Implements data access to data cached entirely in memory, read once from a ARFF file. More... | |
| class | Data_Accessor_Splitting_MemCSV |
| Implements data access to data cached entirely in memory, read once from a CSV (delimited text) file; see Data_File_CSV for the accepted dialects and options. More... | |
| class | Data_Accessor_Splitting_MemTRN |
| Implements data access to data cached entirely in memory, read once from a TRN file. More... | |
| class | Data_Accessor_Universe |
| Data-free accessor over an abstract feature universe of N features (the fst4 CLI's --features N entry; the companion of criterion_extern_value.hpp in its data-free mode). More... | |
| class | Data_File_ARFF |
| ARFF data format filter. More... | |
| class | Data_File_ARFF_Feature |
| ARFF data format filter - representation of an attribute (one @ATTRIBUTE column). More... | |
| class | Data_File_ARFF_Record |
| ARFF data format filter - representation of a record (one @DATA row). More... | |
| class | Data_File_CSV |
| CSV (delimited text) data format filter — the simplest spreadsheet-to-FST4 path. More... | |
| struct | Data_File_CSV_Options |
| CSV loader options. More... | |
| class | Data_File_TRN |
| TRN data format filter. More... | |
| struct | Data_Interval |
| Support structure to hold data interval (referring into data held by data accessor). More... | |
| class | Data_Intervaller |
| Container to hold list of Data_Interval; implements nested interval reduction. More... | |
| class | Data_Scaler |
| abstract class, defines interface for data scaling implementations (for use in data accessors) More... | |
| class | Data_Scaler_to01 |
| Implements data normalization (of all feature values) to interval [0,1]. More... | |
| class | Data_Scaler_void |
| Void data scaler, to bypass data normalization. More... | |
| class | Data_Scaler_white |
| Implements data whitening (as result, each feature mean value is 0 with normalized stddev). More... | |
| class | Data_Splitter |
| Abstract class, defines interface for data splitting implementations (for use in data accessors). More... | |
| class | Data_Splitter_5050 |
| Implements train/test data splitting: first 50% of original data for training, second 50% for testing, each (data)class split separately. More... | |
| class | Data_Splitter_CV |
| Implements train/test data splitting: by means of k-fold cross-validation. More... | |
| class | Data_Splitter_Holdout |
| Implements train/test data splitting: use initial x% of original data for training, the rest for testing, each (data)class split separately. More... | |
| class | Data_Splitter_Leave1Out |
| Implements train/test data splitting: by means of leave-one-out. More... | |
| class | Data_Splitter_RandomRandom |
| Implements train/test data splitting: use randomly chosen x% of data samples for training and another y% of data for testing, without overlaps, separately in each class. More... | |
| class | Data_Splitter_Resub |
| Implements train/test data splitting: use all data both for training and then once more for testing. More... | |
| class | Data_Splitter_TrainRandom_TestFixed |
| Implements train/test data splitting: equal to Data_Splitter_RandomRandom except that the same test data is returned in each loop. More... | |
| class | Distance |
| Abstract class, defines interface for distance evaluators to be used in Classifier_kNN. More... | |
| class | Distance_Euclid |
| Implements Euclidean (L_2) distance. More... | |
| class | Distance_L1 |
| Implements L_1 (city-block / Manhattan) distance. More... | |
| class | Distance_Lp |
| Implements L_{p} distance, p equals numerator/denominator (template parameters). More... | |
| class | Extern_Bridge |
| Persistent-child-process line-protocol plumbing shared by the external-tool bridges: Classifier_Extern (TRAIN/TEST label protocol) and Criterion_Extern_Value (VALUE protocol). More... | |
| class | fst_error |
| FST4 specific error passing class. More... | |
| class | Indexed_Matrix |
| Matrix representation and operations, allows operation in selected subspace. More... | |
| class | Indexed_Vector |
| Vector representation and operations, allows operation in selected subspace. Also serves as the helper structure for passing matrix-operation intermediate data between higher-level matrix objects and functions. More... | |
| struct | Metric_Spec |
| configuration of the wrapper metric; immutable during search, copied by criterion clones (thread-safe, RNG-free) More... | |
| class | Model |
| abstract class, defines interface for data model implementations More... | |
| class | Model_Multinomial |
| Multinomial ("bag of words") model: per-class term-count sums and the Laplace-smoothed term probabilities P(term|class) derived from them. More... | |
| class | Model_Normal |
| Implements normal (gaussian) model. More... | |
| class | msgbuf |
| Message accumulator for Search::report() - collects one progress message exactly as an std::ostringstream would, for delivery either to an attached Search_Observer or to the search's output stream. More... | |
| class | Regressor |
| abstract class, defines interface for Regressor implementations (mainly to be used in wrappers) More... | |
| class | Regressor_Ridge |
| Closed-form ridge regression (L2-regularized least squares) for wrapper-based feature selection. More... | |
| class | Regressor_Weighted_Neighbours |
| Implements experimental regressor that produces weighted average of the predicted variable over neighbours, weighted by distance. More... | |
| class | Result_Tracker |
| Abstract class, defines interface for classes that enable collecting multiple results. More... | |
| class | Result_Tracker_Dupless |
| Collects multiple results, avoiding duplicates. More... | |
| class | Result_Tracker_Feature_Stats |
| Collects evaluated subsets to eventually provide Dependency-Aware Feature Ranking coefficients. More... | |
| class | Result_Tracker_Regularizer |
| Collects multiple results. Enables eventual selection of alternative solution based on secondary criterion. More... | |
| class | Result_Tracker_Stability_Evaluator |
| Collects multiple results to evaluate various stability measures on the collection. More... | |
| class | Result_Weighter_Sampled |
| Online per-feature statistics for budgeted (sampled) sequential steps — discounted batch-standardized DAF contrast. More... | |
| class | Search |
| abstract class, defines interface for search method implementations More... | |
| class | Search_Branch_And_Bound |
| Implements Branch and Bound template method as basis for more advanced B&B implementations. More... | |
| class | Search_Branch_And_Bound_Basic |
| Implements Branch and Bound Basic method, i.e., with randomized node ordering. More... | |
| class | Search_Branch_And_Bound_Fast |
| Implements Fast Branch and Bound, i.e., B&B with full utilization of prediction mechanism. More... | |
| class | Search_Branch_And_Bound_Improved |
| Implements Improved Branch and Bound (IBB) method, i.e., with fully computed node ordering. More... | |
| class | Search_Branch_And_Bound_Improved_Threaded |
| DEPRECATED shim: threaded Improved Branch and Bound (IBB) method. More... | |
| class | Search_Branch_And_Bound_Partial_Prediction |
| Implements Branch and Bound with Partial Prediction (BBPP) method, i.e., with predicted node ordering. More... | |
| class | Search_DOS |
| Implements Dynamic_Oscillating_Search. More... | |
| class | Search_Exhaustive |
| Implements exhaustive (optimal) search yielding optimal feature subset with respect to chosen criterion. More... | |
| class | Search_Exhaustive_Threaded |
| DEPRECATED shim: threaded version of exhaustive (optimal) search. More... | |
| class | Search_Monte_Carlo |
| Repeatedly samples random subsets to eventually yield the one with highest criterion value. More... | |
| class | Search_Monte_Carlo_Threaded |
| DEPRECATED shim: threaded version of randomized search that repeatedly samples random subsets. More... | |
| class | Search_Observer |
| Observer interface for search progress reporting. More... | |
| class | Search_OS |
| Implements Oscillating_Search. More... | |
| class | Search_Ranking |
| Abstract base of the feature-ranking methods: scores features one by one, then turns the ranking into a feature subset. More... | |
| class | Search_Ranking_BIF |
| Implements Best Individual Features, i.e., individual feature ranking. More... | |
| class | Search_Ranking_BIF_Threaded |
| DEPRECATED shim: threaded Best Individual Features, i.e., individual feature ranking. More... | |
| class | Search_Sequential |
| Abstract class, defines interface for sequential search method implementations, provides common implementation of the "sequential step" operation. More... | |
| class | Search_SFFS |
| Implements Sequential_Forward_Floating_Search and Sequential_Backward_Floating_Search. More... | |
| class | Search_SFRS |
| Implements Sequential_Forward_Retreating_Search and Sequential_Backward_Retreating_Search. More... | |
| class | Search_SFS |
| Implements Sequential_Forward_Selection and Sequential_Backward_Selection. More... | |
| class | Sequential_Step |
| Abstract class, defines interface for implementations of one selection step in sequential search type of methods. More... | |
| class | Sequential_Step_Ensemble |
| Implements voting ensemble selection step in sequential search type of methods to possibly improve robustness and stability of feature selection result. More... | |
| class | Sequential_Step_Hybrid |
| Implements hybrid selection step in sequential search type of methods. More... | |
| class | Sequential_Step_Sampled |
| Implements the budgeted (sampled) sequential selection step: forward steps evaluate only a sampled batch of candidates, backward steps sweep in full unless a backward budget is set. More... | |
| class | Sequential_Step_Straight |
| Implements standard sequential selection step in sequential search type of methods. More... | |
| class | Sequential_Step_Straight_Threaded |
| DEPRECATED shim: threaded version of sequential selection step in sequential search type of methods. More... | |
| class | StopWatch |
| Simple stopwatch to measure run time of search algorithms. More... | |
| class | Subset |
| Stores the info on currently selected features, enables generating permutations, etc. More... | |
| class | syncout |
| Serializes textual reporting from concurrent threads. More... | |
| class | ThreadPool |
| Implements thread scheduler that assigns jobs up to maximum number of threads allowed. More... | |
Enumerations | |
| enum | DataPart { NONE =0 , TRAIN =1 , TEST =2 , TRAINTEST =4 , ALL =8 } |
| Selects which part of a split's data a block-access call reads. More... | |
| enum | CloneKind { CLONE_INHERIT , CLONE_THROW , CLONE_DEEP , CLONE_WEAK , CLONE_WEAK_SHARING , CLONE_TO_STATELESS } |
| How a Clonable_Impl slot (clone/sharing_clone/stateless_clone) is implemented. More... | |
| enum | OutputDetail { SILENT =0 , NORMAL =1 , DETAILED =2 } |
| search algorithms' output extent More... | |
| enum class | Wrapper_Metric { accuracy , balanced_accuracy , f1 , f1_macro , auc , r2 , neg_rmse , neg_mae } |
| enum | CriterionStatus { CRIT_NONEXISTENT =0 , CRIT_READY =1 } |
| Lifecycle state of a worker's thread-local criterion clone (see Candidate_Evaluator_Threaded::ThreadLocal). More... | |
| enum | SearchDirection { UNDEFINED =0 , FORWARD =1 , BACKWARD =2 } |
| Direction a sequential search proceeds in. More... | |
Functions | |
| template<class CONTAINER, typename IDXTYPE> | |
| std::ostream & | operator<< (std::ostream &os, const Data_Intervaller< CONTAINER, IDXTYPE > &ia) |
Streams every contained interval as "si:<startidx>, c:<count>" lines to os. | |
| template<typename DATATYPE> | |
| std::ostream & | operator<< (std::ostream &os, const Data_Scaler< DATATYPE > &ds) |
Streams a scaler's print() to os; the operator concrete scalers are actually printed through. | |
| template<class INTERVALCONTAINER, typename IDXTYPE> | |
| std::ostream & | operator<< (std::ostream &os, const Data_Splitter< INTERVALCONTAINER, IDXTYPE > &ds) |
Streams a splitter's print() to os. | |
| std::ostream & | operator<< (std::ostream &os, const Clonable &cl) |
Streams a clonable object's print() to os. | |
| template<class T> | |
| std::unique_ptr< T > | clone_unique (const T &src) |
| template<class T> | |
| std::unique_ptr< T > | sharing_clone_unique (const T &src) |
| sharing_clone() counterpart of clone_unique() – see its comment above. | |
| template<class T> | |
| std::unique_ptr< T > | stateless_clone_unique (const T &src) |
| stateless_clone() counterpart of clone_unique() – see its comment above. | |
| unsigned int & | _fst_rand_state () |
| LCG state, one instance per thread; each thread starts from the default state 1. | |
| void | fst_srand (unsigned int seed) |
| Seeds the calling thread's FST4 PRNG; use instead of std::srand(). | |
| int | fst_rand () |
| Returns the next pseudo-random draw in 0..FST_RAND_MAX; use instead of std::rand(). | |
| unsigned long | fst_rand_below (const unsigned long n) |
| Returns a pseudo-random index in 0..n-1 (n >= 1); use instead of fst_rand()n. | |
| void | notify (const std::string msg) |
Prints msg followed by a newline via syncout::print(); a no-op unless the preprocessor macro DEBUG is defined at compile time. Used throughout FST4 for lightweight diagnostic tracing. | |
| void | notify (const std::string msg1, const double num, const std::string msg2="") |
Prints msg1, num and msg2 concatenated, DEBUG builds only (see notify(const std::string)). | |
| void | notify (const std::string msg1, const double num1, const std::string msg2, const double num2, const std::string msg3="") |
Prints msg1, num1, msg2, num2, msg3 concatenated, DEBUG builds only (see notify(const std::string)). | |
| void | notify (const std::string msg1, const double num1, const std::string msg2, const double num2, const std::string msg3, const double num3, const std::string msg4="") |
Prints msg1, num1, msg2, num2, msg3, num3, msg4 concatenated, DEBUG builds only (see notify(const std::string)). | |
| template<typename VALUE> | |
| VALUE | maxf (const VALUE &x, const VALUE &y) |
Returns the greater of x and y (strict '>' comparison; ties return y). | |
| template<typename VALUE> | |
| VALUE | minf (const VALUE &x, const VALUE &y) |
Returns the smaller of x and y (strict '<' comparison; ties return y). | |
| template<class BINTYPE, typename DIMTYPE> | |
| std::ostream & | operator<< (std::ostream &os, const Subset< BINTYPE, DIMTYPE > &tdb) |
Streams a subset's size and selected feature indices to os, e.g. "Subset<n=20, d=3>: 2 5 11". The listed indices are those with a positive raw marker, so in backward mode they are the DEselected ones. In builds compiled with the DEBUG macro defined, the raw marker array is dumped before the index list (separated by " ~ "), which makes such output differ from a release build's. | |
| template<typename REALTYPE, typename IDXTYPE, typename DIMTYPE, class DATAACCESSOR, class AFTERPATTERN> | |
| std::size_t | standardize_design (const std::shared_ptr< DATAACCESSOR > &da, const DIMTYPE classes, const std::size_t d, const std::size_t zstride, const std::vector< DIMTYPE > &index, std::vector< REALTYPE > &Z, std::vector< REALTYPE > &mean, std::vector< REALTYPE > &scale, AFTERPATTERN after_pattern) |
| template<typename REALTYPE> | |
| bool | cholesky_factor (std::vector< REALTYPE > &A, const std::size_t m) |
| template<typename REALTYPE> | |
| void | cholesky_solve (const std::vector< REALTYPE > &A, const std::size_t m, const REALTYPE *rhs, const bool negate_rhs, REALTYPE *out) |
| std::mutex & | extern_spawn_mutex () |
| template<typename DATATYPE, typename DIMTYPE, class SUBSET> | |
| std::ostream & | operator<< (std::ostream &os, const Indexed_Matrix< DATATYPE, DIMTYPE, SUBSET > &mr) |
Debug dump: writes mr's active index map and its narrowed get_d() x get_d() sub-matrix to os. The printed data rows apply the _index map (mr._index[i]/mr._index[j]), so what is printed is genuinely the narrow_to()'d sub-matrix, not a raw prefix – the same convention as Indexed_Vector's operator<<. | |
| template<typename DATATYPE, typename DIMTYPE, class SUBSET> | |
| std::ostream & | operator<< (std::ostream &os, const Indexed_Vector< DATATYPE, DIMTYPE, SUBSET > &tdb) |
Debug dump: writes tdb's active index map and its narrowed get_d()-dimensional sub-vector to os. | |
| const char * | wrapper_metric_name (const Wrapper_Metric m) |
Returns the canonical CLI name (--wrapper-metric value) for m, e.g. "balanced-accuracy"; the inverse of wrapper_metric_from_name(). | |
| bool | wrapper_metric_from_name (const std::string &name, Wrapper_Metric &m) |
Parses a CLI metric name (--wrapper-metric value, e.g. "f1-macro") into m. | |
| template<typename RETURNTYPE, typename DIMTYPE> | |
| bool | metric_from_confusion (RETURNTYPE &result, const Wrapper_Metric metric, const std::vector< RETURNTYPE > &confusion, const DIMTYPE classes, const std::vector< RETURNTYPE > &class_weights, const DIMTYPE f1_positive=1) |
| template<typename RETURNTYPE, typename DIMTYPE> | |
| bool | auc_from_scores (RETURNTYPE &result, std::vector< std::pair< RETURNTYPE, DIMTYPE > > &scores) |
| template<typename RETURNTYPE, typename DIMTYPE> | |
| bool | auc_macro_from_scores (RETURNTYPE &result, const std::vector< RETURNTYPE > &scores, const std::vector< DIMTYPE > &labels, const DIMTYPE classes) |
| template<typename RETURNTYPE> | |
| bool | metric_from_predictions (RETURNTYPE &result, const Wrapper_Metric metric, const std::vector< std::pair< RETURNTYPE, RETURNTYPE > > &pairs) |
| template<class RETURNTYPE, typename DIMTYPE> | |
| std::ostream & | operator<< (std::ostream &os, const Branch_And_Bound_Predictor< RETURNTYPE, DIMTYPE > &babp) |
Streams a predictor's print() (implementation-defined diagnostic state) to os. | |
| template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION> | |
| std::ostream & | operator<< (std::ostream &os, const Candidate_Evaluator< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > &ce) |
Streams an engine's print() to os. | |
| template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION> | |
| std::ostream & | operator<< (std::ostream &os, const Search< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > &sr) |
Streams a search's print() to os. | |
| template<class RETURNTYPE, typename DIMTYPE, class SUBSET, class CRITERION> | |
| std::ostream & | operator<< (std::ostream &os, const Sequential_Step< RETURNTYPE, DIMTYPE, SUBSET, CRITERION > &ss) |
Streams a selection step's print() to os. | |
| std::ostream & | operator<< (std::ostream &os, const StopWatch &sw) |
Streams a StopWatch's print() (formatted elapsed time) to os. | |
Variables | |
| const int | FST_RAND_MAX = 32767 |
| Maximum value fst_rand() can return; use instead of the libc macro RAND_MAX. | |
The Feature Selection Toolbox 4 library: every library component – data access, criteria and classifiers, search algorithms, result trackers and the global infrastructure – lives in this namespace.
Application code refers to it by explicit qualification; the fst4 command-line tool keeps its own types apart in namespace fst4_cli.
| enum FST::CloneKind |
How a Clonable_Impl slot (clone/sharing_clone/stateless_clone) is implemented.
| Enumerator | |
|---|---|
| CLONE_INHERIT | do not add behavior; defer to the Base class body (typically a family-level throwing default) |
| CLONE_THROW | throw fst_error (for classes whose Base has no default body to defer to) |
| CLONE_DEEP | new Derived(*this), then set_cloned() |
| CLONE_WEAK | new Derived(*this,0) via the weak/referencing copy-constructor, then set_cloned() |
| CLONE_WEAK_SHARING | new Derived(*this,0) via the weak/referencing copy-constructor, then set_sharing_cloned() |
| CLONE_TO_STATELESS | forward to stateless_clone() (Classifier_LIBSVM contract) |
| enum FST::CriterionStatus |
Lifecycle state of a worker's thread-local criterion clone (see Candidate_Evaluator_Threaded::ThreadLocal).
| Enumerator | |
|---|---|
| CRIT_NONEXISTENT | no clone allocated yet for this worker slot |
| CRIT_READY | a clone exists and is not currently evaluating |
| enum FST::DataPart |
Selects which part of a split's data a block-access call reads.
| enum FST::OutputDetail |
| enum FST::SearchDirection |
Direction a sequential search proceeds in.
FORWARD searches grow the subset (SFS, SFFS, SFRS, and the up-swing half of OS/DOS); BACKWARD searches shrink it (SBS, SBFS, SBRS, down-swings). UNDEFINED is only the pre-construction placeholder and is never a valid argument to set_search_direction().
|
strong |
Metric selector for wrapper criteria and validation reporting. All metrics are higher-is-better (search maximizes). accuracy (the default, with empty class_weights) is served directly by Classifier::test()/Regressor::test() — the metric machinery below is bypassed entirely on that path.
| Enumerator | |
|---|---|
| accuracy | classification: fraction correct (cost-weighted if class_weights set) |
| balanced_accuracy | classification: macro-averaged recall (classes absent from the test part are skipped) |
| f1 | classification, two-class data: F1 of the positive class, which is Metric_Spec::f1_positive (class index 1 unless set otherwise) |
| f1_macro | classification: unweighted mean of per-class one-vs-rest F1 (0/0 contributes 0) |
| auc | classification: two-class data = area under the ROC curve (exact rank statistic, midrank ties); K>2 = one-vs-rest macro (mean of per-class binary AUCs; classes absent from the test part are skipped) |
| r2 | regression: coefficient of determination (SS_tot around the test-part mean) |
| neg_rmse | regression: negated root-mean-square prediction error |
| neg_mae | regression: negated mean absolute prediction error |
|
inline |
LCG state, one instance per thread; each thread starts from the default state 1.
Every random draw the FST4 library makes goes through fst_rand()/fst_srand() rather than the C library rand()/srand(). The reason is reproducibility: the libc generator is a different algorithm on every platform (Windows UCRT: 32-bit LCG with 15-bit output; macOS libc: minstd Lehmer; glibc: additive feedback generator), so the same seed would produce different data splits and different search trajectories on each of them.
fst_rand() is a fixed 32-bit linear congruential generator with 15-bit output, identical in every build. The guarantee it provides: a given seed yields the same sequence of draws – and therefore the same randomized splits, the same Monte Carlo samples and the same search result – on every platform and with every supported compiler.
Contract:
| bool FST::auc_from_scores | ( | RETURNTYPE & | result, |
| std::vector< std::pair< RETURNTYPE, DIMTYPE > > & | scores ) |
computes the exact two-class AUC (Mann-Whitney rank statistic with midrank tie handling) from per-sample (score, true class in {0,1}) pairs; class 1 is the positive class and higher scores must indicate class 1. Deterministic: a stable sort on the score keeps the caller's (deterministic) sample enumeration order within tie groups, and tie groups share their midrank, so the value is a pure function of (scores, labels). Returns false when either class is absent (AUC undefined) — callers treat that as "skip this split". Reorders the input vector.
| bool FST::auc_macro_from_scores | ( | RETURNTYPE & | result, |
| const std::vector< RETURNTYPE > & | scores, | ||
| const std::vector< DIMTYPE > & | labels, | ||
| const DIMTYPE | classes ) |
computes the one-vs-rest macro AUC on multiclass data: the unweighted mean over classes of the exact two-class AUC (the auc_from_scores midrank rule) computed from the class's own score column against the rest. Classes absent from the test part have undefined AUC and are skipped — the balanced-accuracy convention; returns false when no class yields a defined AUC. scores = row-major samples x classes matrix (sample i, class c at scores[i*classes+c]); labels = true class indices, same sample order.
| bool FST::cholesky_factor | ( | std::vector< REALTYPE > & | A, |
| const std::size_t | m ) |
In-place lower-Cholesky factorization of the row-major m×m SPD matrix A (upper triangle left untouched). Returns false when a pivot is not strictly positive finite — callers either fail the training or retry with an escalated ridge (in-place factoring destroys A, so retries reassemble).
| void FST::cholesky_solve | ( | const std::vector< REALTYPE > & | A, |
| const std::size_t | m, | ||
| const REALTYPE * | rhs, | ||
| const bool | negate_rhs, | ||
| REALTYPE * | out ) |
Solves L L^T out = rhs (or = -rhs with negate_rhs) by forward and back substitution using the factor left in A by cholesky_factor(). out must be pre-sized to m; rhs and out may not alias.
| std::unique_ptr< T > FST::clone_unique | ( | const T & | src | ) |
unique_ptr-returning clone helpers preserving the argument's static type. Replace the covariant raw-pointer idiom 'shared_ptr<T> p(x->clone())' with 'p=clone_unique(*x)'; the static_cast is safe because the dynamic type of a clone is the dynamic type of its source, which is at least T.
|
inline |
process-wide spawn serialization for the extern bridges (shared across all users and template instantiations; the function-local static avoids header ODR issues)
|
inline |
Returns a pseudo-random index in 0..n-1 (n >= 1); use instead of fst_rand()n.
For n <= 32768 this is exactly fst_rand()n – one draw, so the sequences of every seeded run over ranges that size stay what they always were. For wider ranges two draws are composed into a 30-bit value (the first draw supplies the high 15 bits), so every index below n is reachable; a bare fst_rand()n never exceeds 32767 and would silently confine random feature subsets, random sample draws and warm-up probes to the first 32768 indexes. The modulo is slightly biased in both regimes, as it always was; n beyond 2^30 is not supported (FST4 dimensionalities and class sizes are far smaller).
|
inline |
Returns the greater of x and y (strict '>' comparison; ties return y).
| x | first value |
| y | second value |
| bool FST::metric_from_confusion | ( | RETURNTYPE & | result, |
| const Wrapper_Metric | metric, | ||
| const std::vector< RETURNTYPE > & | confusion, | ||
| const DIMTYPE | classes, | ||
| const std::vector< RETURNTYPE > & | class_weights, | ||
| const DIMTYPE | f1_positive = 1 ) |
computes a classification metric from a classes*classes confusion matrix (row-major, row = true class, column = predicted class). Returns false when the metric is undefined on this matrix (e.g. no test samples, or balanced accuracy with every class absent) — callers treat that as "skip this split".
| bool FST::metric_from_predictions | ( | RETURNTYPE & | result, |
| const Wrapper_Metric | metric, | ||
| const std::vector< std::pair< RETURNTYPE, RETURNTYPE > > & | pairs ) |
computes a regression metric from per-sample (true value, prediction) pairs. r2 uses SS_tot around the test-part mean; returns false when undefined (no samples, or r2 with zero total variance).
|
inline |
Returns the smaller of x and y (strict '<' comparison; ties return y).
| x | first value |
| y | second value |
|
inline |
Prints msg followed by a newline via syncout::print(); a no-op unless the preprocessor macro DEBUG is defined at compile time. Used throughout FST4 for lightweight diagnostic tracing.
| msg | the diagnostic message to print |
|
inline |
Prints msg1, num and msg2 concatenated, DEBUG builds only (see notify(const std::string)).
| msg1 | leading message text |
| num | a numeric value interleaved with the message text |
| msg2 | optional trailing message text (defaults to empty) |
|
inline |
Prints msg1, num1, msg2, num2, msg3, num3, msg4 concatenated, DEBUG builds only (see notify(const std::string)).
| msg1 | leading message text |
| num1 | first numeric value |
| msg2 | message text between the first and second numeric values |
| num2 | second numeric value |
| msg3 | message text between the second and third numeric values |
| num3 | third numeric value |
| msg4 | optional trailing message text (defaults to empty) |
|
inline |
Prints msg1, num1, msg2, num2, msg3 concatenated, DEBUG builds only (see notify(const std::string)).
| msg1 | leading message text |
| num1 | first numeric value |
| msg2 | message text between the two numeric values |
| num2 | second numeric value |
| msg3 | optional trailing message text (defaults to empty) |
| std::ostream & FST::operator<< | ( | std::ostream & | os, |
| const Data_Scaler< DATATYPE > & | ds ) |
Streams a scaler's print() to os; the operator concrete scalers are actually printed through.
Streams a scaler's print() to os.
| std::ostream & FST::operator<< | ( | std::ostream & | os, |
| const Indexed_Matrix< DATATYPE, DIMTYPE, SUBSET > & | mr ) |
Debug dump: writes mr's active index map and its narrowed get_d() x get_d() sub-matrix to os. The printed data rows apply the _index map (mr._index[i]/mr._index[j]), so what is printed is genuinely the narrow_to()'d sub-matrix, not a raw prefix – the same convention as Indexed_Vector's operator<<.
grants operator<< access to print this object's contents (see the out-of-class definition below)
| std::ostream & FST::operator<< | ( | std::ostream & | os, |
| const Indexed_Vector< DATATYPE, DIMTYPE, SUBSET > & | tdb ) |
Debug dump: writes tdb's active index map and its narrowed get_d()-dimensional sub-vector to os.
grants operator<< access to print this object's contents (see the out-of-class definition below)
| std::ostream & FST::operator<< | ( | std::ostream & | os, |
| const Subset< BINTYPE, DIMTYPE > & | tdb ) |
Streams a subset's size and selected feature indices to os, e.g. "Subset<n=20, d=3>: 2 5 11". The listed indices are those with a positive raw marker, so in backward mode they are the DEselected ones. In builds compiled with the DEBUG macro defined, the raw marker array is dumped before the index list (separated by " ~ "), which makes such output differ from a release build's.
Streams a subset's selected features to os (as its print(), see the .cpp-side definition).
| std::size_t FST::standardize_design | ( | const std::shared_ptr< DATAACCESSOR > & | da, |
| const DIMTYPE | classes, | ||
| const std::size_t | d, | ||
| const std::size_t | zstride, | ||
| const std::vector< DIMTYPE > & | index, | ||
| std::vector< REALTYPE > & | Z, | ||
| std::vector< REALTYPE > & | mean, | ||
| std::vector< REALTYPE > & | scale, | ||
| AFTERPATTERN | after_pattern ) |
Builds the internally-standardized training design matrix shared by the dependency-free dense trainers (logreg, linear SVM, RBF SVM, ridge).
One pass walks classes 0..classes-1 over the TRAIN blocks of the data accessor's CURRENT split - the TEST blocks are never read - pushing the d selected raw feature values of each pattern into Z while accumulating the standardization moments, then calling after_pattern(pat,c) so the caller can append its own per-pattern payload. A second pass finalizes the moments (a constant feature gets scale 1 and thus stays inert) and standardizes Z in place to zero mean and unit variance.
| da | data accessor, already positioned on the split to train from |
| classes | number of classes to walk (typically da->getNoOfClasses()) |
| d | number of selected features = number of feature values written per pattern |
| zstride | row stride of Z: d when the caller appends nothing, d+1 when it appends one value per pattern (e.g. a constant bias coordinate), and correspondingly more for a larger payload. after_pattern() MUST push exactly zstride-d values into Z, otherwise the rows go out of step. |
| index | subset position -> raw feature index; its first d entries are read |
| Z | output design matrix, cleared first, N rows of zstride values, row-major |
| mean | output per-subset-position standardization shift, d entries |
| scale | output per-subset-position standardization scale, d entries (1 where the feature is constant) |
| after_pattern | callback invoked as after_pattern(pat,c) once per pattern, right after that pattern's d feature values have been pushed; pat points at the pattern's raw (unstandardized) feature vector and c is its class |
|
inline |
Parses a CLI metric name (--wrapper-metric value, e.g. "f1-macro") into m.
m unchanged if name is not a recognized metric name.