Template Class Learner

Class Documentation

template<typename ModelType, typename PredictionType>
class genif::Learner

Provides a standardized interface for learning algorithms.

Public Functions

Learner<ModelType, PredictionType> &fit(const MatrixX &dataset)

Fits the learner using a given dataset. Classes implementing this method should assign the learned model to themselves, which can then be retrieved using the getModel() method.

Return

A reference to the learner.

Parameters
  • dataset: The dataset, which should be used for fitting.

PredictionType fitPredict(const MatrixX &dataset)

Fits the learner using a given dataset and returns predictions based on it. Classes implementing this method should assign the learned model to themselves, which can then be retrieved using the getModel() method.

The behaviour of this method should be equal to running the fit() and the predict() method.

Return

Predictions, which were made by using the dataset. The actual type of prediction, which is made, is determined by the PredictionType template parameter.

Parameters
  • dataset: The dataset, which should be used for fitting and predicting.

PredictionType predict(const MatrixX &dataset) const

Make predictions using a priorly fitted model and a given dataset. Classes implementing this method should use the same model, which is given by the getModel() method and which is usually found by invoking the fit() method.

Return

Predictions, which were made by using the dataset. The actual type of prediction, which is made, is determined by the PredictionType template parameter.

Parameters
  • dataset: The dataset, which should be used for predicting.

PredictionType predict(const MatrixX &dataset, const ModelType &model) const

Make predictions using a priorly fitted model and a given dataset. Classes implementing this method should use the same model, which is given by the getModel() method and which is usually found by invoking the fit() method.

Return

Predictions, which were made by using the dataset. The actual type of prediction, which is made, is determined by the PredictionType template parameter.

Parameters
  • dataset: The dataset, which should be used for predicting.

  • model: The fitted model.

ModelType getModel() const

Returns the currently fitted model.

Return

The currently fitted model. The actual type of model, which is returned by this method, is determined by the ModelType template parameter.

std::unique_ptr<Learner<ModelType, PredictionType>> copy() const

Takes a copy of the learner and returns it.

Return

Non-const copy of the learner.

~Learner() = default

Learners destructor.