SToG.selectors
Feature selector implementations.
Classes
|
STG with explicit handling of correlated features. |
|
Gumbel-Softmax based feature selector. |
|
L1 regularization on input layer weights. |
|
Straight-Through Estimator for feature selection. |
|
Stochastic Gates (STG) - Original implementation from Yamada et al. 2020. |
- class SToG.selectors.STGLayer(input_dim: int, sigma: float = 0.5, device: str = 'cpu')[source]
Bases:
BaseFeatureSelectorStochastic Gates (STG) - Original implementation from Yamada et al. 2020. Uses Gaussian-based continuous relaxation of Bernoulli variables.
Reference: “Learning Feature Sparse Principal Subspace” (Yamada et al., ICML 2020)
- class SToG.selectors.STELayer(input_dim: int, device: str = 'cpu')[source]
Bases:
BaseFeatureSelectorStraight-Through Estimator for feature selection. Uses binary gates with gradient flow through sigmoid.
Reference: “Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation” (Bengio et al., 2013)
- class SToG.selectors.GumbelLayer(input_dim: int, temperature: float = 1.0, device: str = 'cpu')[source]
Bases:
BaseFeatureSelectorGumbel-Softmax based feature selector. Uses categorical distribution over {off, on} for each feature.
Reference: “Categorical Reparameterization with Gumbel-Softmax” (Jang et al., ICLR 2017)
Fixed implementation: Properly handles batch dimension and sampling.
- __init__(input_dim: int, temperature: float = 1.0, device: str = 'cpu')[source]
Initialize internal Module state, shared by both nn.Module and ScriptModule.
Bases:
BaseFeatureSelectorSTG with explicit handling of correlated features. Based on “Adaptive Group Sparse Regularization for Deep Neural Networks”. Uses group structure to handle feature correlation.
Reference: “Adaptive Group Sparse Regularization for Deep Neural Networks”
Initialize internal Module state, shared by both nn.Module and ScriptModule.
Apply correlated stochastic gates to input features.
Compute regularization with correlation penalty.
Get selection probabilities for each feature.
- class SToG.selectors.L1Layer(input_dim: int, device: str = 'cpu')[source]
Bases:
BaseFeatureSelectorL1 regularization on input layer weights. Baseline comparison method for feature selection.