GramMatrixHandler¶

class GramMatrixHandler¶

Bases: object

Compute and update the inverse of a Gram matrix sequentially with addition of a new data set.

Methods

__init__

Initialize a Gram matrix with the initial training data.

update

Update a Gram matrix and related intermediate variables sequentially with addition of a new data set.

Attributes

inv_gram_matrix

The inverse of a Gram matrix.

s

The intermediate output scalar, s.

sum_vx

sum(x * v).

v

The intermediate output vector, v.

__init__(kernel_func: Callable, init_x: ndarray, reg_param: float) None¶

Initialize a Gram matrix with the initial training data.

Parameters:
  • kernel_func (Callable) – A kernel function for Gram matrix.

  • init_x (np.ndarray) – Input value vectors in the initial training data.

  • reg_param (float) – A regularization parameter.

update(x: ndarray) None¶

Update a Gram matrix and related intermediate variables sequentially with addition of a new data set.

Parameters:

x (np.ndarray) – Input value vectors in the training data (with the last element being a newly added input value vector).

__dict__ = mappingproxy({'__module__': 'amplify_bbopt.trainer', '__doc__': 'Compute and update the inverse of a Gram matrix sequentially with addition of a new data set.', '__init__': <function GramMatrixHandler.__init__>, 'inv_gram_matrix': <property object>, 's': <property object>, 'v': <property object>, 'sum_vx': <property object>, '_calc_inv_gram_matrix': <function GramMatrixHandler._calc_inv_gram_matrix>, 'update': <function GramMatrixHandler.update>, '__dict__': <attribute '__dict__' of 'GramMatrixHandler' objects>, '__weakref__': <attribute '__weakref__' of 'GramMatrixHandler' objects>, '__annotations__': {'_s': 'float', '_v': 'np.ndarray', '_sum_vx': 'np.ndarray'}})¶
__weakref__¶

list of weak references to the object (if defined)

property inv_gram_matrix: ndarray¶

The inverse of a Gram matrix.

property s: float¶

The intermediate output scalar, s.

property sum_vx: ndarray¶

sum(x * v).

property v: ndarray¶

The intermediate output vector, v.