Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 "ActiveLearningGaussianProcess.h" 13 : #include "Standardizer.h" 14 : #include <Eigen/Dense> 15 : 16 : #include "StochasticToolsApp.h" 17 : #include "LoadSurrogateDataAction.h" 18 : 19 : #include "SurrogateModelInterface.h" 20 : #include "SurrogateTrainer.h" 21 : #include "MooseRandom.h" 22 : 23 : #include "Distribution.h" 24 : 25 : #include "CovarianceFunctionBase.h" 26 : #include "CovarianceInterface.h" 27 : 28 : #include "GaussianProcess.h" 29 : 30 : class ActiveLearningGaussianProcess : public SurrogateTrainerBase, 31 : public CovarianceInterface, 32 : public SurrogateModelInterface 33 : { 34 : public: 35 : static InputParameters validParams(); 36 : ActiveLearningGaussianProcess(const InputParameters & parameters); 37 : 38 1225 : virtual void initialize() final {} 39 1225 : virtual void execute() final {} 40 : virtual void reTrain(const std::vector<std::vector<Real>> & inputs, 41 : const std::vector<Real> & outputs) const final; 42 : 43 : StochasticTools::GaussianProcess & gp() { return _gp; } 44 : const StochasticTools::GaussianProcess & getGP() const { return _gp; } 45 : 46 : /** 47 : * Return the current length scales from GP training 48 : */ 49 : const std::vector<Real> & getLengthScales() const; 50 : 51 : /** 52 : * Return the training data outputs standardizer 53 : */ 54 : const StochasticTools::Standardizer & getTrainingStandardizer() const; 55 : 56 : /** 57 : * Return the normalized training outputs 58 : * @param norm_training_outs The normalized traing outputs to return 59 : */ 60 : void getNormTrainingOuts(std::vector<Real> & norm_training_outs) const; 61 : 62 : private: 63 : /// Name for the meta data associated with training 64 : const std::string _model_meta_data_name; 65 : 66 : /// The GP handler 67 : StochasticTools::GaussianProcess & _gp; 68 : 69 : /// Paramaters (x) used for training, along with statistics 70 : RealEigenMatrix & _training_params; 71 : 72 : /// Outputs (y) used for training, along with statistics 73 : RealEigenMatrix & _training_data; 74 : 75 : /// Switch for training param (x) standardization 76 : bool _standardize_params; 77 : 78 : /// Switch for training data(y) standardization 79 : bool _standardize_data; 80 : 81 : /// Struct holding parameters necessary for parameter tuning 82 : const StochasticTools::GaussianProcess::GPOptimizerOptions _optimization_opts; 83 : };