hops
ModelWrapper.hpp
Go to the documentation of this file.
1 #ifndef HOPS_MODELWRAPPER_HPP
2 #define HOPS_MODELWRAPPER_HPP
3 
4 #include <hops/Model/Model.hpp>
5 
6 namespace hops {
7 
11  class ModelWrapper {
12  public:
13  explicit ModelWrapper(std::shared_ptr<Model> model) : model(std::move(model)) {}
14 
18  [[nodiscard]] virtual MatrixType::Scalar computeNegativeLogLikelihood(const VectorType &state) {
19  return model->computeNegativeLogLikelihood(state);
20  }
21 
25  [[nodiscard]] virtual std::optional<VectorType> computeLogLikelihoodGradient(const VectorType &state) {
26  return model->computeLogLikelihoodGradient(state);
27  }
28 
32  [[nodiscard]] virtual std::optional<MatrixType> computeExpectedFisherInformation(const VectorType &state) {
33  return model->computeExpectedFisherInformation(state);
34  }
35 
36  [[nodiscard]] const std::shared_ptr<Model> &getModel() const {
37  return model;
38  }
39 
40  void setModel(const std::shared_ptr<Model> &newModel) {
41  ModelWrapper::model = newModel;
42  }
43 
44  bool hasModel() {
45  return model != nullptr;
46  }
47 
48  private:
49  std::shared_ptr<Model> model;
50  };
51 }
52 
53 #endif //HOPS_MODELWRAPPER_HPP
hops::ModelWrapper
Definition: ModelWrapper.hpp:11
hops::ModelWrapper::hasModel
bool hasModel()
Definition: ModelWrapper.hpp:44
hops::ModelWrapper::computeNegativeLogLikelihood
virtual MatrixType::Scalar computeNegativeLogLikelihood(const VectorType &state)
Definition: ModelWrapper.hpp:18
hops::ModelWrapper::ModelWrapper
ModelWrapper(std::shared_ptr< Model > model)
Definition: ModelWrapper.hpp:13
hops::ModelWrapper::getModel
const std::shared_ptr< Model > & getModel() const
Definition: ModelWrapper.hpp:36
hops::ModelWrapper::setModel
void setModel(const std::shared_ptr< Model > &newModel)
Definition: ModelWrapper.hpp:40
Model.hpp
hops
Definition: CsvReader.hpp:8
hops::VectorType
Eigen::VectorXd VectorType
Definition: VectorType.hpp:7
hops::ModelWrapper::computeExpectedFisherInformation
virtual std::optional< MatrixType > computeExpectedFisherInformation(const VectorType &state)
Definition: ModelWrapper.hpp:32
hops::ModelWrapper::computeLogLikelihoodGradient
virtual std::optional< VectorType > computeLogLikelihoodGradient(const VectorType &state)
Definition: ModelWrapper.hpp:25