|
| LeastSquaresExtrapolation () |
|
| LeastSquaresExtrapolation (unsigned max, const ContainerType0 ©able0, const ContainerType1 ©able1) |
| Set maximum number of vectors and allocate memory. More...
|
|
void | set_max (unsigned max, const ContainerType0 ©able0, const ContainerType1 ©able1) |
| Set maximum number of vectors and allocate memory. More...
|
|
unsigned | get_max () const |
|
void | extrapolate (double alpha, const ContainerType0 &x, double beta, ContainerType1 &y) const |
| extrapolate value at a new unkown value \( y = \alpha f(x) + \beta y \) More...
|
|
void | extrapolate (const ContainerType0 &x, ContainerType1 &y) const |
| extrapolate value at a new unkown value \( y = f(x) \) More...
|
|
void | update (const ContainerType0 &x_new, const ContainerType1 &y_new) |
| insert a new entry / train the machine learning algorithm More...
|
|
template<class ContainerType0, class ContainerType1>
struct dg::LeastSquaresExtrapolation< ContainerType0, ContainerType1 >
Evaluate a least squares fit
This class gathers pairs of (features, labels) vectors \( (\vec x_i, \vec y_i)\) and then constructs a guess for \( y\) for given unkown \( \vec x\) by constructing the least squares coefficients
\[ \min ||a_i \vec x_i - \vec x||\]
to get
\[ \vec y = a_i \vec y_i\]
- Note
- This works best if the unkown function \( \vec y = f(\vec x) \) is linear and if the \( x_i\) are orthogonal
extra.update( x0, y0);
extra.update( x1, y1);
extra.update( x1, y1);
extra.extrapolate( x, y);
- Template Parameters
-
ContainerType | Any class for which a specialization of TensorTraits exists and which fulfills the requirements of the there defined data and execution policies derived from AnyVectorTag and AnyPolicyTag . Among others
dg::HVec (serial), dg::DVec (cuda / omp), dg::MHVec (mpi + serial) or dg::MDVec (mpi + cuda / omp)
std::vector<dg::DVec> (vector of shared device vectors), std::array<double, 4> (array of 4 doubles) or std::map < std::string, dg::DVec> ( a map of named vectors)
double (scalar) and other primitive types ...
If there are several ContainerTypes in the argument list, then TensorTraits must exist for all of them |
- See also
- See The dg dispatch system for a detailed explanation of our type dispatch system