179 std::unordered_map<ReporterName, std::shared_ptr<TrainingDataBase>>
_training_data;
206 template <
typename T>
215 mooseError(
"Reporter value ", rname,
" already exists but is of different type.");
220 const std::vector<T> & rval = getReporterValueByName<std::vector<T>>(rname);
241 template <
typename T>
SurrogateTrainerBase(const InputParameters ¶meters)
virtual void initialize() final
unsigned int getCurrentSampleSize() const
const bool _doing_cv
Set to true if cross validation is being performed, controls behavior in execute().
virtual void finalize() final
const Real * _rval
Response value.
unsigned int _n_dims
Dimension of predictor data - either _sampler.getNumberOfCols() or _pvals.size() + _pcols...
virtual void initialize()
void updatePredictorRow()
TrainingData(const std::vector< T > &vector)
const unsigned int & _cv_n_trials
Number of repeated trials of cross validation to perform.
const std::vector< Real > * _rvecval
Vector response value.
std::vector< unsigned int > _pcols
Columns from sampler for predictors.
std::vector< const Real * > _pvals
Predictor values from reporters.
MooseRandom _cv_generator
Random number generator used for shuffling sampler rows during splitting.
std::vector< std::vector< Real > > & _cv_trial_scores
RMSE scores from each CV trial - can be grabbed by VPP or Reporter.
virtual void setCurrentIndex(dof_id_type index)=0
unsigned int & _n_outputs
The number of outputs.
static InputParameters validParams()
void checkIntegrity() const
std::vector< Real > crossValidate()
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.
std::vector< Real > _predictor_data
Predictor data for current row - can be combination of Sampler and Reporter values.
const std::vector< Real > & getSamplerData() const
std::vector< dof_id_type > _skip_indices
std::unordered_map< ReporterName, std::shared_ptr< TrainingDataBase > > _training_data
Vector of reporter names and their corresponding values (to be filled by getTrainingData) ...
virtual void threadJoin(const UserObject &) final
const T & getTrainingData(const ReporterName &rname)
virtual dof_id_type size() const =0
virtual dof_id_type size() const override
virtual std::vector< Real > evaluateModelError(const SurrogateModel &surr)
const std::vector< T > & _vector
unsigned int getLocalSampleSize() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This is the main trainer base class.
Interface for objects that need to use samplers.
const std::vector< Real > & getPredictorData() const
std::vector< Real > _row_data
Sampler data for the current row.
unsigned int _local_sample_size
Number of samples (locally) used to train the model.
void mooseError(Args &&... args) const
const InputParameters & parameters() const
unsigned int _current_sample_size
Number of samples used to train the model.
const unsigned int & _n_splits
Number of splits (k) to split sampler data into.
const bool * _converged
Whether or not the current sample has a converged solution.
SurrogateTrainer(const InputParameters ¶meters)
const SurrogateModel * _cv_surrogate
SurrogateModel used to evaluate model error relative to test points.
static InputParameters validParams()
This is the base trainer class whose main functionality is the API for declaring model data...
virtual void setCurrentIndex(dof_id_type index) override
const bool _skip_unconverged
Whether or not we are skipping samples that have unconverged solutions.
const unsigned int & _cv_seed
Seed used for _cv_generator.
virtual ~TrainingDataBase()=default
const MooseEnum & _cv_type
Type of cross validation to perform - for now, just 'none' (no CV) or 'k_fold'.
An interface class which manages the model data save and load functionalities from moose objects (suc...
virtual void execute() final