https://mooseframework.inl.gov
PolynomialRegressionTrainer.h
Go to the documentation of this file.
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 "libmesh/utility.h"
13 #include "SurrogateTrainer.h"
15 #include "Calculators.h"
16 
18 
20 {
21 public:
23 
25 
26  virtual void preTrain() override;
27 
28  virtual void train() override;
29 
30  virtual void postTrain() override;
31 
32 private:
34  const std::vector<Real> & _predictor_row;
35 
38 
40  const Real & _penalty;
41 
43  std::vector<std::vector<Real>> & _coeff;
44 
46  const unsigned int & _max_degree;
47 
49  const std::vector<std::vector<unsigned int>> & _power_matrix;
50 
52  const unsigned int _n_poly_terms;
53 
57  std::vector<DenseVector<Real>> _rhs;
59 
61  std::vector<std::unique_ptr<RealCalculator>> _calculators;
62 
64  std::vector<Real> _r_sum;
65 };
const unsigned int _n_poly_terms
Number of terms in the polynomial expression.
const std::vector< Real > & _predictor_row
Data from the current predictor row.
std::vector< std::unique_ptr< RealCalculator > > _calculators
Calculators used in standardizing polynomial features.
std::vector< std::vector< Real > > & _coeff
Coefficients of regression model.
const Real & _penalty
The penalty parameter for Ridge regularization.
std::vector< Real > _r_sum
Calculator used to sum response values.
PolynomialRegressionTrainer(const InputParameters &parameters)
const std::vector< std::vector< unsigned int > > & _power_matrix
Matirx co containing the touples of the powers for each term.
const unsigned int & _max_degree
Maximum polynomial degree, limiting the sum of constituent polynomial degrees.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This is the main trainer base class.
std::vector< DenseVector< Real > > _rhs
const MooseEnum & _regression_type
Types for the polynomial regression.
const InputParameters & parameters() const
StochasticTools::Calculator< std::vector< Real >, Real > RealCalculator
static InputParameters validParams()