Crate nt_neural

Crate nt_neural 

Source
Expand description

Neural forecasting models for time series prediction in trading.

This crate provides high-performance neural network models optimized for financial time series forecasting with GPU acceleration support.

§Models

  • NHITS: Neural Hierarchical Interpolation for Time Series
  • LSTM-Attention: LSTM with multi-head attention mechanism
  • Transformer: Transformer architecture for time series
  • GRU: Gated Recurrent Unit (simpler than LSTM)
  • TCN: Temporal Convolutional Network
  • DeepAR: Probabilistic forecasting with LSTM
  • N-BEATS: Pure MLP with interpretable decomposition
  • Prophet: Time series decomposition (trend + seasonality)

§Features

  • GPU acceleration (CUDA, Metal)
  • Mixed precision training (FP16/FP32)
  • Quantile regression for confidence intervals
  • Model checkpointing and versioning
  • Integration with AgentDB for model storage
  • SIMD acceleration for CPU operations (requires nightly Rust)

§Examples

use nt_neural::{NHITSModel, ModelConfig, TrainingConfig};

// Create model configuration
let _config = ModelConfig {
    input_size: 168,  // 1 week of hourly data
    horizon: 24,      // 24 hour forecast
    hidden_size: 512,
    ..Default::default()
};

// Initialize model
let model = NHITSModel::new(config)?;

// Train model (data preparation omitted)
// let trained_model = model.train(train_data, val_data).await?;

Re-exports§

pub use error::NeuralError;
pub use error::Result;
pub use training::TrainingConfig;
pub use training::TrainingMetrics;
pub use inference::PredictionResult;
pub use stubs::Device;
pub use stubs::Tensor;

Modules§

error
Error types for the neural module
inference
Inference engine for neural models with <10ms latency
storage
Model storage and retrieval integration with AgentDB
stubs
Stub implementations when candle feature is not enabled
training
Training infrastructure for neural models
utils
Utility functions for neural module

Functions§

initialize
Placeholder when candle is not enabled