https://mooseframework.inl.gov
BayesianActiveLearner.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "GenericActiveLearner.h"
14 #include "LikelihoodFunctionBase.h"
15 #include "LikelihoodInterface.h"
16 
20 class BayesianActiveLearner : public GenericActiveLearnerTempl<BayesianActiveLearningSampler>,
21  public LikelihoodInterface
22 
23 {
24 public:
26 
28 
29 protected:
30  virtual void setupGPData(const std::vector<Real> & data_out,
31  const DenseMatrix<Real> & data_in) override;
32 
33  virtual Real computeConvergenceValue() override;
34 
35  virtual void evaluateGPTest() override;
36 
37  virtual void includeAdditionalInputs() override;
38 
39 private:
45  void computeLogLikelihood(const std::vector<Real> & data_out);
46 
48  const std::vector<Real> & _new_var_samples;
49 
52 
54  const std::vector<Real> & _var_test;
55 
58 
60  std::vector<const LikelihoodFunctionBase *> _likelihoods;
61 
64 
67 
69  std::vector<Real> _log_likelihood;
70 
72  unsigned int _n_dim_plus_var;
73 };
virtual void setupGPData(const std::vector< Real > &data_out, const DenseMatrix< Real > &data_in) override
Sets up the training data for the GP model.
A generic reporter to support parallel active learning: re-trains GP and picks the next best batch...
std::vector< Real > _log_likelihood
Storage for the computed log-likelihood values in each iteration of active learning.
virtual void evaluateGPTest() override
Evaluate the GP on all the test samples sent by the Sampler.
BayesianActiveLearner(const InputParameters &parameters)
virtual Real computeConvergenceValue() override
Computes the convergence value during active learning.
const InputParameters & parameters() const
std::vector< const LikelihoodFunctionBase * > _likelihoods
Storage for the likelihood objects to be utilized.
void computeLogLikelihood(const std::vector< Real > &data_out)
Sets up the training data for the GP model for Bayesian UQ tasks.
static InputParameters validParams()
const Distribution * _var_prior
Storage for the prior over the variance.
Real & _noise
Model noise term to pass to Likelihoods object.
A reporter to support parallel active learning for Bayesian UQ tasks.
const std::vector< Real > & _new_var_samples
Storage for new proposed variance samples.
unsigned int _n_dim_plus_var
The input dimension for GP for Bayesian problems with var, equal to Sampler columns + 1...
dof_id_type _num_confg_params
Storage for the number of experimental configuration parameters.
virtual void includeAdditionalInputs() override
Include additional inputs before evaluating the acquisition function.
dof_id_type _num_confg_values
Storage for the number of experimental configuration values.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const std::vector< Real > & _var_test
Storage for all the proposed variance samples to test the GP model.
uint8_t dof_id_type