mxnet.gluon.probability.distributions.constraint

Base class and implementations of constraint

Functions

is_dependent(constraint)

Classes

Boolean()

Constrain to {0, 1}.

Cat(constraint_seq[, axis, lengths])

Constraint functor that applies a sequence of constraints constraint_seq at the submatrices at axis, each of size lengths[axis], in compatible with np.concatenate().

Constraint()

Base class for constraints.

GreaterThan(lower_bound)

Constrain to be greater than lower_bound.

GreaterThanEq(lower_bound)

Constrain to be greater than or equal to lower_bound.

HalfOpenInterval(lower_bound, upper_bound)

Constrain to a real interval [lower_bound, upper_bound)

IntegerGreaterThan(lower_bound)

Constrain to be integer and be greater than lower_bound.

IntegerGreaterThanEq(lower_bound)

Constrain to be integer and be greater than or equal to lower_bound.

IntegerHalfOpenInterval(lower_bound, upper_bound)

Constrain to an integer interval [lower_bound, upper_bound)

IntegerInterval(lower_bound, upper_bound)

Constrain to an integer interval [lower_bound, upper_bound]

IntegerLessThan(upper_bound)

Constrain to be integer and be less than upper_bound.

IntegerLessThanEq(upper_bound)

Constrain to be integer and be less than or equal to upper_bound.

IntegerOpenInterval(lower_bound, upper_bound)

Constrain to an integer interval (lower_bound, upper_bound)

Interval(lower_bound, upper_bound)

Constrain to a real interval [lower_bound, upper_bound]

LessThan(upper_bound)

Constrain to be less than upper_bound.

LessThanEq(upper_bound)

Constrain to be less than upper_bound.

LowerCholesky()

Constraint to square lower triangular matrices with real and positive diagonal entries.

LowerTriangular()

Constraint to square lower triangular matrices.

NonNegative()

Constrain to be greater than or equal to zero.

NonNegativeInteger()

Constrain to be non-negative integer.

OpenInterval(lower_bound, upper_bound)

Constrain to a real interval (lower_bound, upper_bound)

Positive()

Constrain to be greater than zero.

PositiveDefinite()

Constraint to positive-definite matrices.

PositiveInteger()

Constrain to be positive integer.

Real()

Constrain to be a real number.

Simplex()

Constraint to the simplex that rightmost dimension lies on a simplex.

Stack(constraint_seq[, axis])

Constraint functor that applies a sequence of constraints constraint_seq at the submatrices at axis, in compatible with np.stack().

UnitInterval()

Constrain to an unit interval [0, 1]

dependent_property

alias of _DependentProperty

class mxnet.gluon.probability.distributions.constraint.Boolean[source]

Bases: Constraint

Constrain to {0, 1}.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.Cat(constraint_seq, axis=0, lengths=None)[source]

Bases: Constraint

Constraint functor that applies a sequence of constraints constraint_seq at the submatrices at axis, each of size lengths[axis], in compatible with np.concatenate().

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.Constraint[source]

Bases: object

Base class for constraints.

A constraint object represents a region over which a variable is valid.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.GreaterThan(lower_bound)[source]

Bases: Constraint

Constrain to be greater than lower_bound.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.GreaterThanEq(lower_bound)[source]

Bases: Constraint

Constrain to be greater than or equal to lower_bound.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.HalfOpenInterval(lower_bound, upper_bound)[source]

Bases: Constraint

Constrain to a real interval [lower_bound, upper_bound)

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.IntegerGreaterThan(lower_bound)[source]

Bases: Constraint

Constrain to be integer and be greater than lower_bound.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.IntegerGreaterThanEq(lower_bound)[source]

Bases: Constraint

Constrain to be integer and be greater than or equal to lower_bound.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.IntegerHalfOpenInterval(lower_bound, upper_bound)[source]

Bases: Constraint

Constrain to an integer interval [lower_bound, upper_bound)

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.IntegerInterval(lower_bound, upper_bound)[source]

Bases: Constraint

Constrain to an integer interval [lower_bound, upper_bound]

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.IntegerLessThan(upper_bound)[source]

Bases: Constraint

Constrain to be integer and be less than upper_bound.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.IntegerLessThanEq(upper_bound)[source]

Bases: Constraint

Constrain to be integer and be less than or equal to upper_bound.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.IntegerOpenInterval(lower_bound, upper_bound)[source]

Bases: Constraint

Constrain to an integer interval (lower_bound, upper_bound)

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.Interval(lower_bound, upper_bound)[source]

Bases: Constraint

Constrain to a real interval [lower_bound, upper_bound]

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.LessThan(upper_bound)[source]

Bases: Constraint

Constrain to be less than upper_bound.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.LessThanEq(upper_bound)[source]

Bases: Constraint

Constrain to be less than upper_bound.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.LowerCholesky[source]

Bases: Constraint

Constraint to square lower triangular matrices with real and positive diagonal entries.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.LowerTriangular[source]

Bases: Constraint

Constraint to square lower triangular matrices.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.NonNegative[source]

Bases: GreaterThanEq

Constrain to be greater than or equal to zero.

class mxnet.gluon.probability.distributions.constraint.NonNegativeInteger[source]

Bases: IntegerGreaterThanEq

Constrain to be non-negative integer.

class mxnet.gluon.probability.distributions.constraint.OpenInterval(lower_bound, upper_bound)[source]

Bases: Constraint

Constrain to a real interval (lower_bound, upper_bound)

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.Positive[source]

Bases: GreaterThan

Constrain to be greater than zero.

class mxnet.gluon.probability.distributions.constraint.PositiveDefinite[source]

Bases: Constraint

Constraint to positive-definite matrices.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.PositiveInteger[source]

Bases: IntegerGreaterThan

Constrain to be positive integer.

class mxnet.gluon.probability.distributions.constraint.Real[source]

Bases: Constraint

Constrain to be a real number. (exclude np.nan)

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.Simplex[source]

Bases: Constraint

Constraint to the simplex that rightmost dimension lies on a simplex. x >= 0 and x.sum(-1) == 1.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.Stack(constraint_seq, axis=0)[source]

Bases: Constraint

Constraint functor that applies a sequence of constraints constraint_seq at the submatrices at axis, in compatible with np.stack().

Stack is currently only supported in imperative mode.

check(value)[source]

Check if value satisfies the constraint, return the origin value if valid, raise ValueError with given message otherwise.

Parameters:

value (Tensor) – Input tensor to be checked.

class mxnet.gluon.probability.distributions.constraint.UnitInterval[source]

Bases: Interval

Constrain to an unit interval [0, 1]