26 #ifndef LSST_AFW_MATH_GAUSSIAN_PROCESS_H
27 #define LSST_AFW_MATH_GAUSSIAN_PROCESS_H
29 #include <Eigen/Dense>
33 #include "boost/shared_ptr.hpp"
130 template <
typename T>
133 ,
private boost::noncopyable
167 template <
typename T>
202 template <
typename T>
240 template <
typename T>
243 :
private boost::noncopyable
286 T
getData(
int ipt,
int idim)
const;
451 void _count(
int where,
int *ct)
const;
498 template <
typename T>
501 :
private boost::noncopyable
603 int numberOfNeighbors)
const;
622 int numberOfNeighbors)
const;
645 int numberOfNeighbors)
const;
664 int numberOfNeighbors)
const;
834 #endif //#ifndef LSST_AFW_MATH_GAUSSIAN_PROCESS_H
ndarray::Array< double, 1, 1 > _neighborDistances
int _findNode(ndarray::Array< const T, 1, 1 > const &v) const
Find the point already in the tree that would be the parent of a point not in the tree...
void setSigma1(double sigma1)
set the _sigma1 hyper parameter
void addPoint(ndarray::Array< const T, 1, 1 > const &v)
Add a point to the tree. Allot more space in _tree and data if needed.
ndarray::Array< int, 1, 1 > _neighborCandidates
T getData(int ipt, int idim) const
Return one element of one node on the tree.
Eigen matrix objects that present a view into an ndarray::Array.
void setSigma0(double sigma0)
set the _sigma0 hyper parameter
void _organize(ndarray::Array< int, 1, 1 > const &use, int ct, int parent, int dir)
Find the daughter point of a node in the tree and segregate the points around it. ...
Stores values of a function sampled on an image and allows you to interpolate the function to unsampl...
void addToTotal(int i)
Adds time to _totalTime and adds counts to _interpolationCount.
Include files required for standard LSST Exception handling.
This is a structure for keeping track of how long the interpolation methods spend on different parts ...
ndarray::Array< T, 1, 1 > _min
void _lookForNeighbors(ndarray::Array< const T, 1, 1 > const &v, int consider, int from) const
This method actually looks for the neighbors, determining whether or not to descend branches of the t...
void setCovariogram(boost::shared_ptr< Covariogram< T > > const &covar)
Assign a different covariogram to this GaussianProcess.
void findNeighbors(ndarray::Array< int, 1, 1 > neighdex, ndarray::Array< double, 1, 1 > dd, ndarray::Array< const T, 1, 1 > const &v, int n_nn) const
Find the nearest neighbors of a point.
The parent class of covariogram functions for use in Gaussian Process interpolation.
ndarray::Array< int, 2, 2 > _tree
void setKrigingParameter(T kk)
Assign a value to the Kriging paramter.
double _distance(ndarray::Array< const T, 1, 1 > const &p1, ndarray::Array< const T, 1, 1 > const &p2) const
calculate the Euclidean distance between the points p1 and p2
void start()
Starts the timer for an individual call to an interpolation routine.
void _count(int where, int *ct) const
A method which counts the number of nodes descended from a given node (used by removePoint(int)) ...
void addToVariance()
Adds time to _varianceTime.
void setLambda(T lambda)
set the value of the hyperparameter _lambda
ndarray::Array< T, 2, 2 > _function
void Initialize(ndarray::Array< T, 2, 2 > const &dt)
Build a KD Tree to store the data for GaussianProcess.
T selfInterpolate(ndarray::Array< T, 1, 1 > variance, int dex, int numberOfNeighbors) const
This method will interpolate the function on a data point for purposes of optimizing hyper parameters...
void batchInterpolate(ndarray::Array< T, 1, 1 > mu, ndarray::Array< T, 1, 1 > variance, ndarray::Array< T, 2, 2 > const &queries) const
Interpolate a list of query points using all of the input data (rather than nearest neighbors) ...
ndarray::Array< T, 1, 1 > _max
void addToIteration()
Adds time to _iterationTime.
The data for GaussianProcess is stored in a KD tree to facilitate nearest-neighbor searches...
a Covariogram that falls off as the negative exponent of the square of the distance between the point...
void _descend(int root)
Descend the tree from a node which has been removed, reassigning severed nodes as you go...
a Covariogram that recreates a neural network with one hidden layer and infinite units in that layer ...
GaussianProcessTimer & getTimes() const
Give the user acces to _timer, an object keeping track of the time spent on various processes within ...
Interface for DateTime class.
Covariogram()
construct a Covariogram assigning default values to the hyper parameters
A multidimensional strided array.
Citizen(const std::type_info &)
afw::table::Key< double > sigma1
void removePoint(int dex)
Remove a point from the tree. Reorganize what remains so that the tree remains self-consistent.
virtual ~SquaredExpCovariogram()
void getTreeNode(ndarray::Array< int, 1, 1 > const &v, int dex) const
Return the _tree information for a given data point.
ndarray::Array< int, 1, 1 > _inn
virtual T operator()(ndarray::Array< const T, 1, 1 > const &, ndarray::Array< const T, 1, 1 > const &) const
Actually evaluate the covariogram function relating two points you want to interpolate from...
GaussianProcessTimer _timer
void addToSearch()
Adds time to _searchTime.
int _walkUpTree(int target, int dir, int root) const
A method to make sure that every data point in the tree is in the correct position relative to its pa...
GaussianProcess(ndarray::Array< T, 2, 2 > const &dataIn, ndarray::Array< T, 1, 1 > const &ff, boost::shared_ptr< Covariogram< T > > const &covarIn)
This is the constructor you call if you do not wish to normalize the positions of your data points an...
void removePoint(int dex)
This will remove a point from the data set.
int _testTree() const
Make sure that the tree is properly constructed. Returns 1 of it is. Return zero if not...
ndarray::Array< T, 2, 2 > _data
virtual T operator()(ndarray::Array< const T, 1, 1 > const &, ndarray::Array< const T, 1, 1 > const &) const
Actually evaluate the covariogram function relating two points you want to interpolate from...
virtual T operator()(ndarray::Array< const T, 1, 1 > const &p1, ndarray::Array< const T, 1, 1 > const &p2) const
Actually evaluate the covariogram function relating two points you want to interpolate from...
void addPoint(ndarray::Array< T, 1, 1 > const &vin, T f)
Add a point to the pool of data used by GaussianProcess for interpolation.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
int getPoints() const
return the number of data points stored in the tree
boost::shared_ptr< Covariogram< T > > _covariogram
T interpolate(ndarray::Array< T, 1, 1 > variance, ndarray::Array< T, 1, 1 > const &vin, int numberOfNeighbors) const
Interpolate the function value at one point using a specified number of nearest neighbors.
virtual ~NeuralNetCovariogram()
void setEllSquared(double ellSquared)
set the _ellSquared hyper parameter (the square of the characteristic length scale of the covariogram...
void display()
Displays the current values of all times and _interpolationCount.
void _reassign(int target)
Reassign nodes to the tree that were severed by a call to removePoint(int)
void reset()
Resets all of the data members of GaussianProcessTimer to zero.
void addToEigen()
Adds time to _eigenTime.