abstract class, defines interface for Regressor implementations (mainly to be used in wrappers) More...
#include <regressor.hpp>
Public Member Functions | |
| virtual bool | predict (RETURNTYPE &depvar, const PPattern &pattern)=0 |
Predicts the dependent variable of one pattern into depvar (see the dependent-variable convention in the class documentation). Returns false when no prediction can be made at all - the regressor has not been trained, or the implementation hit an unrecoverable condition; false aborts the enclosing test loop. | |
| virtual bool | train (const PDataAccessor da, const PSubset sub)=0 |
| virtual bool | test (RETURNTYPE &result, const PDataAccessor da)=0 |
| Scores the designated test data with the regressor's own default measure, oriented higher-is-better (a hit rate under the class-label convention, a negated prediction error otherwise). Returns false if the test part is empty or predict() failed. | |
| virtual bool | test_metric (RETURNTYPE &result, const PDataAccessor da, const Metric_Spec< RETURNTYPE > &spec) |
| Regressor * | clone () const override=0 |
| Regressor * | sharing_clone () const override |
| Regressor * | stateless_clone () const override |
| Public Member Functions inherited from FST::Clonable | |
| bool | is_clone () const |
| bool | is_sharing () const |
| true if this instance is a sharing_clone() result (referencing, not owning, the source's structures) | |
| bool | is_sharing_clone () const |
| true if this instance is BOTH a clone and sharing – i.e. specifically a sharing_clone() result, not a clone()/stateless_clone() one | |
| virtual std::ostream & | print (std::ostream &os) const |
| writes a human-readable identification of the object; base default writes nothing | |
Additional Inherited Members | |
| Protected Member Functions inherited from FST::Clonable | |
| void | set_cloned (const bool cloned=true) |
| marks/unmarks this instance as a clone; call from clone()/stateless_clone() overrides (Clonable_Impl does this automatically) | |
| void | set_sharing (const bool sharing=true) |
| marks/unmarks this instance as sharing (see is_sharing()) | |
| void | set_sharing_cloned (const bool cloned=true, const bool sharing=true) |
| sets both flags at once; call from sharing_clone() overrides (Clonable_Impl does this automatically) | |
abstract class, defines interface for Regressor implementations (mainly to be used in wrappers)
The counterpart of Classifier for the regression pipeline; the same lifecycle applies - train() first, then test*()/predict(), with a data accessor exposing the same features in the same order. Two regressors are shipped: Regressor_Weighted_Neighbours (distance-weighted nearest neighbours) and Regressor_Ridge (closed-form L2-regularized least squares).
|
overridepure virtual |
create 1:1 independent clone of the current object. The caller owns the returned object. Families that cannot support a given clone kind implement it to throw fst_error; Clonable_Impl's CLONE_INHERIT slot defers to such a body.
Implements FST::Clonable.
Implemented in FST::Clonable_Impl< Regressor_Ridge< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >, Regressor< RETURNTYPE, DIMTYPE, SUBSET, DATAACCESSOR > >, and FST::Clonable_Impl< Regressor_Weighted_Neighbours< RETURNTYPE, DATATYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR, DISTANCE >, Regressor< RETURNTYPE, DIMTYPE, SUBSET, DATAACCESSOR > >.
|
pure virtual |
Predicts the dependent variable of one pattern into depvar (see the dependent-variable convention in the class documentation). Returns false when no prediction can be made at all - the regressor has not been trained, or the implementation hit an unrecoverable condition; false aborts the enclosing test loop.
Implemented in FST::Regressor_Ridge< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >, and FST::Regressor_Weighted_Neighbours< RETURNTYPE, DATATYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR, DISTANCE >.
|
inlineoverridevirtual |
create equivalent clone of the current object, permitting read-only access to structures in the source object (allows referencing instead of copying of large memory structures). may be faster and save space but requires more caution with respect to concurrency Use example: Data_Accessor memory data representation cloning
Implements FST::Clonable.
|
inlineoverridevirtual |
create clone of the current object, ignoring internal temporary structures to save speed. Does not replicate exact object state. The clone must be used carefully in a way that ensures internal structure re-initialization Use example: Data_Splitter cloning or Classifier_LIBSVM cloning due to inability to clone external structures defined in LibSVM
Implements FST::Clonable.
|
pure virtual |
Scores the designated test data with the regressor's own default measure, oriented higher-is-better (a hit rate under the class-label convention, a negated prediction error otherwise). Returns false if the test part is empty or predict() failed.
Implemented in FST::Regressor_Ridge< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >, and FST::Regressor_Weighted_Neighbours< RETURNTYPE, DATATYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR, DISTANCE >.
|
inlinevirtual |
evaluates the designated test data under the given regression metric (r2/neg-rmse/neg-mae); the default spec is served by test() itself. Classification metrics do not apply to a regression stack and make this return false. The dependent-variable convention is the concrete regressor's - see the class documentation.
Reimplemented in FST::Regressor_Ridge< RETURNTYPE, DATATYPE, REALTYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR >, and FST::Regressor_Weighted_Neighbours< RETURNTYPE, DATATYPE, IDXTYPE, DIMTYPE, SUBSET, DATAACCESSOR, DISTANCE >.
|
pure virtual |
learns from designated training part of data