https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
PolynomialChaosTrainer Class Reference

#include <PolynomialChaosTrainer.h>

Inheritance diagram for PolynomialChaosTrainer:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 PolynomialChaosTrainer (const InputParameters &parameters)
 
virtual void preTrain () override
 
virtual void train () override
 
virtual void postTrain () override
 
virtual void initialize () final
 
virtual void execute () final
 
virtual void finalize () final
 
virtual void threadJoin (const UserObject &) final
 
virtual Real spatialValue (const Point &) const
 
virtual const std::vector< Point > spatialPoints () const
 
void setPrimaryThreadCopy (UserObject *primary)
 
UserObjectprimaryThreadCopy ()
 
SubProblemgetSubProblem () const
 
bool shouldDuplicateInitialExecution () const
 
void gatherSum (T &value)
 
void gatherMax (T &value)
 
void gatherMin (T &value)
 
void gatherProxyValueMax (T1 &proxy, T2 &value)
 
void gatherProxyValueMin (T1 &proxy, T2 &value)
 
std::set< UserObjectName > getDependObjects () const
 
const std::set< std::string > & getRequestedItems () override
 
const std::set< std::string > & getSuppliedItems () override
 
unsigned int systemNumber () const
 
virtual bool needThreadedCopy () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
bool isKokkosObject () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParametersparameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const TgetParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const TqueryParam (const std::string &name) const
 
const TgetRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
virtual void initialSetup ()
 
virtual void timestepSetup ()
 
virtual void jacobianSetup ()
 
virtual void residualSetup ()
 
virtual void customSetup (const ExecFlagType &)
 
const ExecFlagEnumgetExecuteOnEnum () const
 
UserObjectName getUserObjectName (const std::string &param_name) const
 
const TgetUserObject (const std::string &param_name, bool is_dependency=true) const
 
const TgetUserObjectByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const UserObjectBasegetUserObjectBase (const std::string &param_name, bool is_dependency=true) const
 
const UserObjectBasegetUserObjectBaseByName (const UserObjectName &object_name, bool is_dependency=true) const
 
const std::vector< MooseVariableScalar * > & getCoupledMooseScalarVars ()
 
const std::set< TagID > & getScalarVariableCoupleableVectorTags () const
 
const std::set< TagID > & getScalarVariableCoupleableMatrixTags () const
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialProperty (const std::string &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > & getADMaterialProperty (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOld (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const MaterialProperty< T > & getMaterialPropertyOlder (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const GenericMaterialProperty< T, is_ad > & getGenericMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const MaterialProperty< T > & getMaterialPropertyByName (const MaterialPropertyName &name, const unsigned int state=0)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const ADMaterialProperty< T > & getADMaterialPropertyByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOldByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name, MaterialData &material_data)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
const MaterialProperty< T > & getMaterialPropertyOlderByName (const MaterialPropertyName &name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyByName (const std::string &prop_name_in)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOldByName (const std::string &prop_name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOlderByName (const std::string &prop_name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialProperty (const std::string &name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOld (const std::string &name)
 
Moose::Kokkos::MaterialProperty< T, dimension > getKokkosMaterialPropertyOlder (const std::string &name)
 
std::pair< const MaterialProperty< T > *, std::set< SubdomainID > > getBlockMaterialProperty (const MaterialPropertyName &name)
 
std::pair< Moose::Kokkos::MaterialProperty< T, dimension >, std::set< SubdomainID > > getKokkosBlockMaterialProperty (const MaterialPropertyName &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialProperty ()
 
const GenericMaterialProperty< T, is_ad > & getGenericZeroMaterialPropertyByName (const std::string &prop_name)
 
const MaterialProperty< T > & getZeroMaterialProperty (Ts... args)
 
std::set< SubdomainIDgetMaterialPropertyBlocks (const std::string &name)
 
std::vector< SubdomainName > getMaterialPropertyBlockNames (const std::string &name)
 
std::set< BoundaryIDgetMaterialPropertyBoundaryIDs (const std::string &name)
 
std::vector< BoundaryName > getMaterialPropertyBoundaryNames (const std::string &name)
 
void checkBlockAndBoundaryCompatibility (std::shared_ptr< MaterialBase > discrete)
 
std::unordered_map< SubdomainID, std::vector< MaterialBase * > > buildRequiredMaterials (bool allow_stateful=true)
 
void statefulPropertiesAllowed (bool)
 
virtual bool getMaterialPropertyCalled () const
 
virtual const std::unordered_set< unsigned int > & getMatPropDependencies () const
 
virtual void resolveOptionalProperties ()
 
const GenericMaterialProperty< T, is_ad > & getPossiblyConstantGenericMaterialPropertyByName (const MaterialPropertyName &prop_name, MaterialData &material_data, const unsigned int state)
 
bool isImplicit ()
 
Moose::StateArg determineState () const
 
virtual void subdomainSetup () override
 
virtual void subdomainSetup () override
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObject (const std::string &param_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
bool hasUserObjectByName (const UserObjectName &object_name) const
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const GenericOptionalMaterialProperty< T, is_ad > & getGenericOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalMaterialProperty< T > & getOptionalMaterialProperty (const std::string &name, const unsigned int state=0)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalADMaterialProperty< T > & getOptionalADMaterialProperty (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOld (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
const OptionalMaterialProperty< T > & getOptionalMaterialPropertyOlder (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterial (const std::string &name)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
MaterialBasegetMaterialByName (const std::string &name, bool no_warn=false)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialProperty (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialProperty (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasADMaterialPropertyByName (const std::string &name)
 
bool hasKokkosMaterialProperty (const std::string &name)
 
bool hasKokkosMaterialProperty (const std::string &name)
 
bool hasKokkosMaterialPropertyByName (const std::string &name)
 
bool hasKokkosMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialProperty (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
bool hasGenericMaterialPropertyByName (const std::string &name)
 
const FunctiongetFunction (const std::string &name) const
 
const FunctiongetFunctionByName (const FunctionName &name) const
 
bool hasFunction (const std::string &param_name) const
 
bool hasFunctionByName (const FunctionName &name) const
 
Moose::Kokkos::Function getKokkosFunction (const std::string &name) const
 
const TgetKokkosFunction (const std::string &name) const
 
Moose::Kokkos::Function getKokkosFunctionByName (const FunctionName &name) const
 
const TgetKokkosFunctionByName (const FunctionName &name) const
 
bool hasKokkosFunction (const std::string &param_name) const
 
bool hasKokkosFunctionByName (const FunctionName &name) const
 
bool isDefaultPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessor (const std::string &param_name, const unsigned int index=0) const
 
bool hasPostprocessorByName (const PostprocessorName &name) const
 
std::size_t coupledPostprocessors (const std::string &param_name) const
 
const PostprocessorName & getPostprocessorName (const std::string &param_name, const unsigned int index=0) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name, bool needs_broadcast) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const VectorPostprocessorValuegetVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name, bool needs_broadcast) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValue (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOld (const std::string &param_name, const std::string &vector_name) const
 
const ScatterVectorPostprocessorValuegetScatterVectorPostprocessorValueOldByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 
bool hasVectorPostprocessor (const std::string &param_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool hasVectorPostprocessorByName (const VectorPostprocessorName &name) const
 
const VectorPostprocessorName & getVectorPostprocessorName (const std::string &param_name) const
 
TgetSampler (const std::string &name)
 
SamplergetSampler (const std::string &name)
 
TgetSamplerByName (const SamplerName &name)
 
SamplergetSamplerByName (const SamplerName &name)
 
virtual void meshChanged ()
 
virtual void meshDisplaced ()
 
PerfGraphperfGraph ()
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValue (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOld (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
const PostprocessorValuegetPostprocessorValueOlder (const std::string &param_name, const unsigned int index=0) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
virtual const PostprocessorValuegetPostprocessorValueByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOldByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
const PostprocessorValuegetPostprocessorValueOlderByName (const PostprocessorName &name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributed (const std::string &param_name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
bool isVectorPostprocessorDistributedByName (const VectorPostprocessorName &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const TgetDistribution (const std::string &name) const
 
const DistributiongetDistribution (const std::string &name) const
 
const TgetDistribution (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const TgetDistributionByName (const std::string &name) const
 
const DistributiongetDistributionByName (const DistributionName &name) const
 
const TgetDistributionByName (const std::string &name) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
const std::string & modelMetaDataName () const
 Accessor for the name of the model meta data.
 
const FileName & getModelDataFileName () const
 Get the associated filename.
 
bool hasModelData () const
 Check if we need to load model data (if the filename parameter is used)
 
template<>
SurrogateModelgetSurrogateModel (const std::string &name) const
 
template<>
SurrogateTrainerBasegetSurrogateTrainer (const std::string &name) const
 
template<>
SurrogateModelgetSurrogateModelByName (const UserObjectName &name) const
 
template<>
SurrogateTrainerBasegetSurrogateTrainerByName (const UserObjectName &name) const
 
template<typename T , typename... Args>
TdeclareModelData (const std::string &data_name, Args &&... args)
 Declare model data for loading from file as well as restart.
 
template<typename T , typename... Args>
const TgetModelData (const std::string &data_name, Args &&... args) const
 Retrieve model data from the interface.
 
template<typename T = SurrogateModel>
TgetSurrogateModel (const std::string &name) const
 Get a SurrogateModel/Trainer with a given name.
 
template<typename T = SurrogateTrainerBase>
TgetSurrogateTrainer (const std::string &name) const
 
template<typename T = SurrogateModel>
TgetSurrogateModelByName (const UserObjectName &name) const
 Get a sampler with a given name.
 
template<typename T = SurrogateTrainerBase>
TgetSurrogateTrainerByName (const UserObjectName &name) const
 

Static Public Member Functions

static InputParameters validParams ()
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 
static void sort (typename std::vector< T > &vector)
 
static void sortDFS (typename std::vector< T > &vector)
 
static void cyclicDependencyError (CyclicDependencyException< T2 > &e, const std::string &header, NameFunc &&name_func)
 
static void cyclicDependencyError (CyclicDependencyException< T2 > &e, const std::string &header)
 

Public Attributes

 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 

Static Public Attributes

static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 
static constexpr PropertyValue::id_type default_property_id
 
static constexpr PropertyValue::id_type zero_property_id
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Member Functions

template<typename T >
const TgetTrainingData (const ReporterName &rname)
 
const std::vector< Real > & getSamplerData () const
 
const std::vector< Real > & getPredictorData () const
 
unsigned int getCurrentSampleSize () const
 
unsigned int getLocalSampleSize () const
 
virtual std::vector< Real > evaluateModelError (const SurrogateModel &surr)
 
virtual void addPostprocessorDependencyHelper (const PostprocessorName &name) const override
 
virtual void addVectorPostprocessorDependencyHelper (const VectorPostprocessorName &name) const override
 
virtual void addUserObjectDependencyHelper (const UserObjectBase &uo) const override
 
void addReporterDependencyHelper (const ReporterName &reporter_name) override
 
void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 
const ReporterContextBasegetReporterContextBaseByName (const ReporterName &reporter_name) const
 
const ReporterNamegetReporterName (const std::string &param_name) const
 
TdeclareRestartableData (const std::string &data_name, Args &&... args)
 
ManagedValue< TdeclareManagedRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
const TgetRestartableData (const std::string &data_name) const
 
TdeclareRestartableDataWithContext (const std::string &data_name, void *context, Args &&... args)
 
TdeclareRecoverableData (const std::string &data_name, Args &&... args)
 
TdeclareRestartableDataWithObjectName (const std::string &data_name, const std::string &object_name, Args &&... args)
 
TdeclareRestartableDataWithObjectNameWithContext (const std::string &data_name, const std::string &object_name, void *context, Args &&... args)
 
std::string restartableName (const std::string &data_name) const
 
const TgetMeshProperty (const std::string &data_name, const std::string &prefix)
 
const TgetMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 
bool isCoupledScalar (const std::string &var_name, unsigned int i=0) const
 
unsigned int coupledScalarComponents (const std::string &var_name) const
 
unsigned int coupledScalar (const std::string &var_name, unsigned int comp=0) const
 
libMesh::Order coupledScalarOrder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< is_ad > & coupledGenericScalarValue (const std::string &var_name, unsigned int comp=0) const
 
const GenericVariableValue< false > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const GenericVariableValue< true > & coupledGenericScalarValue (const std::string &var_name, const unsigned int comp) const
 
const VariableValuecoupledVectorTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledMatrixTagScalarValue (const std::string &var_name, TagID tag, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarValueOlder (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const ADVariableValueadCoupledScalarDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDot (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotOld (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDu (const std::string &var_name, unsigned int comp=0) const
 
const VariableValuecoupledScalarDotDotDu (const std::string &var_name, unsigned int comp=0) const
 
const MooseVariableScalargetScalarVar (const std::string &var_name, unsigned int comp) const
 
virtual void checkMaterialProperty (const std::string &name, const unsigned int state)
 
virtual void getKokkosMaterialPropertyHook (const std::string &, const unsigned int)
 
void markMatPropRequested (const std::string &)
 
MaterialPropertyName getMaterialPropertyName (const std::string &name) const
 
void checkExecutionStage ()
 
const TgetReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const TgetReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const TgetReporterValue (const std::string &param_name, const std::size_t time_index=0)
 
const TgetReporterValue (const std::string &param_name, ReporterMode mode, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, const std::size_t time_index=0)
 
const TgetReporterValueByName (const ReporterName &reporter_name, ReporterMode mode, const std::size_t time_index=0)
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValue (const std::string &param_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
bool hasReporterValueByName (const ReporterName &reporter_name) const
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const GenericMaterialProperty< T, is_ad > * defaultGenericMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const MaterialProperty< T > * defaultMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 
const ADMaterialProperty< T > * defaultADMaterialProperty (const std::string &name)
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

const Moose::CoordinateSystemType_coord_sys
 
const THREAD_ID _tid
 
SubProblem_subproblem
 
FEProblemBase_fe_problem
 
SystemBase_sys
 
Assembly_assembly
 
const bool _duplicate_initial_execution
 
std::set< std::string > _depend_uo
 
const bool & _enabled
 
MooseApp_app
 
Factory_factory
 
ActionFactory_action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters_pars
 
const ExecFlagEnum_execute_enum
 
const ExecFlagType_current_execute_flag
 
MooseApp_restartable_app
 
const std::string _restartable_system_name
 
const THREAD_ID _restartable_tid
 
const bool _restartable_read_only
 
FEProblemBase_mci_feproblem
 
FEProblemBase_mdi_feproblem
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
FEProblemBase_sc_fe_problem
 
const THREAD_ID _sc_tid
 
const Real & _real_zero
 
const VariableValue_scalar_zero
 
const Point & _point_zero
 
const InputParameters_mi_params
 
const std::string _mi_name
 
const MooseObjectName _mi_moose_object_name
 
FEProblemBase_mi_feproblem
 
SubProblem_mi_subproblem
 
const THREAD_ID _mi_tid
 
const bool _is_kokkos_object
 
const Moose::MaterialDataType _material_data_type
 
MaterialData_material_data
 
bool _stateful_allowed
 
bool _get_material_property_called
 
std::vector< std::unique_ptr< PropertyValue > > _default_properties
 
std::unordered_set< unsigned int_material_property_dependencies
 
const MaterialPropertyName _get_suffix
 
const bool _use_interpolated_state
 
const InputParameters_ti_params
 
FEProblemBase_ti_feproblem
 
bool _is_implicit
 
Real & _t
 
const Real & _t_old
 
int_t_step
 
Real & _dt
 
Real & _dt_old
 
bool _is_transient
 
const Parallel::Communicator & _communicator
 
Sampler_sampler
 
dof_id_type _row
 During training loop, this is the row index of the data.
 
dof_id_type _local_row
 During training loop, this is the local row index of the data.
 
const Real * _rval
 Response value.
 
const std::vector< Real > * _rvecval
 Vector response value.
 
std::vector< const Real * > _pvals
 Predictor values from reporters.
 
std::vector< unsigned int_pcols
 Columns from sampler for predictors.
 
unsigned int _n_dims
 Dimension of predictor data - either _sampler.getNumberOfCols() or _pvals.size() + _pcols.size().
 
unsigned int_n_outputs
 The number of outputs.
 

Static Protected Attributes

static const std::string _interpolated_old
 
static const std::string _interpolated_older
 

Private Member Functions

void checkIntegrity () const
 
void executeTraining ()
 
std::vector< Real > crossValidate ()
 
void updatePredictorRow ()
 
const Moose::FunctionBasegetKokkosFunctionByNameHelper (const FunctionName &name) const
 
const UserObjectBasegetUserObjectFromFEProblem (const UserObjectName &object_name, const THREAD_ID tid=0) const
 
const TcastUserObject (const UserObjectBase &uo_base, const std::string &param_name="") const
 
void mooseObjectError (const std::string &param_name, std::stringstream &oss) const
 
const std::string & userObjectType (const UserObjectBase &uo) const
 
const std::string & userObjectName (const UserObjectBase &uo) const
 
const PostprocessorName & getPostprocessorNameInternal (const std::string &param_name, const unsigned int index, const bool allow_default_value=true) const
 
bool isDefaultPostprocessorValueByName (const PostprocessorName &name) const
 
PostprocessorValue getDefaultPostprocessorValueByName (const PostprocessorName &name) const
 
void checkParam (const std::string &param_name, const unsigned int index=std::numeric_limits< unsigned int >::max()) const
 
bool postprocessorsAdded () const
 
const VectorPostprocessorValuegetVectorPostprocessorByNameHelper (const VectorPostprocessorName &name, const std::string &vector_name, bool broadcast, std::size_t t_index) const
 
const VectorPostprocessorContext< VectorPostprocessorValue > & getVectorPostprocessorContextByNameHelper (const VectorPostprocessorName &name, const std::string &vector_name) const
 
bool vectorPostprocessorsAdded () const
 
bool reportersAdded () const
 
void possiblyCheckHasReporter (const ReporterName &reporter_name, const std::string &param_name="") const
 
RestartableDataValueregisterRestartableDataOnApp (std::unique_ptr< RestartableDataValue > data, THREAD_ID tid) const
 
void registerRestartableNameWithFilterOnApp (const std::string &name, Moose::RESTARTABLE_FILTER filter)
 
RestartableData< T > & declareRestartableDataHelper (const std::string &data_name, void *context, Args &&... args) const
 
virtual std::string meshPropertyPrefix (const std::string &data_name) const
 
const RestartableDataValuegetMeshPropertyInternal (const std::string &data_name, const std::string &prefix) const
 
void mooseErrorInternal (Args &&... args) const
 
const VariableValuegetDefaultValue (const std::string &var_name) const
 
const ADVariableValuegetADDefaultValue (const std::string &var_name) const
 
void checkVar (const std::string &var_name) const
 
void validateExecutionerType (const std::string &name, const std::string &fn_name) const
 
Moose::MaterialDataType getMaterialDataType (const std::set< BoundaryID > &boundary_ids) const
 
unsigned int getMaxQps () const
 
void addConsumedPropertyName (const MooseObjectName &obj_name, const std::string &prop_name)
 
const PostprocessorValuegetPostprocessorValueInternal (const std::string &param_name, unsigned int index, std::size_t t_index) const
 
const PostprocessorValuegetPostprocessorValueInternal (const std::string &param_name, unsigned int index, std::size_t t_index) const
 
const PostprocessorValuegetPostprocessorValueByNameInternal (const PostprocessorName &name, std::size_t t_index) const
 
const PostprocessorValuegetPostprocessorValueByNameInternal (const PostprocessorName &name, std::size_t t_index) const
 
void possiblyCheckHasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 
void possiblyCheckHasVectorPostprocessor (const std::string &param_name, const std::string &vector_name) const
 
void possiblyCheckHasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 
void possiblyCheckHasVectorPostprocessorByName (const VectorPostprocessorName &name, const std::string &vector_name) const
 

Static Private Member Functions

static const hit::Node * getHitNode (const InputParameters &params)
 
static std::string messagePrefix (const InputParameters &params, const bool hit_prefix)
 

Private Attributes

const std::vector< Real > & _predictor_row
 Predictor values.
 
const unsigned int_order
 Maximum polynomial order. The sum of 1D polynomial orders does not go above this value.
 
unsigned int_ndim
 Total number of parameters/dimensions.
 
std::vector< std::vector< unsigned int > > & _tuple
 A _ndim-by-_ncoeff matrix containing the appropriate one-dimensional polynomial order.
 
std::size_t & _ncoeff
 Total number of coefficient (defined by size of _tuple)
 
std::vector< Real > & _coeff
 These are the coefficients we are after in the PC expansion.
 
std::vector< std::unique_ptr< const PolynomialQuadrature::Polynomial > > & _poly
 The distributions used for sampling.
 
unsigned int _rtype
 The method in which to perform the regression (0=integration, 1=OLS)
 
const Real & _ridge_penalty
 The penalty parameter for Ridge regularization.
 
QuadratureSampler_quad_sampler
 QuadratureSampler pointer, necessary for applying quadrature weights.
 
std::vector< std::unique_ptr< RealCalculator > > _calculators
 Calculators used for standardization in linear regression.
 
Real _r_sum
 
std::vector< Real > _row_data
 Sampler data for the current row.
 
std::vector< Real > _predictor_data
 Predictor data for current row - can be combination of Sampler and Reporter values.
 
const bool _skip_unconverged
 Whether or not we are skipping samples that have unconverged solutions.
 
const bool * _converged
 Whether or not the current sample has a converged solution.
 
unsigned int _current_sample_size
 Number of samples used to train the model.
 
unsigned int _local_sample_size
 Number of samples (locally) used to train the model.
 
std::unordered_map< ReporterName, std::shared_ptr< TrainingDataBase > > _training_data
 Vector of reporter names and their corresponding values (to be filled by getTrainingData)
 
UserObject_primary_thread_copy
 
std::set< std::string > _supplied_uo
 
const ParallelParamObject_parent
 
const MooseBase_si_moose_base
 
const FEProblemBase_si_problem
 
ExecFlagEnum _empty_execute_enum
 
const MooseObject_fni_object
 
const InputParameters_fni_params
 
FEProblemBase_fni_feproblem
 
const THREAD_ID _fni_tid
 
const MooseObject_uoi_moose_object
 
const FEProblemBase_uoi_feproblem
 
const THREAD_ID _uoi_tid
 
const MooseObject_ppi_moose_object
 
const InputParameters_ppi_params
 
const FEProblemBase_ppi_feproblem
 
std::map< PostprocessorName, std::unique_ptr< PostprocessorValue > > _default_values
 
const bool _broadcast_by_default
 
const MooseObject_vpi_moose_object
 
const FEProblemBase_vpi_feproblem
 
const THREAD_ID _vpi_tid
 
const InputParameters_ri_params
 
FEProblemBase_ri_fe_problem_base
 
const ReporterData_ri_reporter_data
 
const MooseObject_ri_moose_object
 
const InputParameters_dni_params
 
FEProblemBase_dni_feproblem
 
const MooseObject *const _dni_moose_object_ptr
 
const InputParameters_si_params
 
FEProblemBase_si_feproblem
 
THREAD_ID _si_tid
 
const RestartableDataMapName _metaname
 
std::string _restartable_name
 
MooseApp_meta_data_app
 
const MooseObject *const _meta_data_object
 
const InputParameters_sc_parameters
 
const std::string & _sc_name
 
const bool _sc_is_implicit
 
std::unordered_map< std::string, std::vector< MooseVariableScalar * > > _coupled_scalar_vars
 
std::unordered_map< std::string, std::unique_ptr< VariableValue > > _default_value
 
std::unordered_map< std::string, std::unique_ptr< ADVariableValue > > _dual_default_value
 
std::vector< MooseVariableScalar * > _coupled_moose_scalar_vars
 
std::unordered_map< std::string, std::vector< MooseVariableFieldBase * > > _sc_coupled_vars
 
std::set< TagID_sc_coupleable_vector_tags
 
std::set< TagID_sc_coupleable_matrix_tags
 
const MooseObject_mi_moose_object
 
const bool _mi_boundary_restricted
 
const std::set< SubdomainID > & _mi_block_ids
 
const std::set< BoundaryID > & _mi_boundary_ids
 
std::vector< std::unique_ptr< OptionalMaterialPropertyProxyBase< MaterialPropertyInterface > > > _optional_property_proxies
 
const std::string _ti_name
 
const MooseObject_model_object
 Reference to the MooseObject that uses this interface.
 
const std::string _model_meta_data_name
 The model meta data name.
 
PublicRestartable _model_restartable
 Member for interfacing with the framework's restartable system.
 
const InputParameters_smi_params
 Parameters of the object with this interface.
 
FEProblemBase_smi_feproblem
 Reference to FEProblemBase instance.
 
const THREAD_ID _smi_tid
 Thread ID.
 
DenseMatrix< Real > _matrix
 
DenseVector< Real > _rhs
 
std::vector< dof_id_type > _skip_indices
 
const MooseEnum_cv_type
 Type of cross validation to perform - for now, just 'none' (no CV) or 'k_fold'.
 
const unsigned int_n_splits
 Number of splits (k) to split sampler data into.
 
const unsigned int_cv_n_trials
 Number of repeated trials of cross validation to perform.
 
const unsigned int_cv_seed
 Seed used for _cv_generator.
 
MooseRandom _cv_generator
 Random number generator used for shuffling sampler rows during splitting.
 
const SurrogateModel_cv_surrogate
 SurrogateModel used to evaluate model error relative to test points.
 
const bool _doing_cv
 Set to true if cross validation is being performed, controls behavior in execute().
 
std::vector< std::vector< Real > > & _cv_trial_scores
 RMSE scores from each CV trial - can be grabbed by VPP or Reporter.
 

Detailed Description

Definition at line 22 of file PolynomialChaosTrainer.h.

Constructor & Destructor Documentation

◆ PolynomialChaosTrainer()

PolynomialChaosTrainer::PolynomialChaosTrainer ( const InputParameters parameters)

Definition at line 35 of file PolynomialChaosTrainer.C.

38 _order(declareModelData<unsigned int>("_order", getParam<unsigned int>("order"))),
39 _ndim(declareModelData<unsigned int>("_ndim", _sampler.getNumberOfCols())),
40 _tuple(declareModelData<std::vector<std::vector<unsigned int>>>(
42 _ncoeff(declareModelData<std::size_t>("_ncoeff", _tuple.size())),
43 _coeff(declareModelData<std::vector<Real>>("_coeff")),
44 _poly(declareModelData<std::vector<std::unique_ptr<const PolynomialQuadrature::Polynomial>>>(
45 "_poly")),
46 _ridge_penalty(getParam<Real>("penalty")),
48{
49 // Check if number of distributions is correct
51 paramError("distributions",
52 "Sampler number of columns does not match number of inputted distributions.");
53
54 auto rtype_enum = getParam<MooseEnum>("regression_type");
55 if (rtype_enum == "auto")
56 _rtype = _quad_sampler ? 0 : 1;
57 else
58 _rtype = rtype_enum == "integration" ? 0 : 1;
59
60 if (_rtype == 0 && _quad_sampler &&
61 (!_pvals.empty() || _pcols.size() != _sampler.getNumberOfCols()))
62 paramError("sampler",
63 "QuadratureSampler must use all Sampler columns for training, and cannot be"
64 " used with other Reporters - otherwise, quadrature integration does not work.");
65 if (_rtype == 0 && _ridge_penalty != 0.0)
66 paramError("penalty",
67 "Ridge regularization penalty is only relevant if 'regression_type = ols'.");
68
69 // Make polynomials
70 for (const auto & nm : getParam<std::vector<DistributionName>>("distributions"))
72
73 // Create calculators for standardization
74 if (_rtype == 1)
75 {
76 _calculators.resize(_ncoeff * 3);
77 for (const auto & term : make_range(_ncoeff))
78 {
80 _calculators[3 * term + 1] = StochasticTools::makeCalculator(MooseEnumItem("stddev"), *this);
81 _calculators[3 * term + 2] = StochasticTools::makeCalculator(MooseEnumItem("sum"), *this);
82 }
83 }
84}
const Distribution & getDistributionByName(const DistributionName &name) const
const InputParameters & parameters() const
void paramError(const std::string &param, Args... args) const
const T & getParam(const std::string &name) const
unsigned int & _ndim
Total number of parameters/dimensions.
const unsigned int & _order
Maximum polynomial order. The sum of 1D polynomial orders does not go above this value.
unsigned int _rtype
The method in which to perform the regression (0=integration, 1=OLS)
const Real & _ridge_penalty
The penalty parameter for Ridge regularization.
QuadratureSampler * _quad_sampler
QuadratureSampler pointer, necessary for applying quadrature weights.
std::vector< std::unique_ptr< RealCalculator > > _calculators
Calculators used for standardization in linear regression.
std::vector< std::unique_ptr< const PolynomialQuadrature::Polynomial > > & _poly
The distributions used for sampling.
std::vector< Real > & _coeff
These are the coefficients we are after in the PC expansion.
std::vector< std::vector< unsigned int > > & _tuple
A _ndim-by-_ncoeff matrix containing the appropriate one-dimensional polynomial order.
const std::vector< Real > & _predictor_row
Predictor values.
std::size_t & _ncoeff
Total number of coefficient (defined by size of _tuple)
A class used to produce samples based on quadrature for Polynomial Chaos.
T & declareModelData(const std::string &data_name, Args &&... args)
Declare model data for loading from file as well as restart.
dof_id_type getNumberOfCols() const
static std::vector< std::vector< unsigned int > > generateTuple(unsigned int n_dims, unsigned int max_degree, bool include_bias=true)
Function computing for computing _tuple Example for ndim = 3, order = 4: | 0 | 1 0 0 | 2 1 1 0 0 0 | ...
This is the main trainer base class.
const std::vector< Real > & getPredictorData() const
std::vector< const Real * > _pvals
Predictor values from reporters.
std::vector< unsigned int > _pcols
Columns from sampler for predictors.
Polynomials and quadratures based on defined distributions for Polynomial Chaos.
std::unique_ptr< const Polynomial > makePolynomial(const Distribution *dist)
std::unique_ptr< Calculator< InType, OutType > > makeCalculator(const MooseEnumItem &item, const libMesh::ParallelObject &other)
IntRange< T > make_range(T beg, T end)

Member Function Documentation

◆ checkIntegrity()

void SurrogateTrainer::checkIntegrity ( ) const
privateinherited

Definition at line 196 of file SurrogateTrainer.C.

197{
198 // Check that the number of sampler columns hasn't changed
199 if (_row_data.size() != _sampler.getNumberOfCols())
200 mooseError("Number of sampler columns has changed.");
201
202 // Check that training data is correctly sized
203 for (auto & pair : _training_data)
204 {
205 dof_id_type rsize = pair.second->size();
206 dof_id_type nrow =
207 pair.second->isDistributed() ? _sampler.getNumberOfLocalRows() : _sampler.getNumberOfRows();
208 if (rsize != nrow)
209 mooseError("Reporter value ",
210 pair.first,
211 " of size ",
212 rsize,
213 " does not match sampler size (",
214 nrow,
215 ").");
216 }
217}
void mooseError(Args &&... args) const
dof_id_type getNumberOfLocalRows() const
dof_id_type getNumberOfRows() const
std::unordered_map< ReporterName, std::shared_ptr< TrainingDataBase > > _training_data
Vector of reporter names and their corresponding values (to be filled by getTrainingData)
std::vector< Real > _row_data
Sampler data for the current row.
uint8_t dof_id_type

Referenced by SurrogateTrainer::executeTraining().

◆ crossValidate()

std::vector< Real > SurrogateTrainer::crossValidate ( )
privateinherited

Definition at line 252 of file SurrogateTrainer.C.

253{
254 std::vector<Real> cv_score(1, 0.0);
255
256 // Get skipped indices for each split
258 std::vector<std::vector<dof_id_type>> split_indices;
259 if (processor_id() == 0)
260 {
261 std::vector<dof_id_type> indices_flat(n_rows);
262 std::iota(indices_flat.begin(), indices_flat.end(), 0);
263 MooseUtils::shuffle(indices_flat, _cv_generator, 0);
264
265 split_indices.resize(_n_splits);
266 for (const auto & k : make_range(_n_splits))
267 {
268 const dof_id_type num_ind = n_rows / _n_splits + (k < (n_rows % _n_splits) ? 1 : 0);
269 split_indices[k].insert(split_indices[k].begin(),
270 std::make_move_iterator(indices_flat.begin()),
271 std::make_move_iterator(indices_flat.begin() + num_ind));
272 std::sort(split_indices[k].begin(), split_indices[k].end());
273 indices_flat.erase(indices_flat.begin(), indices_flat.begin() + num_ind);
274 }
275 }
276
277 std::vector<dof_id_type> split_ids_buffer;
278 for (const auto & k : make_range(_n_splits))
279 {
280 if (processor_id() == 0)
281 split_ids_buffer = split_indices[k];
282 _communicator.broadcast(split_ids_buffer, 0);
283
284 _current_sample_size = _sampler.getNumberOfRows() - split_ids_buffer.size();
285
286 auto first = std::lower_bound(
287 split_ids_buffer.begin(), split_ids_buffer.end(), _sampler.getLocalRowBegin());
288 auto last = std::upper_bound(
289 split_ids_buffer.begin(), split_ids_buffer.end(), _sampler.getLocalRowEnd());
290 _skip_indices.insert(_skip_indices.begin(), first, last);
291
293
294 // Train the model
296
297 // Evaluate the model
298 std::vector<Real> split_mse(1, 0.0);
299 std::vector<Real> row_mse(1, 0.0);
300
301 auto skipped_row = _skip_indices.begin();
302
303 for (dof_id_type p = _sampler.getLocalRowBegin(); p < _sampler.getLocalRowEnd(); ++p)
304 {
305 const std::vector<Real> row = _sampler.getNextLocalRow();
306 if (skipped_row != _skip_indices.end() && p == *skipped_row)
307 {
308 for (unsigned int i = 0; i < _row_data.size(); ++i)
309 _row_data[i] = row[i];
310
311 for (auto & pair : _training_data)
312 pair.second->setCurrentIndex(
313 (pair.second->isDistributed() ? p - _sampler.getLocalRowBegin() : p));
314
316
318
319 // Expand split_mse if needed.
320 split_mse.resize(row_mse.size(), 0.0);
321
322 // Increment errors
323 for (unsigned int r = 0; r < split_mse.size(); ++r)
324 split_mse[r] += row_mse[r];
325
326 skipped_row++;
327 }
328 }
329 gatherSum(split_mse);
330
331 // Expand cv_score if necessary.
332 cv_score.resize(split_mse.size(), 0.0);
333
334 for (auto r : make_range(split_mse.size()))
335 cv_score[r] += split_mse[r] / n_rows;
336
337 _skip_indices.clear();
338 }
339
340 for (auto r : make_range(cv_score.size()))
341 cv_score[r] = std::sqrt(cv_score[r]);
342
343 return cv_score;
344}
const Real p
std::vector< Real > getNextLocalRow()
dof_id_type getLocalRowEnd() const
dof_id_type getLocalRowBegin() const
virtual std::vector< Real > evaluateModelError(const SurrogateModel &surr)
MooseRandom _cv_generator
Random number generator used for shuffling sampler rows during splitting.
const SurrogateModel * _cv_surrogate
SurrogateModel used to evaluate model error relative to test points.
std::vector< dof_id_type > _skip_indices
unsigned int _local_sample_size
Number of samples (locally) used to train the model.
const unsigned int & _n_splits
Number of splits (k) to split sampler data into.
unsigned int _current_sample_size
Number of samples used to train the model.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
void gatherSum(T &value)
const Parallel::Communicator & _communicator
processor_id_type processor_id() const
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
void shuffle(std::vector< T > &data, MooseRandom &generator, const std::size_t seed_index=0)

Referenced by SurrogateTrainer::execute().

◆ declareModelData()

template<typename T , typename... Args>
T & RestartableModelInterface::declareModelData ( const std::string &  data_name,
Args &&...  args 
)
inherited

Declare model data for loading from file as well as restart.

Definition at line 73 of file RestartableModelInterface.h.

74{
75 return _model_restartable.declareRestartableData<T>(data_name, std::forward<Args>(args)...);
76}
const double T
T & declareRestartableData(const std::string &data_name, Args &&... args)
Declare a piece of data as "restartable" and initialize it.
PublicRestartable _model_restartable
Member for interfacing with the framework's restartable system.

◆ evaluateModelError()

std::vector< Real > SurrogateTrainer::evaluateModelError ( const SurrogateModel surr)
protectedvirtualinherited

Definition at line 347 of file SurrogateTrainer.C.

348{
349 std::vector<Real> error(1, 0.0);
350
351 if (_rval)
352 {
353 Real model_eval = surr.evaluate(_predictor_data);
354 error[0] = MathUtils::pow(model_eval - (*_rval), 2);
355 }
356 else if (_rvecval)
357 {
358 error.resize(_rvecval->size());
359
360 // Evaluate for vector response.
361 std::vector<Real> model_eval(error.size());
362 surr.evaluate(_predictor_data, model_eval);
363 for (auto r : make_range(_rvecval->size()))
364 error[r] = MathUtils::pow(model_eval[r] - (*_rvecval)[r], 2);
365 }
366
367 return error;
368}
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
virtual Real evaluate(const std::vector< Real > &x) const
Evaluate surrogate model given a row of parameters.
const std::vector< Real > * _rvecval
Vector response value.
const Real * _rval
Response value.
std::vector< Real > _predictor_data
Predictor data for current row - can be combination of Sampler and Reporter values.
T pow(T x, int e)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by SurrogateTrainer::crossValidate().

◆ execute()

void SurrogateTrainer::execute ( )
finalvirtualinherited

Implements GeneralUserObject.

Definition at line 176 of file SurrogateTrainer.C.

177{
178 if (_doing_cv)
179 for (const auto & trial : make_range(_cv_n_trials))
180 {
181 std::vector<Real> trial_score = crossValidate();
182
183 // Expand _cv_trial_scores with more columns if necessary, then insert values.
184 for (unsigned int r = _cv_trial_scores.size(); r < trial_score.size(); ++r)
185 _cv_trial_scores.push_back(std::vector<Real>(_cv_n_trials, 0.0));
186 for (auto r : make_range(trial_score.size()))
187 _cv_trial_scores[r][trial] = trial_score[r];
188 }
189
193}
std::vector< Real > crossValidate()
const bool _doing_cv
Set to true if cross validation is being performed, controls behavior in execute().
std::vector< std::vector< Real > > & _cv_trial_scores
RMSE scores from each CV trial - can be grabbed by VPP or Reporter.
const unsigned int & _cv_n_trials
Number of repeated trials of cross validation to perform.

◆ executeTraining()

void SurrogateTrainer::executeTraining ( )
privateinherited

Definition at line 220 of file SurrogateTrainer.C.

221{
224 _local_row = 0;
225
226 preTrain();
227
229 {
230 // Need to do this manually in order to keep the iterators valid
231 const std::vector<Real> data = _sampler.getNextLocalRow();
232 for (unsigned int i = 0; i < _row_data.size(); ++i)
233 _row_data[i] = data[i];
234
235 // Set training data
236 for (auto & pair : _training_data)
237 pair.second->setCurrentIndex((pair.second->isDistributed() ? _local_row : _row));
238
240
241 if ((!_skip_unconverged || *_converged) &&
242 std::find(_skip_indices.begin(), _skip_indices.end(), _row) == _skip_indices.end())
243 train();
244
245 _local_row++;
246 }
247
248 postTrain();
249}
dof_id_type _local_row
During training loop, this is the local row index of the data.
virtual void train()
virtual void preTrain()
void checkIntegrity() const
dof_id_type _row
During training loop, this is the row index of the data.
const bool _skip_unconverged
Whether or not we are skipping samples that have unconverged solutions.
const bool * _converged
Whether or not the current sample has a converged solution.
virtual void postTrain()

Referenced by SurrogateTrainer::crossValidate(), and SurrogateTrainer::execute().

◆ finalize()

virtual void SurrogateTrainer::finalize ( )
inlinefinalvirtualinherited

Reimplemented from SurrogateTrainerBase.

Definition at line 63 of file SurrogateTrainer.h.

63{}

◆ getCurrentSampleSize()

unsigned int SurrogateTrainer::getCurrentSampleSize ( ) const
inlineprotectedinherited

Definition at line 102 of file SurrogateTrainer.h.

102{ return _current_sample_size; };

Referenced by postTrain(), and preTrain().

◆ getLocalSampleSize()

unsigned int SurrogateTrainer::getLocalSampleSize ( ) const
inlineprotectedinherited

◆ getModelData()

template<typename T , typename... Args>
const T & RestartableModelInterface::getModelData ( const std::string &  data_name,
Args &&...  args 
) const
inherited

Retrieve model data from the interface.

Definition at line 80 of file RestartableModelInterface.h.

81{
82 return _model_restartable.getRestartableData<T>(data_name, std::forward<Args>(args)...);
83}
const T & getRestartableData(const std::string &data_name) const
Declare a piece of data as "restartable" and initialize it Similar to declareRestartableData but retu...

◆ getModelDataFileName()

const FileName & RestartableModelInterface::getModelDataFileName ( ) const
inherited

Get the associated filename.

Definition at line 33 of file RestartableModelInterface.C.

34{
35 return _model_object.getParam<FileName>("filename");
36}
const MooseObject & _model_object
Reference to the MooseObject that uses this interface.

◆ getPredictorData()

const std::vector< Real > & SurrogateTrainer::getPredictorData ( ) const
inlineprotectedinherited

Definition at line 97 of file SurrogateTrainer.h.

97{ return _predictor_data; };

◆ getSamplerData()

const std::vector< Real > & SurrogateTrainer::getSamplerData ( ) const
inlineprotectedinherited

Definition at line 92 of file SurrogateTrainer.h.

92{ return _row_data; };

◆ getSurrogateModel() [1/2]

template<typename T >
T & SurrogateModelInterface::getSurrogateModel ( const std::string &  name) const
inherited

Get a SurrogateModel/Trainer with a given name.

Parameters
nameThe name of the parameter key of the sampler to retrieve
Returns
The sampler with name associated with the parameter 'name'

Definition at line 81 of file SurrogateModelInterface.h.

82{
83 return getSurrogateModelByName<T>(_smi_params.get<UserObjectName>(name));
84}
const std::string name
Definition Setup.h:21
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
const InputParameters & _smi_params
Parameters of the object with this interface.

Referenced by SurrogateTrainer::initialize().

◆ getSurrogateModel() [2/2]

template<>
SurrogateModel & SurrogateModelInterface::getSurrogateModel ( const std::string &  name) const
inherited

Definition at line 46 of file SurrogateModelInterface.C.

47{
48 return getSurrogateModelByName<SurrogateModel>(_smi_params.get<UserObjectName>(name));
49}

◆ getSurrogateModelByName() [1/2]

template<typename T >
T & SurrogateModelInterface::getSurrogateModelByName ( const UserObjectName &  name) const
inherited

Get a sampler with a given name.

Parameters
nameThe name of the sampler to retrieve
Returns
The sampler with name 'name'

Definition at line 88 of file SurrogateModelInterface.h.

89{
90 std::vector<T *> models;
92 .query()
93 .condition<AttribName>(name)
94 .condition<AttribSystem>("SurrogateModel")
95 .queryInto(models);
96 if (models.empty())
97 mooseError("Unable to find a SurrogateModel object of type " + std::string(typeid(T).name()) +
98 " with the name '" + name + "'");
99 return *(models[0]);
100}
void mooseError(Args &&... args)
TheWarehouse & theWarehouse() const
FEProblemBase & _smi_feproblem
Reference to FEProblemBase instance.
Query query()

Referenced by CrossValidationScores::CrossValidationScores(), EvaluateSurrogate::EvaluateSurrogate(), and InverseMapping::initialSetup().

◆ getSurrogateModelByName() [2/2]

template<>
SurrogateModel & SurrogateModelInterface::getSurrogateModelByName ( const UserObjectName &  name) const
inherited

Definition at line 31 of file SurrogateModelInterface.C.

32{
33 std::vector<SurrogateModel *> models;
35 .query()
36 .condition<AttribName>(name)
37 .condition<AttribSystem>("SurrogateModel")
38 .queryInto(models);
39 if (models.empty())
40 mooseError("Unable to find a SurrogateModel object with the name '" + name + "'");
41 return *(models[0]);
42}

◆ getSurrogateTrainer() [1/2]

template<typename T >
T & SurrogateModelInterface::getSurrogateTrainer ( const std::string &  name) const
inherited

Definition at line 104 of file SurrogateModelInterface.h.

105{
106 return getSurrogateTrainerByName<T>(_smi_params.get<UserObjectName>(name));
107}

◆ getSurrogateTrainer() [2/2]

template<>
SurrogateTrainerBase & SurrogateModelInterface::getSurrogateTrainer ( const std::string &  name) const
inherited

Definition at line 60 of file SurrogateModelInterface.C.

61{
62 return getSurrogateTrainerByName<SurrogateTrainerBase>(_smi_params.get<UserObjectName>(name));
63}

◆ getSurrogateTrainerByName() [1/2]

template<typename T >
T & SurrogateModelInterface::getSurrogateTrainerByName ( const UserObjectName &  name) const
inherited

Definition at line 111 of file SurrogateModelInterface.h.

112{
113 SurrogateTrainerBase * base_ptr =
115 T * obj_ptr = dynamic_cast<T *>(base_ptr);
116 if (!obj_ptr)
117 mooseError("Failed to find a SurrogateTrainer object of type " + std::string(typeid(T).name()) +
118 " with the name '",
119 name,
120 "' for the desired type.");
121 return *obj_ptr;
122}
T & getUserObject(const std::string &name, unsigned int tid=0) const
const THREAD_ID _smi_tid
Thread ID.
This is the base trainer class whose main functionality is the API for declaring model data.

Referenced by SurrogateTrainerOutput::output().

◆ getSurrogateTrainerByName() [2/2]

template<>
SurrogateTrainerBase & SurrogateModelInterface::getSurrogateTrainerByName ( const UserObjectName &  name) const
inherited

Definition at line 53 of file SurrogateModelInterface.C.

◆ getTrainingData()

template<typename T >
const T & SurrogateTrainer::getTrainingData ( const ReporterName rname)
protectedinherited

Definition at line 208 of file SurrogateTrainer.h.

209{
210 auto it = _training_data.find(rname);
211 if (it != _training_data.end())
212 {
213 auto data = std::dynamic_pointer_cast<TrainingData<T>>(it->second);
214 if (!data)
215 mooseError("Reporter value ", rname, " already exists but is of different type.");
216 return data->get();
217 }
218 else
219 {
220 const std::vector<T> & rval = getReporterValueByName<std::vector<T>>(rname);
221 _training_data[rname] = std::make_shared<TrainingData<T>>(rval);
222 return std::dynamic_pointer_cast<TrainingData<T>>(_training_data[rname])->get();
223 }
224}
const Elem & get(const ElemType type_in)

◆ hasModelData()

bool RestartableModelInterface::hasModelData ( ) const
inherited

Check if we need to load model data (if the filename parameter is used)

Definition at line 39 of file RestartableModelInterface.C.

40{
41 return _model_object.isParamValid("filename");
42}
bool isParamValid(const std::string &name) const

◆ initialize()

void SurrogateTrainer::initialize ( )
finalvirtualinherited

Reimplemented from SurrogateTrainerBase.

Definition at line 153 of file SurrogateTrainer.C.

154{
155 // Figure out if data is distributed
156 for (auto & pair : _training_data)
157 {
158 const ReporterName & name = pair.first;
159 TrainingDataBase & data = *pair.second;
160
161 const auto & mode = _fe_problem.getReporterData().getReporterMode(name);
162 if (mode == REPORTER_MODE_DISTRIBUTED || (mode == REPORTER_MODE_ROOT && processor_id() != 0))
163 data.isDistributed() = true;
164 else if (mode == REPORTER_MODE_REPLICATED ||
165 (mode == REPORTER_MODE_ROOT && processor_id() == 0))
166 data.isDistributed() = false;
167 else
168 mooseError("Predictor reporter value ", name, " is not of supported mode.");
169 }
170
171 if (_doing_cv)
172 _cv_surrogate = &getSurrogateModel("cv_surrogate");
173}
const ReporterData & getReporterData() const
const std::string & name() const
const ReporterProducerEnum & getReporterMode(const ReporterName &reporter_name) const
T & getSurrogateModel(const std::string &name) const
Get a SurrogateModel/Trainer with a given name.
FEProblemBase & _fe_problem

◆ modelMetaDataName()

const std::string & RestartableModelInterface::modelMetaDataName ( ) const
inlineinherited

Accessor for the name of the model meta data.

Definition at line 47 of file RestartableModelInterface.h.

47{ return _model_meta_data_name; }
const std::string _model_meta_data_name
The model meta data name.

Referenced by MappingOutput::output(), and SurrogateTrainerOutput::output().

◆ postTrain()

void PolynomialChaosTrainer::postTrain ( )
overridevirtual

Reimplemented from SurrogateTrainer.

Definition at line 153 of file PolynomialChaosTrainer.C.

154{
155 if (_rtype == 0)
156 {
158 if (!_quad_sampler)
159 for (std::size_t i = 0; i < _ncoeff; ++i)
161 }
162 else
163 {
165 gatherSum(_rhs.get_values());
166 for (auto & calc : _calculators)
167 calc->finalizeCalculator(true);
169
170 std::vector<Real> mu(_ncoeff);
171 std::vector<Real> sig(_ncoeff);
172 std::vector<Real> sum_pf(_ncoeff);
173 for (const auto i : make_range(_ncoeff))
174 {
175 mu[i] = i > 0 ? _calculators[3 * i]->getValue() : 0.0;
176 sig[i] = i > 0 ? _calculators[3 * i + 1]->getValue() : 1.0;
177 sum_pf[i] = _calculators[3 * i + 2]->getValue();
178 }
179
180 const Real n = getCurrentSampleSize();
181 for (const auto i : make_range(_ncoeff))
182 {
183 for (const auto j : make_range(i + 1))
184 {
185 _matrix(i, j) -= (mu[j] * sum_pf[i] + mu[i] * sum_pf[j]);
186 _matrix(i, j) += n * mu[i] * mu[j];
187 _matrix(i, j) /= (sig[i] * sig[j]);
188 _matrix(j, i) = _matrix(i, j);
189 }
190 _rhs(i) = (_rhs(i) - mu[i] * _r_sum) / sig[i];
191 }
192
193 DenseVector<Real> sol;
194 _matrix.lu_solve(_rhs, sol);
195 _coeff = sol.get_values();
196
197 for (unsigned int i = 1; i < _ncoeff; ++i)
198 {
199 _coeff[i] /= sig[i];
200 _coeff[0] -= _coeff[i] * mu[i];
201 }
202 }
203}
const double mu
unsigned int getCurrentSampleSize() const
std::vector< T > & get_values()
void lu_solve(const DenseVector< T > &b, DenseVector< T > &x)

◆ preTrain()

void PolynomialChaosTrainer::preTrain ( )
overridevirtual

Reimplemented from SurrogateTrainer.

Definition at line 87 of file PolynomialChaosTrainer.C.

88{
89 _coeff.assign(_ncoeff, 0.0);
90
91 if (_rtype == 1)
92 {
94 paramError("order",
95 "Number of data points (",
97 ") must be greater than the number of terms in the polynomial (",
98 _ncoeff,
99 ").");
101 _rhs.resize(_ncoeff);
102 for (auto & calc : _calculators)
103 calc->initializeCalculator();
104 _r_sum = 0.0;
105 }
106}
void resize(const unsigned int new_m, const unsigned int new_n)

◆ threadJoin()

virtual void SurrogateTrainerBase::threadJoin ( const UserObject )
inlinefinalvirtualinherited

Reimplemented from GeneralUserObject.

Definition at line 40 of file SurrogateTrainer.h.

40{} // GeneralUserObjects are not threaded

◆ train()

void PolynomialChaosTrainer::train ( )
overridevirtual

Reimplemented from SurrogateTrainer.

Definition at line 109 of file PolynomialChaosTrainer.C.

110{
111 // Evaluate polynomials to avoid duplication
112 DenseMatrix<Real> poly_val(_ndim, _order);
113 for (unsigned int d = 0; d < _ndim; ++d)
114 for (unsigned int i = 0; i < _order; ++i)
115 poly_val(d, i) = _poly[d]->compute(i, _predictor_row[d], /*normalize=*/_rtype == 0);
116
117 // Evaluate multi-dimensional polynomials
118 std::vector<Real> basis(_ncoeff, 1.0);
119 for (const auto i : make_range(_ncoeff))
120 for (const auto d : make_range(_ndim))
121 basis[i] *= poly_val(d, _tuple[i][d]);
122
123 // For integration
124 if (_rtype == 0)
125 {
126 const Real fact = (*_rval) * (_quad_sampler ? _quad_sampler->getQuadratureWeight(_row) : 1.0);
127 for (const auto i : make_range(_ncoeff))
128 _coeff[i] += fact * basis[i];
129 }
130 // For least-squares
131 else
132 {
133 // Loop over coefficients
134 for (const auto i : make_range(_ncoeff))
135 {
136 // Matrix is symmetric, so we'll add the upper diagonal later
137 for (const auto j : make_range(i + 1))
138 _matrix(i, j) += basis[i] * basis[j];
139 _rhs(i) += basis[i] * (*_rval);
140
141 for (unsigned int c = i * 3; c < (i + 1) * 3; ++c)
142 _calculators[c]->updateCalculator(basis[i]);
143 }
144 _r_sum += (*_rval);
145
146 if (_ridge_penalty != 0.0)
147 for (const auto i : make_range(_ncoeff))
148 _matrix(i, i) += _ridge_penalty;
149 }
150}
for(PetscInt i=0;i< nvars;++i)
Real getQuadratureWeight(dof_id_type row_index) const

◆ updatePredictorRow()

void SurrogateTrainer::updatePredictorRow ( )
privateinherited

Definition at line 371 of file SurrogateTrainer.C.

372{
373 unsigned int d = 0;
374 for (const auto & val : _pvals)
375 _predictor_data[d++] = *val;
376 for (const auto & col : _pcols)
377 _predictor_data[d++] = _row_data[col];
378}

Referenced by SurrogateTrainer::crossValidate(), and SurrogateTrainer::executeTraining().

◆ validParams()

InputParameters PolynomialChaosTrainer::validParams ( )
static

Definition at line 17 of file PolynomialChaosTrainer.C.

18{
20 params.addClassDescription("Computes and evaluates polynomial chaos surrogate model.");
21 params.addRequiredParam<unsigned int>("order", "Maximum polynomial order.");
22 params.addRequiredParam<std::vector<DistributionName>>(
23 "distributions", "Names of the distributions samples were taken from.");
24 MooseEnum rtype("integration ols auto", "auto");
25 params.addParam<MooseEnum>(
26 "regression_type",
27 rtype,
28 "The type of regression to perform for finding polynomial coefficents.");
29 params.addParam<Real>("penalty", 0.0, "Ridge regularization penalty factor for OLS regression.");
30
31 params.suppressParameter<MooseEnum>("response_type");
32 return params;
33}
void suppressParameter(const std::string &name)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()

Member Data Documentation

◆ _calculators

std::vector<std::unique_ptr<RealCalculator> > PolynomialChaosTrainer::_calculators
private

Calculators used for standardization in linear regression.

Definition at line 63 of file PolynomialChaosTrainer.h.

Referenced by PolynomialChaosTrainer(), postTrain(), preTrain(), and train().

◆ _coeff

std::vector<Real>& PolynomialChaosTrainer::_coeff
private

These are the coefficients we are after in the PC expansion.

Definition at line 48 of file PolynomialChaosTrainer.h.

Referenced by postTrain(), preTrain(), and train().

◆ _converged

const bool* SurrogateTrainer::_converged
privateinherited

Whether or not the current sample has a converged solution.

Definition at line 170 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::executeTraining(), and SurrogateTrainer::SurrogateTrainer().

◆ _current_sample_size

unsigned int SurrogateTrainer::_current_sample_size
privateinherited

Number of samples used to train the model.

Definition at line 173 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::crossValidate(), SurrogateTrainer::execute(), and SurrogateTrainer::getCurrentSampleSize().

◆ _cv_generator

MooseRandom SurrogateTrainer::_cv_generator
privateinherited

Random number generator used for shuffling sampler rows during splitting.

Definition at line 196 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::crossValidate(), and SurrogateTrainer::SurrogateTrainer().

◆ _cv_n_trials

const unsigned int& SurrogateTrainer::_cv_n_trials
privateinherited

Number of repeated trials of cross validation to perform.

Definition at line 192 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::execute().

◆ _cv_seed

const unsigned int& SurrogateTrainer::_cv_seed
privateinherited

Seed used for _cv_generator.

Definition at line 194 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::SurrogateTrainer().

◆ _cv_surrogate

const SurrogateModel* SurrogateTrainer::_cv_surrogate
privateinherited

SurrogateModel used to evaluate model error relative to test points.

Definition at line 198 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::crossValidate(), and SurrogateTrainer::initialize().

◆ _cv_trial_scores

std::vector<std::vector<Real> >& SurrogateTrainer::_cv_trial_scores
privateinherited

RMSE scores from each CV trial - can be grabbed by VPP or Reporter.

Definition at line 202 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::execute().

◆ _cv_type

const MooseEnum& SurrogateTrainer::_cv_type
privateinherited

Type of cross validation to perform - for now, just 'none' (no CV) or 'k_fold'.

Definition at line 188 of file SurrogateTrainer.h.

◆ _doing_cv

const bool SurrogateTrainer::_doing_cv
privateinherited

Set to true if cross validation is being performed, controls behavior in execute().

Definition at line 200 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::execute(), SurrogateTrainer::initialize(), and SurrogateTrainer::SurrogateTrainer().

◆ _local_row

dof_id_type SurrogateTrainer::_local_row
protectedinherited

During training loop, this is the local row index of the data.

Definition at line 123 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::executeTraining().

◆ _local_sample_size

unsigned int SurrogateTrainer::_local_sample_size
privateinherited

Number of samples (locally) used to train the model.

Definition at line 176 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::crossValidate(), SurrogateTrainer::execute(), and SurrogateTrainer::getLocalSampleSize().

◆ _matrix

DenseMatrix<Real> PolynomialChaosTrainer::_matrix
private

Matrix and rhs for the regression problem

Definition at line 68 of file PolynomialChaosTrainer.h.

Referenced by postTrain(), preTrain(), and train().

◆ _model_meta_data_name

const std::string RestartableModelInterface::_model_meta_data_name
privateinherited

The model meta data name.

This is used to store the restartable data within the RestartableDataMap.

Definition at line 61 of file RestartableModelInterface.h.

Referenced by RestartableModelInterface::modelMetaDataName(), and RestartableModelInterface::RestartableModelInterface().

◆ _model_object

const MooseObject& RestartableModelInterface::_model_object
privateinherited

◆ _model_restartable

PublicRestartable RestartableModelInterface::_model_restartable
privateinherited

Member for interfacing with the framework's restartable system.

We need this because we would like to have the capability to handle the model data separately from the other data members used for checkpointing.

Definition at line 68 of file RestartableModelInterface.h.

Referenced by RestartableModelInterface::declareModelData(), and RestartableModelInterface::getModelData().

◆ _n_dims

unsigned int SurrogateTrainer::_n_dims
protectedinherited

◆ _n_outputs

unsigned int& SurrogateTrainer::_n_outputs
protectedinherited

◆ _n_splits

const unsigned int& SurrogateTrainer::_n_splits
privateinherited

Number of splits (k) to split sampler data into.

Definition at line 190 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::crossValidate(), and SurrogateTrainer::SurrogateTrainer().

◆ _ncoeff

std::size_t& PolynomialChaosTrainer::_ncoeff
private

Total number of coefficient (defined by size of _tuple)

Definition at line 45 of file PolynomialChaosTrainer.h.

Referenced by PolynomialChaosTrainer(), postTrain(), preTrain(), and train().

◆ _ndim

unsigned int& PolynomialChaosTrainer::_ndim
private

Total number of parameters/dimensions.

Definition at line 39 of file PolynomialChaosTrainer.h.

Referenced by PolynomialChaosTrainer(), and train().

◆ _order

const unsigned int& PolynomialChaosTrainer::_order
private

Maximum polynomial order. The sum of 1D polynomial orders does not go above this value.

Definition at line 36 of file PolynomialChaosTrainer.h.

Referenced by train().

◆ _pcols

std::vector<unsigned int> SurrogateTrainer::_pcols
protectedinherited

Columns from sampler for predictors.

Definition at line 131 of file SurrogateTrainer.h.

Referenced by PolynomialChaosTrainer(), SurrogateTrainer::SurrogateTrainer(), and SurrogateTrainer::updatePredictorRow().

◆ _poly

std::vector<std::unique_ptr<const PolynomialQuadrature::Polynomial> >& PolynomialChaosTrainer::_poly
private

The distributions used for sampling.

Definition at line 51 of file PolynomialChaosTrainer.h.

Referenced by PolynomialChaosTrainer(), and train().

◆ _predictor_data

std::vector<Real> SurrogateTrainer::_predictor_data
privateinherited

◆ _predictor_row

const std::vector<Real>& PolynomialChaosTrainer::_predictor_row
private

Predictor values.

Definition at line 33 of file PolynomialChaosTrainer.h.

Referenced by train().

◆ _pvals

std::vector<const Real *> SurrogateTrainer::_pvals
protectedinherited

◆ _quad_sampler

QuadratureSampler* PolynomialChaosTrainer::_quad_sampler
private

QuadratureSampler pointer, necessary for applying quadrature weights.

Definition at line 60 of file PolynomialChaosTrainer.h.

Referenced by PolynomialChaosTrainer(), postTrain(), and train().

◆ _r_sum

Real PolynomialChaosTrainer::_r_sum
private

Definition at line 64 of file PolynomialChaosTrainer.h.

Referenced by postTrain(), preTrain(), and train().

◆ _rhs

DenseVector<Real> PolynomialChaosTrainer::_rhs
private

Definition at line 69 of file PolynomialChaosTrainer.h.

Referenced by postTrain(), preTrain(), and train().

◆ _ridge_penalty

const Real& PolynomialChaosTrainer::_ridge_penalty
private

The penalty parameter for Ridge regularization.

Definition at line 57 of file PolynomialChaosTrainer.h.

Referenced by PolynomialChaosTrainer(), and train().

◆ _row

dof_id_type SurrogateTrainer::_row
protectedinherited

During training loop, this is the row index of the data.

Definition at line 121 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::executeTraining(), and train().

◆ _row_data

std::vector<Real> SurrogateTrainer::_row_data
privateinherited

◆ _rtype

unsigned int PolynomialChaosTrainer::_rtype
private

The method in which to perform the regression (0=integration, 1=OLS)

Definition at line 54 of file PolynomialChaosTrainer.h.

Referenced by PolynomialChaosTrainer(), postTrain(), preTrain(), and train().

◆ _rval

const Real* SurrogateTrainer::_rval
protectedinherited

◆ _rvecval

const std::vector<Real>* SurrogateTrainer::_rvecval
protectedinherited

◆ _sampler

Sampler& SurrogateTrainer::_sampler
protectedinherited

◆ _skip_indices

std::vector<dof_id_type> SurrogateTrainer::_skip_indices
privateinherited

Vector of indices to skip during executeTraining()

Definition at line 186 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::crossValidate(), and SurrogateTrainer::executeTraining().

◆ _skip_unconverged

const bool SurrogateTrainer::_skip_unconverged
privateinherited

Whether or not we are skipping samples that have unconverged solutions.

Definition at line 167 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::executeTraining(), and SurrogateTrainer::SurrogateTrainer().

◆ _smi_feproblem

FEProblemBase& SurrogateModelInterface::_smi_feproblem
privateinherited

◆ _smi_params

const InputParameters& SurrogateModelInterface::_smi_params
privateinherited

Parameters of the object with this interface.

Definition at line 70 of file SurrogateModelInterface.h.

Referenced by SurrogateModelInterface::getSurrogateModel(), and SurrogateModelInterface::getSurrogateTrainer().

◆ _smi_tid

const THREAD_ID SurrogateModelInterface::_smi_tid
privateinherited

Thread ID.

Definition at line 76 of file SurrogateModelInterface.h.

Referenced by SurrogateModelInterface::getSurrogateTrainerByName().

◆ _training_data

std::unordered_map<ReporterName, std::shared_ptr<TrainingDataBase> > SurrogateTrainer::_training_data
privateinherited

Vector of reporter names and their corresponding values (to be filled by getTrainingData)

Definition at line 179 of file SurrogateTrainer.h.

Referenced by SurrogateTrainer::checkIntegrity(), SurrogateTrainer::crossValidate(), SurrogateTrainer::executeTraining(), SurrogateTrainer::getTrainingData(), and SurrogateTrainer::initialize().

◆ _tuple

std::vector<std::vector<unsigned int> >& PolynomialChaosTrainer::_tuple
private

A _ndim-by-_ncoeff matrix containing the appropriate one-dimensional polynomial order.

Definition at line 42 of file PolynomialChaosTrainer.h.

Referenced by train().


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