neuro_divergent_models/lib.rs
1//! # Neuro-Divergent Models
2//!
3//! A comprehensive neural forecasting library built on top of ruv-FANN, providing
4//! state-of-the-art time series forecasting models for production use.
5//!
6//! This library implements 27+ neural forecasting models inspired by NeuralForecast,
7//! optimized for Rust's performance and safety guarantees.
8//!
9//! ## Features
10//!
11//! - **Recurrent Models**: RNN, LSTM, GRU with temporal state management
12//! - **Transformer Models**: Multi-head attention, TFT, and advanced architectures
13//! - **Linear Models**: DLinear, NLinear with decomposition
14//! - **Specialized Models**: NBEATS, TimesNet, and domain-specific architectures
15//! - **Production Ready**: Type-safe, memory-efficient, and scalable
16//!
17//! ## Quick Start
18//!
19//! ```rust
20//! use neuro_divergent_models::{NeuralForecast, models::LSTM, LSTMConfig};
21//! use neuro_divergent_models::data::TimeSeriesDataFrame;
22//!
23//! // Create LSTM model
24//! let lstm_config = LSTMConfig::default_with_horizon(24)
25//! .with_architecture(128, 2, 0.1)
26//! .with_training(1000, 0.001);
27//!
28//! let lstm = LSTM::new(lstm_config)?;
29//!
30//! // Create forecasting pipeline
31//! let mut nf = NeuralForecast::new()
32//! .with_model(Box::new(lstm))
33//! .build()?;
34//!
35//! // Train and forecast
36//! nf.fit(train_data)?;
37//! let forecasts = nf.predict()?;
38//! # Ok::<(), Box<dyn std::error::Error>>(())
39//! ```
40
41// Core error handling
42pub use errors::{NeuroDivergentError, NeuroDivergentResult};
43
44// Core traits and foundations
45pub use foundation::{BaseModel, NetworkAdapter, ModelConfig};
46pub use foundation::{TimeSeriesInput, ForecastOutput, ValidationConfig};
47
48// Data structures
49pub use data::{TimeSeriesDataFrame, ForecastDataFrame, TimeSeriesSchema};
50
51// Main forecasting interface
52pub use forecasting::NeuralForecast;
53
54// Model configurations
55pub use config::{LSTMConfig, RNNConfig, GRUConfig};
56pub use config::{TrainingConfig, PredictionConfig, CrossValidationConfig};
57
58// Re-export commonly used types from ruv-FANN
59pub use ruv_fann::{ActivationFunction, Network, Layer, Neuron};
60pub use num_traits::Float;
61
62// Modules
63pub mod errors;
64pub mod foundation;
65pub mod data;
66pub mod forecasting;
67pub mod config;
68
69// Model implementations
70pub mod models {
71 //! Neural forecasting model implementations
72 pub use crate::recurrent::{RNN, LSTM, GRU};
73}
74
75// Model categories
76pub mod recurrent;
77
78// Core components
79pub mod activations;
80pub mod layers;
81
82// Utilities
83pub mod utils;
84
85// Test utilities for other crates
86#[cfg(feature = "testing")]
87pub mod test_utils;