Bijectors
fenbux
supports tensorflow_probability
-like and Bijectors.jl
-like bijector module.
For example, we can create a bijector and transform a sample as follows:
import jax.numpy as jnp
from fenbux.bijector import Exp, evaluate
bij = Exp()
x = jnp.array([1., 2., 3.])
evaluate(bij, x)
And inverse transform a sample as follows:
import jax.numpy as jnp
from fenbux.bijector import Exp, inverse, evaluate
bij = Exp()
y = jnp.array([1., 2., 3.])
evaluate(inverse(bij), y)
And you can apply a bijector to a distribution as follows:
import jax.numpy as jnp
from fenbux.bijector import Exp, transform
from fenbux.univariate import Normal
from fenbux import logpdf
dist = Normal(0, 1)
bij = Exp()
log_normal = transform(dist, bij)
x = jnp.array([1., 2., 3.])
logpdf(log_normal, x)
Functions that are supported for bijectors are:
fenbux.bijector.evaluate(bijector: Bijector, x: ArrayLike)
Evaluate a bijector on values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bijector |
Bijector |
A bijector object. |
required |
x |
ArrayLike |
Value to transform. |
required |
Examples:
from fenbux.bijector import evaluate, Identity evaluate(Identity(), 0.0)
fenbux.bijector.transform(d: AbstractDistribution, bijector: Bijector)
Transformed distribution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
d |
AbstractDistribution |
A distribution object. |
required |
bijector |
Bijector |
A bijector object. |
required |
Examples:
from fenbux.univariate import Normal from fenbux.bijector import transform, Identity dist = Normal(0.0, 1.0) transformed(dist, Identity())
fenbux.bijector.inverse(bijector: Bijector)
Inverse of a bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bijector |
Bijector |
A bijector object. |
required |
Examples:
from fenbux import inverse, Exp inverse(Exp())
fenbux.bijector.is_increasing(bijector: Bijector)
Check if a bijector is increasing
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bijector |
Bijector |
A bijector object. |
required |
Examples:
from fenbux.bijector import is_increasing, Identity is_increasing(Identity())
fenbux.bijector.ladj(bijector: Bijector, x: ArrayLike)
Log absolute determinant of the jacobian of a bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bijector |
Bijector |
A bijector object. |
required |
x |
ArrayLike |
Value to transform. |
required |
Examples:
from fenbux.bijector import ladj, Identity ladj(Identity(), 0.0)
fenbux.bijector.ildj(bijector: Bijector, x: ArrayLike)
Inverse log determinant of the jacobian of a bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bijector |
Bijector |
A bijector object. |
required |
x |
ArrayLike) |
Value to transform. |
required |
Examples:
from fenbux.bijector import ildj, Identity ildj(Identity(), 0.0)
fenbux.bijector.value_and_ladj(bijector: Bijector, x)
Value and log absolute determinant of the jacobian of a bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bijector |
Bijector |
A bijector object. |
required |
x |
ArrayLike |
Value to transform. |
required |
Examples:
from fenbux.bijector import value_and_ladj, Identity value_and_ladj(Identity(), 0.0)
Supported bijectors are:
fenbux.bijector.Exp
Exp Bijector
Examples:
>>> import jax.numpy as jnp
>>> from fenbux.bijectors import Exp, evaluate
>>> bij = Exp()
>>> x = jnp.array([1.0, 2.0, 3.0])
>>> y = evaluate(bij, x)
__class__
__signature__
property
readonly
__base__
__base__
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__new__(/, mcls, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__new__(/, mcs, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__call__(cls, *args, **kwargs)
Call self as a function.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
__new__(/, mcs, name, bases, dict_, strict: bool = False, abstract: bool = False, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__call__(cls, *args, **kwargs)
Call self as a function.
__getattribute__(cls, item)
Return getattr(self, name).
__setattr__(cls, item, value)
Implement setattr(self, name, value).
__delattr__(self, name)
Implement delattr(self, name).
__init__(self)
__setattr__(self, name, value)
Implement setattr(self, name, value).
__hash__(self)
Return hash(self).
__eq__(self, other) -> Union[bool, numpy.bool_, Array]
Return self==value.
__repr__(self)
Return repr(self).
fenbux.bijector.Log
Log Bijector
Examples:
>>> import jax.numpy as jnp
>>> from fenbux.bijectors import Log, evaluate
>>> bij = Log()
>>> x = jnp.array([1.0, 2.0, 3.0])
>>> y = evaluate(bij, x)
__class__
__signature__
property
readonly
__base__
__base__
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__new__(/, mcls, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__new__(/, mcs, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__call__(cls, *args, **kwargs)
Call self as a function.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
__new__(/, mcs, name, bases, dict_, strict: bool = False, abstract: bool = False, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__call__(cls, *args, **kwargs)
Call self as a function.
__getattribute__(cls, item)
Return getattr(self, name).
__setattr__(cls, item, value)
Implement setattr(self, name, value).
__delattr__(self, name)
Implement delattr(self, name).
__init__(self)
__setattr__(self, name, value)
Implement setattr(self, name, value).
__hash__(self)
Return hash(self).
__eq__(self, other) -> Union[bool, numpy.bool_, Array]
Return self==value.
__repr__(self)
Return repr(self).
fenbux.bijector.Shift
Shift Bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shift |
ArrayLike |
shift parameter |
required |
Examples:
>>> import jax.numpy as jnp
>>> from fenbux.bijector import Shift, evaluate
>>> bij = Shift(shift=2.0)
>>> x = jnp.array([1.0, 2.0, 3.0])
>>> y = evaluate(bij, x)
shift: ArrayLike
dataclass-field
__class__
__signature__
property
readonly
__base__
__base__
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__new__(/, mcls, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__new__(/, mcs, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__call__(cls, *args, **kwargs)
Call self as a function.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
__new__(/, mcs, name, bases, dict_, strict: bool = False, abstract: bool = False, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__call__(cls, *args, **kwargs)
Call self as a function.
__getattribute__(cls, item)
Return getattr(self, name).
__setattr__(cls, item, value)
Implement setattr(self, name, value).
__delattr__(self, name)
Implement delattr(self, name).
__setattr__(self, name, value)
Implement setattr(self, name, value).
__init__(self, shift: ArrayLike)
__hash__(self)
Return hash(self).
__eq__(self, other) -> Union[bool, numpy.bool_, Array]
Return self==value.
__repr__(self)
Return repr(self).
fenbux.bijector.Scale
Scale Bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale |
ArrayLike |
scale parameter |
required |
Examples:
>>> import jax.numpy as jnp
>>> from fenbux.bijector import Scale, evaluate
>>> bij = Scale(scale=2.0)
>>> x = jnp.array([1.0, 2.0, 3.0])
>>> y = evaluate(bij, x)
scale: ArrayLike
dataclass-field
__class__
__signature__
property
readonly
__base__
__base__
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__new__(/, mcls, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__new__(/, mcs, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__call__(cls, *args, **kwargs)
Call self as a function.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
__new__(/, mcs, name, bases, dict_, strict: bool = False, abstract: bool = False, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__call__(cls, *args, **kwargs)
Call self as a function.
__getattribute__(cls, item)
Return getattr(self, name).
__setattr__(cls, item, value)
Implement setattr(self, name, value).
__delattr__(self, name)
Implement delattr(self, name).
__setattr__(self, name, value)
Implement setattr(self, name, value).
__init__(self, scale: ArrayLike)
__hash__(self)
Return hash(self).
__eq__(self, other) -> Union[bool, numpy.bool_, Array]
Return self==value.
__repr__(self)
Return repr(self).
fenbux.bijector.Identity
Identity Bijector
Examples:
>>> import jax.numpy as jnp
>>> from fenbux.bijector import Identity, evaluate
>>> bij = Identity()
>>> x = jnp.array([1.0, 2.0, 3.0])
>>> y = evaluate(bij, x)
__class__
__signature__
property
readonly
__base__
__base__
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__new__(/, mcls, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__new__(/, mcs, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__call__(cls, *args, **kwargs)
Call self as a function.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
__new__(/, mcs, name, bases, dict_, strict: bool = False, abstract: bool = False, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__call__(cls, *args, **kwargs)
Call self as a function.
__getattribute__(cls, item)
Return getattr(self, name).
__setattr__(cls, item, value)
Implement setattr(self, name, value).
__delattr__(self, name)
Implement delattr(self, name).
__init__(self)
__setattr__(self, name, value)
Implement setattr(self, name, value).
__hash__(self)
Return hash(self).
__eq__(self, other) -> Union[bool, numpy.bool_, Array]
Return self==value.
__repr__(self)
Return repr(self).
fenbux.bijector.Logit
Logit Bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
a |
ArrayLike |
Lower bound of the input domain. Default value: 0.0. |
0.0 |
b |
ArrayLike |
Upper bound of the input domain. Default value: 1.0. |
1.0 |
Examples:
>>> import jax.numpy as jnp
>>> from fenbux.bijector import Logit, evaluate
>>> bij = Logit()
>>> x = jnp.array([0.1, 0.5, 0.9])
>>> y = evaluate(bij, x)
a: Union[jax.Array, numpy.ndarray, numpy.bool_, numpy.number, bool, int, float, complex]
dataclass-field
b: Union[jax.Array, numpy.ndarray, numpy.bool_, numpy.number, bool, int, float, complex]
dataclass-field
__class__
__signature__
property
readonly
__base__
__base__
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__new__(/, mcls, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__new__(/, mcs, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__call__(cls, *args, **kwargs)
Call self as a function.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
__new__(/, mcs, name, bases, dict_, strict: bool = False, abstract: bool = False, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__call__(cls, *args, **kwargs)
Call self as a function.
__getattribute__(cls, item)
Return getattr(self, name).
__setattr__(cls, item, value)
Implement setattr(self, name, value).
__delattr__(self, name)
Implement delattr(self, name).
__setattr__(self, name, value)
Implement setattr(self, name, value).
__init__(self, a: Union[jax.Array, numpy.ndarray, numpy.bool_, numpy.number, bool, int, float, complex] = 0.0, b: Union[jax.Array, numpy.ndarray, numpy.bool_, numpy.number, bool, int, float, complex] = 1.0)
__hash__(self)
Return hash(self).
__eq__(self, other) -> Union[bool, numpy.bool_, Array]
Return self==value.
__repr__(self)
Return repr(self).
fenbux.bijector.LeakyReLU
LeakyReLU Bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
alpha |
ArrayLike |
Slope of the negative part of the function. Default value: 0.2. |
0.2 |
Examples:
>>> import jax.numpy as jnp
>>> from fenbux.bijectors import LeakyReLU, evaluate
>>> bij = LeakyReLU(0.2)
>>> x = jnp.array([-1.0, 0.0, 1.0])
>>> y = evaluate(bij, x)
Array([-0.2, 0. , 1. ], dtype=float32)
alpha: ArrayLike
dataclass-field
__class__
__signature__
property
readonly
__base__
__base__
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__new__(/, mcls, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__new__(/, mcs, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__call__(cls, *args, **kwargs)
Call self as a function.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
__new__(/, mcs, name, bases, dict_, strict: bool = False, abstract: bool = False, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__call__(cls, *args, **kwargs)
Call self as a function.
__getattribute__(cls, item)
Return getattr(self, name).
__setattr__(cls, item, value)
Implement setattr(self, name, value).
__delattr__(self, name)
Implement delattr(self, name).
__setattr__(self, name, value)
Implement setattr(self, name, value).
__init__(self, alpha: ArrayLike = 0.2)
__hash__(self)
Return hash(self).
__eq__(self, other) -> Union[bool, numpy.bool_, Array]
Return self==value.
__repr__(self)
Return repr(self).
fenbux.bijector.Reshape
Reshape Bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
out_shape |
collections.abc.Sequence[int] |
The output shape. |
(-1,) |
in_shape |
collections.abc.Sequence[int] |
The input shape. |
(-1,) |
Examples:
>>> import jax.numpy as jnp
>>> from fenbux.bijector import Reshape, evaluate
>>> bij = Reshape(out_shape=(3, 2), in_shape=(2, 3))
>>> x = jnp.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
>>> y = evaluate(bij, x)
out_shape: collections.abc.Sequence[int]
dataclass-field
in_shape: collections.abc.Sequence[int]
dataclass-field
__class__
__signature__
property
readonly
__base__
__base__
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__new__(/, mcls, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__new__(/, mcs, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__call__(cls, *args, **kwargs)
Call self as a function.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
__new__(/, mcs, name, bases, dict_, strict: bool = False, abstract: bool = False, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__call__(cls, *args, **kwargs)
Call self as a function.
__getattribute__(cls, item)
Return getattr(self, name).
__setattr__(cls, item, value)
Implement setattr(self, name, value).
__delattr__(self, name)
Implement delattr(self, name).
__setattr__(self, name, value)
Implement setattr(self, name, value).
__init__(self, out_shape: collections.abc.Sequence[int] = (-1,), in_shape: collections.abc.Sequence[int] = (-1,))
__hash__(self)
Return hash(self).
__eq__(self, other) -> Union[bool, numpy.bool_, Array]
Return self==value.
__repr__(self)
Return repr(self).
fenbux.bijector.Chain
Chain Bijector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bijectors |
Sequence[Bijector] |
Sequence of bijectors to chain together. |
required |
Examples:
>>> import jax.numpy as jnp
>>> from fenbux.bijector import Chain, Exp, Log, Scale, Shift, evaluate
>>> bij = Chain([Exp(), Scale(2.0), Log(), Shift(1.0)])
>>> x = jnp.array([1.0, 2.0, 3.0])
>>> y = evaluate(bij, x)
bijectors: Sequence[fenbux.bijector._Bijector]
dataclass-field
__class__
__signature__
property
readonly
__base__
__base__
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as 'virtual subclasses' -- these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__new__(/, mcls, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__new__(/, mcs, name, bases, namespace, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
__call__(cls, *args, **kwargs)
Call self as a function.
__instancecheck__(cls, instance)
Override for isinstance(instance, cls).
__subclasscheck__(cls, subclass)
Override for issubclass(subclass, cls).
__new__(/, mcs, name, bases, dict_, strict: bool = False, abstract: bool = False, **kwargs)
staticmethod
Create and return a new object. See help(type) for accurate signature.
register(cls, subclass)
Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
__call__(cls, *args, **kwargs)
Call self as a function.
__getattribute__(cls, item)
Return getattr(self, name).
__setattr__(cls, item, value)
Implement setattr(self, name, value).
__delattr__(self, name)
Implement delattr(self, name).
__setattr__(self, name, value)
Implement setattr(self, name, value).
__init__(self, bijectors: Sequence[fenbux.bijector._Bijector])
__hash__(self)
Return hash(self).
__eq__(self, other) -> Union[bool, numpy.bool_, Array]
Return self==value.
__repr__(self)
Return repr(self).