Expand description
§Rust LSTM Library
A complete LSTM implementation with training capabilities, multiple optimizers, dropout regularization, and support for various architectures including peephole connections and bidirectional processing.
§Core Components
- LSTM Cells: Standard and peephole LSTM implementations with full backpropagation
- Bidirectional LSTM: Process sequences in both directions with flexible output combination
- Networks: Multi-layer LSTM networks for sequence modeling
- Training: Complete training system with BPTT, gradient clipping, and validation
- Optimizers: SGD, Adam, and RMSprop optimizers with adaptive learning rates
- Loss Functions: MSE, MAE, and Cross-Entropy with numerically stable implementations
- Dropout: Input, recurrent, output dropout and zoneout regularization
§Quick Start
use rust_lstm::models::lstm_network::LSTMNetwork;
use rust_lstm::training::create_basic_trainer;
// Create a 2-layer LSTM with 10 input features and 20 hidden units
let mut network = LSTMNetwork::new(10, 20, 2)
.with_input_dropout(0.2, true) // Variational input dropout
.with_recurrent_dropout(0.3, true) // Variational recurrent dropout
.with_output_dropout(0.1); // Standard output dropout
let mut trainer = create_basic_trainer(network, 0.001);
// Train on your data
// trainer.train(&train_data, Some(&validation_data));Re-exports§
pub use models::lstm_network::LSTMNetwork;pub use models::lstm_network::LSTMNetworkCache;pub use models::lstm_network::LSTMNetworkBatchCache;pub use models::lstm_network::LayerDropoutConfig;pub use models::gru_network::GRUNetwork;pub use models::gru_network::LayerDropoutConfig as GRULayerDropoutConfig;pub use models::gru_network::GRUNetworkCache;pub use layers::lstm_cell::LSTMCell;pub use layers::lstm_cell::LSTMCellCache;pub use layers::lstm_cell::LSTMCellBatchCache;pub use layers::lstm_cell::LSTMCellGradients;pub use layers::peephole_lstm_cell::PeepholeLSTMCell;pub use layers::gru_cell::GRUCell;pub use layers::gru_cell::GRUCellGradients;pub use layers::gru_cell::GRUCellCache;pub use layers::bilstm_network::BiLSTMNetwork;pub use layers::bilstm_network::CombineMode;pub use layers::bilstm_network::BiLSTMNetworkCache;pub use layers::dropout::Dropout;pub use layers::dropout::Zoneout;pub use training::LSTMTrainer;pub use training::ScheduledLSTMTrainer;pub use training::LSTMBatchTrainer;pub use training::TrainingConfig;pub use training::TrainingMetrics;pub use training::EarlyStoppingConfig;pub use training::EarlyStoppingMetric;pub use training::EarlyStopper;pub use training::create_basic_trainer;pub use training::create_step_lr_trainer;pub use training::create_one_cycle_trainer;pub use training::create_cosine_annealing_trainer;pub use training::create_basic_batch_trainer;pub use training::create_adam_batch_trainer;pub use optimizers::SGD;pub use optimizers::Adam;pub use optimizers::RMSprop;pub use optimizers::ScheduledOptimizer;pub use schedulers::LearningRateScheduler;pub use schedulers::ConstantLR;pub use schedulers::StepLR;pub use schedulers::MultiStepLR;pub use schedulers::ExponentialLR;pub use schedulers::CosineAnnealingLR;pub use schedulers::CosineAnnealingWarmRestarts;pub use schedulers::OneCycleLR;pub use schedulers::ReduceLROnPlateau;pub use schedulers::LinearLR;pub use schedulers::AnnealStrategy;pub use schedulers::PolynomialLR;pub use schedulers::CyclicalLR;pub use schedulers::CyclicalMode;pub use schedulers::ScaleMode;pub use schedulers::WarmupScheduler;pub use schedulers::LRScheduleVisualizer;pub use loss::LossFunction;pub use loss::MSELoss;pub use loss::MAELoss;pub use loss::CrossEntropyLoss;pub use persistence::ModelPersistence;pub use persistence::PersistentModel;pub use persistence::ModelMetadata;pub use persistence::PersistenceError;
Modules§
- layers
- loss
- models
- optimizers
- persistence
- schedulers
- training
- utils
- Main library module.