adelie.matrix.convex_relu#
- adelie.matrix.convex_relu(mat: ndarray | csc_matrix, mask: ndarray, *, gated: bool = False, copy: bool = False, n_threads: int = 1)[source]#
Creates a feature matrix for the convex relu problem.
The feature matrix for the convex gated relu problem is given by
\[\begin{align*} Y &= \begin{bmatrix} D_1 Z & \ldots & D_m Z \end{bmatrix} \end{align*}\]where \(D_i \in \{0, 1\}^{n \times n}\) are diagonal masking matrices. The feature matrix for the convex relu problem is given by
\[\begin{align*} X &= \begin{bmatrix} Y & -Y \end{bmatrix} \end{align*}\]Note
This matrix only works for naive method!
- Parameters:
- mat(n, d) Union[ndarray, csc_matrix]
The base matrix \(Z\) from which to construct the convex relu matrix.
- mask(n, m) ndarray
The boolean mask matrix whose columns define the diagonal of \(D_i\). If it is not in
"F"
-ordering, an"F"
-ordered copy is made.- gatedbool, optional
If
True
, the matrix will represent \(Y\) and otherwise \(X\). Default isFalse
.- copybool, optional
If
True
, a copy of the inputs is stored internally. Otherwise, a reference is stored instead. Default isFalse
.- n_threadsint, optional
Number of threads. Default is
1
.
- Returns:
- wrap
Wrapper matrix object.
See also
adelie.adelie_core.matrix.MatrixNaiveConvexGatedReluDense32C
adelie.adelie_core.matrix.MatrixNaiveConvexGatedReluDense32F
adelie.adelie_core.matrix.MatrixNaiveConvexGatedReluDense64C
adelie.adelie_core.matrix.MatrixNaiveConvexGatedReluDense64F
adelie.adelie_core.matrix.MatrixNaiveConvexGatedReluSparse32F
adelie.adelie_core.matrix.MatrixNaiveConvexGatedReluSparse64F
adelie.adelie_core.matrix.MatrixNaiveConvexReluDense32C
adelie.adelie_core.matrix.MatrixNaiveConvexReluDense32F
adelie.adelie_core.matrix.MatrixNaiveConvexReluDense64C
adelie.adelie_core.matrix.MatrixNaiveConvexReluDense64F
adelie.adelie_core.matrix.MatrixNaiveConvexReluSparse32F
adelie.adelie_core.matrix.MatrixNaiveConvexReluSparse64F