Class IVM

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class IVM : public SubmodularFunction

This class implements the InformativeVectorMachine:

\[ 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 is lazy and slow. It recomputes \( \Sigma \) in every evaluation. For a faster and more practical alternative please have a look at the FastIVM class. This class internally uses the Matrix class for somewhat readable linear algebra.

References

Subclassed by FastIVM

Public Functions

inline IVM(Kernel const &kernel, data_t sigma)

Creates a new IVM object with the given parameters.

Note

This constructor uses assert to make sure that sigma has the correct range. This may lead to warnings during compilation.

Parameters
  • &kernel – The kernel to be used.

  • sigma – The scaling constant

Returns A

new IVM object

inline IVM(std::function<data_t(std::vector<data_t> const&, std::vector<data_t> const&)> kernel, data_t sigma)

Creates a new IVM object with the given parameters.

Note

This constructor uses assert to make sure that sigma has the correct range. This may lead to warnings during compilation.

Parameters
  • kernel – The kernel to be used.

  • sigma – The scaling constant

Returns A

new IVM object

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 IVM. For more details see SubmodularFunction. This implementation simply adds / replaces the current item in the summary and recomputes the kernel matrix as well as the log-determinant. The runtime of this implementation is O(K^3) with K = cur_solution.size()

Note

The log-determinant is computed via a cholesky decomposition.

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

Does nothing and only exists for compatibility reasons.

Parameters
  • &cur_solution –

  • &x –

  • pos –

Returns None

inline virtual data_t operator()(std::vector<std::vector<data_t>> const &X) const override

Computes the kernel matrix \Sigma + \sigma \cdot \mathcal I between all pairs in X and its log-determinant. The runtime is O(K^3) where K = X.size().

Note

The log-determinant is computed via a cholesky decomposition.

Parameters

&X – The argument at which \(f(X) = \frac{1}{2}\log\det\left(\Sigma + \sigma \cdot \mathcal I \right)\) should be evaluated

Returns The

log-determinant of the kernel matrix of all pairs in X

inline virtual std::shared_ptr<SubmodularFunction> clone() const override

Clones the current IVM object.

Note

Calls the clone method of the given kernel. If the kernel implements a deep-copy, then this clone operation is also a deep -opy. Otherwise it is not.

Returns The

cloned object.

inline ~IVM()

Destroys the current object.

Note

Returns

Protected Functions

inline Matrix compute_kernel(std::vector<std::vector<data_t>> const &X, data_t sigma) const

Computes the kernel similarity \Sigma + \sigma \cdot \mathcal I between all pairs in X.

Parameters
  • &X – The current summary

  • sigma – Scaling for main-diagonal

Returns The

\(K \times K\) kernel matrix

Protected Attributes

std::shared_ptr<Kernel> kernel
data_t sigma