graphdot.model.gaussian_field.weight module¶
-
class
graphdot.model.gaussian_field.weight.
RBFOverDistance
(metric, sigma, sigma_bounds=(0.001, 1000.0), mopts={})[source]¶ Bases:
graphdot.model.gaussian_field.weight.Weight
Set weights by applying an RBF onto a distance matrix.
Parameters: - metric (callable) – An object that implements a distance metric.
- sigma (float) – The log scale hyperparameter for the RBF Kernel.
- sigma_bounds (float) – The bounds for sigma.
- sticky_cache (bool) – Whether or not to save the distance matrix upon first evaluation of the weights. This could speedup hyperparameter optimization if the underlying distance matrix remains unchanged during the process.
-
__call__
(X, Y=None, eval_gradient=False)[source]¶ Parameters: eval_gradient (bool) – If true, also return the gradient of the weights with respect to the log-scale hyperparameters.
-
bounds
¶ The log-scale bounds of the hyperparameters as a 2D array.
-
theta
¶ An ndarray of all the hyperparameters in log scale.
-
class
graphdot.model.gaussian_field.weight.
RBFOverFixedDistance
(D, sigma, sigma_bounds=(0.001, 1000.0), sticky_cache=False)[source]¶ Bases:
graphdot.model.gaussian_field.weight.Weight
Set weights by applying an (optimizable) RBF onto a fixed distance matrix.
Parameters: - metric (callable) – An object that implements a distance metric.
- sigma (float) – The log scale hyperparameter for the RBF Kernel.
- sigma_bounds (float) – The bounds for sigma.
-
__call__
(X, Y=None, eval_gradient=False)[source]¶ Parameters: eval_gradient (bool) – If true, also return the gradient of the weights with respect to the log-scale hyperparameters.
-
bounds
¶ The log-scale bounds of the hyperparameters as a 2D array.
-
theta
¶ An ndarray of all the hyperparameters in log scale.
-
class
graphdot.model.gaussian_field.weight.
Weight
[source]¶ Bases:
abc.ABC
-
__call__
(X, Y=None, eval_gradient=False)[source]¶ Computes the weight matrix and optionally its gradient with respect to hyperparameters.
Parameters: - X (list) – The first dataset to be compared.
- Y (list or None) – The second dataset to be compared. If None, X will be compared with itself.
- eval_gradient (bool) – If True, returns the gradient of the weight matrix alongside the matrix itself.
Returns: - weight_matrix (2D ndarray) – A weight matrix between the datasets.
- weight_matrix_gradients (3D ndarray) – A tensor where the i-th frontal slide [:, :, i] contain the partial derivative of the weight matrix with respect to the i-th hyperparameter.
-
bounds
¶ The log-scale bounds of the hyperparameters as a 2D array.
-
theta
¶ An ndarray of all the hyperparameters in log scale.
-