glearn.Covariance.set_scale#

Covariance.set_scale(scale)#

Sets the array of scale hyperparameters of the correlation matrix.

Parameters:
scalefloat or array_like[float], default=None

The scale hyperparameters \(\boldsymbol{\alpha} = (\alpha_1, \dots, \alpha_d)\) in scales the distance between data points in \(\mathbb{R}^d\). If an array of the size \(d\) is given, each \(\alpha_i\) scales the distance in the \(i\)-th dimension. If a scalar value \(\alpha\) is given, all dimensions are scaled isometrically. If set to None, optimal values of the scale hyperparameters are found during the training process by the automatic relevance determination (ARD).

Examples

Set scales \(\boldsymbol{\alpha} = [2, 3]\) for a two-dimensional data:

>>> # Generate a set of points
>>> from glearn.sample_data import generate_points
>>> x = generate_points(num_points=20, dimension=2)

>>> # Create a covariance object
>>> from glearn import Covariance
>>> cov = Covariance(x)
>>> cov.get_scale()
None

>>> # Change scale
>>> cov.set_scale([2.0, 3.0])
>>> cov.get_scale()
array([2., 3.])