Flows¶
DiagAffine
¶
A specification for the diagonal affine flow.
Definition
\(T(\mathbf{z}) = \mathbf{d} \odot \mathbf{z} + \mathbf{c}\)
Where \(\mathbf{z} \in \mathbb{R}^D\), \(\mathbf{d} \in \mathbb{R}^{D}\) is non-negative, and \(\mathbf{c} \in \mathbb{R}^D\).
Attributes:
| Name | Type | Description |
|---|---|---|
key |
PRNGKeyArray
|
The PRNG key used to generate the diagonal affine flow layer. |
Source code in src/bayinx/flows/diagaffine.py
__init__(key: PRNGKeyArray = jr.key(0))
¶
Initializes the specification for a diagonal affine flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
PRNGKeyArray
|
A PRNG key used to generate the diagonal affine flow. |
key(0)
|
construct(dim: int) -> DiagAffineLayer
¶
Constructs a diagonal affine flow layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
The dimension of the parameter space. |
required |
Returns:
| Type | Description |
|---|---|
DiagAffineLayer
|
A DiagonalAffineLayer of dimension |
Source code in src/bayinx/flows/diagaffine.py
FullAffine
¶
A specification for the full affine flow.
Definition
\(T(\mathbf{z}) = \mathbf{L z} + \mathbf{c}\)
Where \(\mathbf{z} \in \mathbb{R}^D\), \(\mathbf{L} \in \mathbb{R}^{D, D}\) is lower triangular with a non-negative diagonal, and \(\mathbf{c} \in \mathbb{R}^D\).
Attributes:
| Name | Type | Description |
|---|---|---|
key |
PRNGKeyArray
|
The PRNG key used to generate the full affine flow layer. |
Source code in src/bayinx/flows/fullaffine.py
__init__(key: PRNGKeyArray = jr.key(0))
¶
Initializes the specification for a full affine flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
PRNGKeyArray
|
A PRNG key used to generate the full affine flow. |
key(0)
|
construct(dim: int) -> FullAffineLayer
¶
Constructs a full affine flow layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
The dimension of the parameter space. |
required |
Returns:
| Type | Description |
|---|---|
FullAffineLayer
|
A FullAffineLayer of dimension |
Source code in src/bayinx/flows/fullaffine.py
LowRankAffine
¶
A specification for the low-rank affine flow.
Definition
\(T(\mathbf{z}) = \mathbf{D z} + ((\mathbf{U V}^\top) \odot \mathbf{M})\mathbf{z} + \mathbf{c}\)
Where \(\mathbf{z} \in \mathbb{R}^D\), \(\mathbf{D} \in \mathbb{R}^{D, D}\) is a non-negative diagonal matrix, \(\mathbf{U}, \mathbf{V} \in \mathbb{R}^{D, R}\) are low-rank factor matrices, \(\mathbf{M} \in \mathbb{R}^{D, D}\) is an implicit strictly lower-triangular mask, and \(\mathbf{c} \in \mathbb{R}^D\) is the shift vector.
Attributes:
| Name | Type | Description |
|---|---|---|
rank |
int
|
The rank \(R\) of the low-rank factor matrices \(\mathbf{U}\) and \(\mathbf{V}\). |
Source code in src/bayinx/flows/lowrankaffine.py
__init__(rank: int)
¶
Initializes the specification for a low-rank affine flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rank
|
int
|
The rank R (number of columns in U and V) of the low-rank off-diagonal component. |
required |
construct(dim: int) -> LowRankAffineLayer
¶
Constructs a low-rank affine flow layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
The dimension of the parameter space. |
required |
Returns:
| Type | Description |
|---|---|
LowRankAffineLayer
|
A LowRankAffineLayer of dimension |
Source code in src/bayinx/flows/lowrankaffine.py
Planar
¶
A specification for the Planar flow.
Definition
\(T(\mathbf{z}) = \mathbf{z} + \mathbf{u} h(\mathbf{w}^\top \mathbf{z} + b)\)
Source code in src/bayinx/flows/planar.py
Sylvester
¶
A specification for the Sylvester flow.
Definition
\(T(\mathbf{z}) = \mathbf{z} + \mathbf{Q} \mathbf{R}_1 h(\mathbf{R}_2 \mathbf{Q}^\top \mathbf{z} + \mathbf{b})\)
Attributes:
| Name | Type | Description |
|---|---|---|
rank |
int
|
The rank of the Sylvester flow (number of hidden units). |
key |
PRNGKeyArray
|
The PRNG key used to generate a Sylvester flow layer. |
Source code in src/bayinx/flows/sylvester.py
__init__(rank: int, key: PRNGKeyArray = jr.key(0))
¶
Initializes the specification for a Sylvester flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rank
|
int
|
The rank of the transformation (number of hidden units). |
required |
key
|
PRNGKeyArray
|
A PRNG key used to generate the flow layer. |
key(0)
|
Source code in src/bayinx/flows/sylvester.py
construct(dim: int) -> SylvesterLayer
¶
Constructs a Sylvester flow layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim
|
int
|
The dimension of the parameter space. |
required |
Returns:
| Type | Description |
|---|---|
SylvesterLayer
|
A SylvesterLayer of dimension |