1#ifndef FSTCRITERIONSUMOFWEIGHTS_H
2#define FSTCRITERIONSUMOFWEIGHTS_H
96template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET>
97class Criterion_Sum_Of_Weights :
public Clonable_Impl<Criterion_Sum_Of_Weights<RETURNTYPE,DIMTYPE,SUBSET>,Criterion<RETURNTYPE,SUBSET> > {
102 Criterion_Sum_Of_Weights() :
_noofweights(0) {
notify(
"Criterion_Sum_Of_Weights constructor.");}
113 virtual void initialize(
const DIMTYPE noofweights,
const RETURNTYPE weights[]);
122 virtual std::ostream&
print(std::ostream& os)
const override {os <<
"Criterion_Sum_Of_Weights()";
return os;}
126 Criterion_Sum_Of_Weights(
const Criterion_Sum_Of_Weights& css);
132template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET>
133Criterion_Sum_Of_Weights<RETURNTYPE,DIMTYPE,SUBSET>::Criterion_Sum_Of_Weights(
const Criterion_Sum_Of_Weights& css) :
136 notify(
"Criterion_Sum_Of_Weights copy-constructor.");
145template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET>
148 assert(noofweights>0);
156template<
class RETURNTYPE,
typename DIMTYPE,
class SUBSET>
164 for(DIMTYPE fidx : sub->selected_features()) result+=
_weights.get()[fidx];
CRTP mixin implementing the Clonable protocol for a concrete class.
Definition clonable.hpp:184
Returns sum of pre-specified feature weights for features in the evaluated subset.
Definition criterion_sumofweights.hpp:97
DIMTYPE _noofweights
number of entries in _weights; must equal the evaluated subset's get_n()
Definition criterion_sumofweights.hpp:129
std::shared_ptr< SUBSET > PSubset
shared pointer to the feature subset being evaluated
Definition criterion_sumofweights.hpp:100
virtual std::ostream & print(std::ostream &os) const override
writes a human-readable identification of the object; base default writes nothing
Definition criterion_sumofweights.hpp:122
std::shared_ptr< RETURNTYPE > PWeights
shared pointer to a raw array of noofweights per-feature weights
Definition criterion_sumofweights.hpp:101
PWeights _weights
per-feature weights, indexed by raw feature index (size _noofweights)
Definition criterion_sumofweights.hpp:128
Clonable_Impl< Criterion_Sum_Of_Weights, Criterion< RETURNTYPE, SUBSET > > parent_impl
implements clone(); sharing/stateless_clone throw in Criterion
Definition criterion_sumofweights.hpp:99
virtual void initialize(const DIMTYPE noofweights, const PWeights weights)
Adopts an existing weight array: SHARES ownership with the caller, nothing is copied.
Definition criterion_sumofweights.hpp:110
virtual bool evaluate(RETURNTYPE &result, const PSubset sub) override
Sums up the weights of the features selected in sub; always returns true. Weights are indexed by RAW ...
Definition criterion_sumofweights.hpp:157
Defines interface for feature selection criterion classes.
FST4 specific error passing class.
The Feature Selection Toolbox 4 library: every library component – data access, criteria and classifi...
Definition data_accessor.hpp:80
void notify(const std::string msg)
Prints msg followed by a newline via syncout::print(); a no-op unless the preprocessor macro DEBUG is...
Definition global.hpp:112