Expand description
§zyx-optim
Optimizers for the zyx machine learning library.
This crate provides a collection of popular gradient-based optimization algorithms designed to work seamlessly with zyx’s autograd system. All optimizers implement the Module trait.
§Features
§Optimizers
Adam— Adaptive moment estimationAdamW— Adam with weight decay decouplingRMSprop— Root mean square propagationSGD— Stochastic gradient descent
§Python Bindings
pyfeature enables Python interoperability via pyo3
§Usage
use zyx_optim::{Adam, SGD};
// Create optimizer with default parameters
let mut optim = Adam::default();
// Configure hyperparameters
optim.learning_rate = 0.001; // learning rate
optim.betas = (0.9, 0.999); // first and second moment decay
optim.eps = 1e-8; // numerical stability
optim.weight_decay = 0.01; // L2 weight decay
optim.amsgrad = true; // enable AMSGrad variant§API
All optimizers implement the Module trait:
use zyx_optim::Adam;
let mut optim = Adam {
learning_rate: 0.001,
betas: (0.9, 0.999),
eps: 1e-8,
weight_decay: 0.0,
amsgrad: false,
m: Vec::new(),
v: Vec::new(),
vm: Vec::new(),
t: 0,
};
// Configure hyperparameters
optim.learning_rate = 0.001; // learning rate
optim.betas = (0.9, 0.999); // first and second moment decay
optim.eps = 1e-8; // numerical stability
optim.weight_decay = 0.01; // L2 weight decay§Hyperparameters
§Adam
learning_rate— Learning rate (default: 0.001)betas— First and second moment decay (default: (0.9, 0.999))eps— Numerical stability (default: 1e-8)weight_decay— L2 weight decay (default: 0.0)amsgrad— AMSGrad variant (default: false)
§AdamW
Same as Adam, with additional:
weight_decay— L2 weight decay (default: 0.0)
§RMSprop
learning_rate— Learning rate (default: 0.001)momentum— Moving average decay (default: 0.9)eps— Numerical stability (default: 1e-8)
§SGD
learning_rate— Learning rate (default: 0.01)momentum— Momentum coefficient (default: 0.0)weight_decay— L2 weight decay (default: 0.0)
§Features
py— Enable Python bindings via pyo3std— Enables zyx-core/std (default)
§Documentation
§License
LGPL-3.0-only