sparse.nn.model.LISTA¶
- class sparse.nn.model.LISTA(in_features, out_features, n_folds=2, solver=BasisPursuitADMM(lambd=0.1, tol=0.0001, max_iters=100))[source]¶
Bases:
Module
Learned Iterative Shrinkage-Thresholding Algorithm [1] AutoEncoder neural network for sparse coding.
- Parameters
- in_featuresint
The num. of input features (X dimension).
- out_featuresint
The dimensionality of the embedding vector Z.
- n_foldsint
The num. of recursions to apply to get better convergence of Z. Must be greater or equal to 1.
- solverBasisPursuitADMM
Matching Pursuit solver for the \(Q_1^\epsilon\) problem (see
sparse.nn.solver.basis_pursuit_admm()
). Used only in forward_best function.
Notes
In overcomplete coding, where sparse representations emerge,
out_features >> in_features
. Ifout_features ≲ in_features
, the encoding representation will be dense.References
- 1
Gregor, K., & LeCun, Y. (2010, June). Learning fast approximations of sparse coding. In Proceedings of the 27th international conference on international conference on machine learning (pp. 399-406).
Methods
forward
(x)AutoEncoder forward pass.
forward_best
(x)Test function to match the output of the
MatchingPursuit
.Attributes
Learned Softshrink threshold vector of size
out_features
.- forward(x)[source]¶
AutoEncoder forward pass.
- Parameters
- x(B, C, H, W) torch.Tensor
A batch of input images
- Returns
- z(B, Z) torch.Tensor
Embedding vectors: sparse representation of x.
- decoded(B, C, H, W) torch.Tensor
Reconstructed x from z.
- forward_best(x)[source]¶
Test function to match the output of the
MatchingPursuit
.- Parameters
- x(B, C, H, W) torch.Tensor
A batch of input images
- Returns
- z(B, Z) torch.Tensor
Embedding vectors: sparse representation of x.
- decoded(B, C, H, W) torch.Tensor
Reconstructed x from z.
- property lambd¶
Learned Softshrink threshold vector of size
out_features
.