verskyt.utils¶
Utility functions and helper modules.
Module: initializers¶
Custom initializers for Tversky neural network parameters.
Based on empirical findings from the paper’s experiments.
- uniform_init(tensor: Tensor, a: float = -1.0, b: float = 1.0)[source]¶
Uniform initialization.
Paper finding: Uniform initialization led to higher convergence probability for XOR compared to normal and orthogonal.
- xavier_uniform_init(tensor: Tensor, gain: float = 1.0)[source]¶
Xavier/Glorot uniform initialization.
- initialize_for_xor(prototypes: Tensor, features: Tensor, seed: int | None = None) tuple[Tensor, Tensor][source]¶
Initialize parameters specifically for XOR task.
Based on the paper’s Figure 1 showing a working XOR configuration: - 2 prototypes: p0 = {}, p1 = {f0, f1} - 2 features positioned to separate XOR classes
- Parameters:
prototypes – Prototype tensor to initialize [2, 2]
features – Feature tensor to initialize [num_features, 2]
seed – Random seed for reproducibility
- Returns:
Tuple of (initialized_prototypes, initialized_features)
- smart_init(layer: Module, method: str = 'xavier_uniform', **kwargs)[source]¶
Smart initialization for Tversky layers based on paper findings.
- Parameters:
layer – TverskyProjectionLayer or TverskySimilarityLayer
method – Initialization method
**kwargs – Additional arguments for initialization
Custom initialization strategies for Tversky Neural Network parameters.