Class interp_krige_optim (o2scl)¶
-
template<class vec_t, class vec2_t = vec_t, class mat_t = boost::numeric::ublas::matrix<double>, class mat_inv_t = o2scl_linalg::matrix_invert_det_cholesky<mat_t>>
class interp_krige_optim : public o2scl::interp_krige<vec_t, vec_t, std::function<double(double, double)>, std::function<double(double, double, double)>, boost::numeric::ublas::matrix<double>, o2scl_linalg::matrix_invert_det_cholesky<boost::numeric::ublas::matrix<double>>>¶ One-dimensional interpolation using an optimized covariance function.
See also the Interpolation section of the O2scl User’s guide.
Note
This class is experimental.
Function to minimize and various option
-
static const size_t mode_loo_cv = 1¶
Leave-one-out cross validation.
-
static const size_t mode_max_lml = 2¶
Minus Log-marginal-likelihood.
-
static const size_t mode_loo_cv_new = 3¶
New leave-one-out cross validation method.
-
size_t mode¶
Function to minimize (default mode_loo_cv)
Public Types
-
typedef boost::numeric::ublas::vector<double> ubvector¶
Public Functions
-
inline interp_krige_optim()¶
-
inline virtual int set_noise(size_t size, const vec_t &x, const vec2_t &y, double noise_var, bool rescale = false, bool err_on_fail = true)¶
Initialize interpolation routine.
Public Members
-
int verbose¶
Verbosity parameter.
-
size_t nlen¶
Number of length scale points to try when full minimizer is not used (default 20)
-
min_brent_gsl def_min¶
Default minimizer.
-
bool full_min¶
If true, use the full minimizer.
Protected Functions
-
inline double covar(double x1, double x2)¶
The covariance function.
-
inline double deriv_covar(double x1, double x2)¶
The derivative of the covariance function.
-
inline double deriv2_covar(double x1, double x2)¶
The second derivative of the covariance function.
-
inline double integ_covar(double x, double x1, double x2)¶
The integral of the covariance function.
The integral of the function is
\[ \int_a^b f(x) dx = \sum_i A_i \int_a^b C(x,x_i) dx \]where \( A_i = (K^{-1})_{ij} f_j \). To compute the integral we use\[ \int_a^b C(x,x_i) dx = \int_{a+x_i}^{b+x_i} \exp \left( - \frac{x^2}{2 L^2} \right) dx = \int_{(a+x_i)/(L\sqrt{2})}^{(b+x_i)/(L\sqrt{2})} L \sqrt{2} \exp \left( - y^2 \right) dy \]But\[ \mathrm{erf}(x) \equiv \frac{2}{\sqrt{\pi}} \int_0^{x} e^{-t^2} \]so\[ \int_a^b C(x,x_i) dx = L \frac{\sqrt{\pi}}{\sqrt{2}} \left[ \mathrm{erf}\left( \frac{b+x_i}{L \sqrt{2}} \right) - \mathrm{erf}\left( \frac{a+x_i}{L \sqrt{2}} \right) \right] \]
-
inline double qual_fun(double x, double noise_var, int &success)¶
Function to optimize the covariance parameters.
Protected Attributes
-
std::function<double(double, double)> ff¶
Function object for the covariance.
-
std::function<double(double, double)> ffd¶
Function object for the covariance.
-
std::function<double(double, double)> ffd2¶
Function object for the covariance.
-
std::function<double(double, double, double)> ffi¶
Function object for the covariance.
-
double len¶
The covariance function length scale.
-
double qual¶
The quality factor of the optimization.
-
static const size_t mode_loo_cv = 1¶