GramMatrixHandler¶
- class GramMatrixHandler¶
Bases:
object
Compute and update the inverse of a Gram matrix sequentially with addition of a new data set.
Methods
Initialize a Gram matrix with the initial training data.
Update a Gram matrix and related intermediate variables sequentially with addition of a new data set.
Attributes
The inverse of a Gram matrix.
The intermediate output scalar, s.
sum(x * 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)