Class FastIVM¶
Defined in File FastIVM.h
Class Documentation¶
-
class FastIVM : public IVM¶
This is a faster implementation of the IVM.
\[ f(S) = \frac{1}{2}\log\det\left(\Sigma + \sigma \cdot \mathcal I \right) \]where \(\Sigma\) is the kernel matrix of all elements in the summary, \( \mathcal I \) is the \( K \times K \) identity matrix and \( \sigma > 0 \) is a scaling parameter.This implementation caches the current kernel matrix \( \Sigma \) and maintains a cholesky decomposition of it to quickly recompute the log-determinant. This implementation requires the maximum number items in the summary and the maximum size (rows and columns) of \Sigma beforehand. It allocates the appropriate memory during construction. This implementation is optimized towards adding new elements to the summary, but not replacing existing ones. Added a new row / column to a cholesky decomposition is a rank-1 update which can be performed in \( O(K^2) \) for \( K \times K \) matrices. Whenever an element in the matrix must be replaced, the entire cholesky decomposition must be recomputed leading to \( O(K^3) \). This class internally uses the Matrix class for somewhat readable linear algebra.
References
Herbrich, R., Lawrence, N., & Seeger, M. (2003). Fast Sparse Gaussian Process Methods: The Informative Vector Machine. In S. Becker, S. Thrun, & K. Obermayer (Eds.), Advances in Neural Information Processing Systems (Vol. 15, pp. 625–632). MIT Press. Retrieved from https://proceedings.neurips.cc/paper/2002/file/d4dd111a4fd973394238aca5c05bebe3-Paper.pdf
Public Functions
-
inline FastIVM(unsigned int K, Kernel const &kernel, data_t sigma)¶
Creates a new FastIVM object.
- Parameters
K – The number of elements to be stored in the summary
&kernel – The kernel function
sigma – The scaling constant for the kernel
-
inline FastIVM(unsigned int K, std::function<data_t(std::vector<data_t> const&, std::vector<data_t> const&)> kernel, data_t sigma)¶
Creates a new FastIVM object.
- Parameters
K – The number of elements to be stored in the summary
&kernel – The kernel function
sigma – The scaling constant for the kernel
-
inline virtual data_t peek(std::vector<std::vector<data_t>> const &cur_solution, std::vector<data_t> const &x, unsigned int pos) override¶
Peek operator for the FastIVM. For more details see SubmodularFunction. This function adds the vector of kernel evaluations to the current kernel matrix and performs a rank-1 update to the cholesky decomposition, if possible. When a new element is added (pos >= added) then the runtime is O(K^2) where K = cur_solution.size() and added is the number of previous
updatecalls. If an existing element is replaced (pos < added), then the cholesky decomposition cannot be updated with a rank-1 update. In this case the runtime is O(K^3) since the cholesky decomposition is recomputed.- Parameters
cur_solution – The current summary
&x – The element which should be added to the summary
pos – The position at which the given element should be inserted. If pos >= cur_solution.size(), then x is appended. Otherwise it replaces the element at position pos
- Returns The
log-determinant of the kernel matrix, if x would be inserted at position pos in current_solution
-
inline virtual void update(std::vector<std::vector<data_t>> const &cur_solution, std::vector<data_t> const &x, unsigned int pos) override¶
Update the current solution. Does the same as
peekand additionally preserves any changes to the kernel matrix.- Parameters
cur_solution – The current summary
&x – The element which should be added to the summary
pos – The position at which the given element should be inserted. If pos >= cur_solution.size(), then x is appended. Otherwise it replaces the element at position pos
-
inline virtual data_t operator()(std::vector<std::vector<data_t>> const &cur_solution) const override¶
Returns the current function value which has been computed and cached during the
updatecalls. The function value does not depend on cur_solution in this case, but only on the order and values supplied duringupdatecalls to this object.Note
The runtime is O(1). Nothing is computed.
- Parameters
&cur_solution – Has no effect
- Returns The
log-determinant of the kernel matrix supplied during
update
-
inline virtual std::shared_ptr<SubmodularFunction> clone() const override¶
Clones the current object. The cloned object has an empty kernel matrix. No values are copied.
Note
Calls the clone method of the given kernel. If the kernel implements a deep-copy, then the cloned kernel is a deep copy. Besides that, this is not a deep copy.
- Returns The
cloned object.