gpytorch.constraints

Parameter Constraints

Interval

class gpytorch.constraints.Interval(lower_bound, upper_bound, transform=<built-in method sigmoid of type object>, inv_transform=<function inv_sigmoid>, initial_value=None)[source]
property initial_value: Tensor | None

The initial parameter value (if specified, None otherwise)

intersect(other)[source]

Returns a new Interval constraint that is the intersection of this one and another specified one.

Parameters:

other (Interval) – Interval constraint to intersect with

Returns:

intersection if this interval with the other one.

Return type:

Interval

inverse_transform(transformed_tensor)[source]

Applies the inverse transformation.

Parameters:

transformed_tensor (Tensor) –

Return type:

Tensor

transform(tensor)[source]

Transforms a tensor to satisfy the specified bounds.

If upper_bound is finite, we assume that self.transform saturates at 1 as tensor -> infinity. Similarly, if lower_bound is finite, we assume that self.transform saturates at 0 as tensor -> -infinity.

Example transforms for one of the bounds being finite include torch.exp and torch.nn.functional.softplus. An example transform for the case where both are finite is torch.nn.functional.sigmoid.

Parameters:

tensor (Tensor) –

Return type:

Tensor

GreaterThan

class gpytorch.constraints.GreaterThan(lower_bound, transform=Softplus(beta=1.0, threshold=20.0), inv_transform=<function inv_softplus>, initial_value=None)[source]

Positive

class gpytorch.constraints.Positive(transform=Softplus(beta=1.0, threshold=20.0), inv_transform=<function inv_softplus>, initial_value=None)[source]

LessThan

class gpytorch.constraints.LessThan(upper_bound, transform=Softplus(beta=1.0, threshold=20.0), inv_transform=<function inv_softplus>, initial_value=None)[source]