Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::src::class_oracle_adaptor< O > Class Template Referencefinal

#include <oracle.h>

Inheritance diagram for ultra::src::class_oracle_adaptor< O >:
ultra::src::basic_class_oracle ultra::src::basic_oracle

Public Member Functions

 class_oracle_adaptor (O, std::vector< std::string >={})
bool is_valid () const override
classification_result tag (const std::vector< value_t > &) const override
Public Member Functions inherited from ultra::src::basic_class_oracle
value_t operator() (const std::vector< value_t > &) const final
 Returns the predicted class label.
std::string name (const value_t &) const final
 Returns the class name, falling back to a numeric name for unknown IDs.

Additional Inherited Members

Protected Member Functions inherited from ultra::src::basic_class_oracle
 basic_class_oracle (std::vector< std::string >={})
bool load_names (std::istream &)
 Loads the class names, accepting a zero count for omitted names.
bool save_names (std::ostream &) const
 Saves a count followed by one class name per line.
Static Protected Member Functions inherited from ultra::src::basic_class_oracle
static std::vector< std::string > class_names (const dataframe &)
 Collects the class names from the training set.

Detailed Description

template<ClassificationPredictor O>
class ultra::src::class_oracle_adaptor< O >

Adapts a classification predictor to the basic_oracle interface.

Template Parameters
Opredictor type

This adaptor allows any user-defined classification predictor to be used wherever a basic_oracle is required, without inheritance or dynamic polymorphism.

The wrapped predictor must satisfy ClassificationPredictor; the numeric output is derived from tag() by returning the predicted class label.

Note
The adaptor is intentionally non-serializable.

Constructor & Destructor Documentation

◆ class_oracle_adaptor()

template<ClassificationPredictor O>
class_oracle_adaptor::class_oracle_adaptor ( O oracle,
std::vector< std::string > names = {} )
explicit
Parameters
[in]oraclepredictor instance to adapt
[in]namesoptional class names used for human-readable output

Member Function Documentation

◆ is_valid()

template<ClassificationPredictor O>
bool ultra::src::class_oracle_adaptor< O >::is_valid ( ) const
inlinenodiscardoverridevirtual

This adaptor does not impose additional validity constraints beyond those of the underlying predictor, therefore it always returns true.

Implements ultra::src::basic_oracle.

◆ tag()

template<ClassificationPredictor O>
classification_result class_oracle_adaptor::tag ( const std::vector< value_t > & x) const
nodiscardoverridevirtual

Returns the classification result for the input example.

Parameters
[in]xinput example
Returns
predicted class label and confidence

This function forwards the call to the underlying predictor.

Implements ultra::src::basic_oracle.


The documentation for this class was generated from the following files: