mojolearn.ConstantKernel#

class mojolearn.ConstantKernel(constant_value=1.0, constant_value_bounds=(1e-05, 100000.0))[source]#

Bases: Kernel

Constant kernel: k(x, y) = constant_value for every pair of points.

Follows scikit-learn’s ConstantKernel. Multiply it with another kernel to scale that kernel’s magnitude.

Parameters:
  • constant_value (float, default 1.0) – The constant.

  • constant_value_bounds (pair of float or “fixed”, default (1e-5, 1e5)) – Bounds for the optimizer, or "fixed" to keep the value fixed. Both bounds must be finite and positive with low <= high; otherwise ValueError is raised.

Examples

>>> import mojolearn
>>> kernel = mojolearn.ConstantKernel(2.0) * mojolearn.RBF(1.0)
__init__(constant_value=1.0, constant_value_bounds=(1e-05, 100000.0))[source]#

Attributes

bounds

Natural log of each free hyperparameter's (low, high) bounds, as a list of [low, high] pairs.

n_dims

Number of free hyperparameters (the length of theta).

theta

Natural log of the free hyperparameters, as a list of floats.