1#ifndef FSTCANDIDATEEVALUATOR_H
2#define FSTCANDIDATEEVALUATOR_H
85template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET,
class CRITERION>
97 typedef std::function<void(
const int,
const unsigned long long,
const RETURNTYPE,
const PSubset&)>
BestCallback;
126 virtual std::ostream&
print(std::ostream& os)
const {
return os;}
145template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET,
class CRITERION>
Abstract candidate-evaluation strategy (sequential-inline vs. thread-pooled).
Definition candidate_evaluator.hpp:86
virtual bool collect()=0
completes the batch (threaded: waits for the workers, fires the pending per-result callbacks in add-o...
std::function< void(const RETURNTYPE, const PSubset &, const DIMTYPE)> ResultCallback
fired once per evaluated batch candidate: (criterion value, candidate, feature tag as passed to add_c...
Definition candidate_evaluator.hpp:94
virtual unsigned int get_max_threads() const =0
1 in the sequential implementation
std::shared_ptr< Result_Tracker< RETURNTYPE, SUBSET > > PResultTracker
Definition candidate_evaluator.hpp:90
virtual std::ostream & print(std::ostream &os) const
writes a human-readable identification of the engine; base default writes nothing
Definition candidate_evaluator.hpp:126
std::function< bool(SUBSET &)> Generator
fills sub with the next candidate, returns false when no candidate remains (in the threaded implement...
Definition candidate_evaluator.hpp:92
std::shared_ptr< CRITERION > PCriterion
shared pointer to the criterion this engine evaluates candidates against
Definition candidate_evaluator.hpp:88
virtual void invalidate_clones()
Drops any cached per-worker criterion clones, so that the next batch or stream re-clones from the cri...
Definition candidate_evaluator.hpp:141
std::function< bool(const RETURNTYPE, const PSubset &, const RETURNTYPE, const PSubset &)> BetterPredicate
returns true if (value,subset) is better than (best value,best subset) - encodes per-search tie-break...
Definition candidate_evaluator.hpp:99
virtual bool evaluate_stream(Generator generator, const PCriterion &crit, const PResultTracker tracker, BetterPredicate better, BestCallback on_best, RETURNTYPE &result, const PSubset bestsub)=0
Evaluates candidates produced by generator until it reports exhaustion, keeping the best one.
virtual bool add_candidate(const PSubset &sub, const DIMTYPE feature=0)=0
adds one candidate to the current batch; sub is copied, feature is an opaque tag handed back by the c...
std::function< void(const int, const unsigned long long, const RETURNTYPE, const PSubset &)> BestCallback
Definition candidate_evaluator.hpp:97
virtual bool getBestResult(RETURNTYPE &result, PSubset &sub, DIMTYPE &feature)=0
completes the batch first, then hands out its best candidate (sub is set to the engine's own subset o...
std::shared_ptr< SUBSET > PSubset
shared pointer to a candidate feature subset
Definition candidate_evaluator.hpp:89
virtual void initialize(const PCriterion &crit, const DIMTYPE max_candidates, ResultCallback on_result=ResultCallback())=0
starts a new batch; max_candidates must bound the number of add_candidate() calls to follow
virtual bool is_threaded() const =0
true for the threaded engine (any --threads value), false for the sequential one – distinguishes the ...
FST4 specific error passing class.
The Feature Selection Toolbox 4 library: every library component – data access, criteria and classifi...
Definition data_accessor.hpp:80
std::ostream & operator<<(std::ostream &os, const Data_Intervaller< CONTAINER, IDXTYPE > &ia)
Streams every contained interval as "si:<startidx>, c:<count>" lines to os.
Definition data_intervaller.hpp:152
Defines interface for classes that enable collecting multiple results.