Skip to main content

Next-Gen Temporal Fusion Architectures for Time-Series Forecasting

Project description

FusionLab Logo


fusionlab-learn

A Research-Oriented Library for Advanced Time Series Forecasting with Hybrid, Transformer, and Physics-Informed Models

PyPI Version Documentation Status Build Status Python Version License

fusionlab-learn is a flexible and extensible Python package for building and experimenting with state-of-the-art time series models. It provides robust, research-grade implementations of advanced architectures, from data-driven forecasters to novel Physics-Informed Neural Networks (PINNs).

Whether you're a researcher exploring new architectures or a practitioner building production-grade forecasting systems, fusionlab-learn provides tools built on TensorFlow/Keras to accelerate your work.


✨ Key Features

🏛️ A Spectrum of Advanced Architectures

The library provides implementations across three major families of forecasting models.

  • Hybrid Models: Architectures like HALNet and XTFT that fuse the sequential processing power of LSTMs with the long-range context modeling of attention mechanisms.
  • Pure Transformers: Implementations of the standard "Attention Is All You Need" encoder-decoder architecture, adapted for time series forecasting.
  • Physics-Informed Models (PINNs): State-of-the-art hybrid models like TransFlowSubsNet that integrate physical laws (PDEs) directly into the training process to produce physically consistent and robust forecasts.

🧩 Modular & Reusable Components

Build custom models with a rich set of well-tested neural network blocks, including:

⚛️ PINN Capabilities

  • Solve coupled-physics problems with models like TransFlowSubsNet.
  • Perform inverse modeling by configuring physical coefficients (K, Ss, C) as learnable parameters.
  • Utilize specialized PINN data utilities for the unique sequence and coordinate preparation required by these models.

🛠️ Unified Hyperparameter Tuning

  • Leverage the HydroTuner to automatically find optimal hyperparameters for all hydrogeological PINN models.
  • Use dedicated tuners for data-driven models like HALNet and XTFT.
  • The tuner's .create() factory method automatically infers data dimensions, making setup fast and easy.

🚀 Getting Started

Installation

  1. Prerequisites:

  2. Install from PyPI (Recommended):

    pip install fusionlab-learn
    
  3. Install from Source (for Development):

    git clone https://github.com/earthai-tech/fusionlab-learn.git
    cd fusionlab-learn
    pip install -e .
    

Quick Example

import numpy as np
import tensorflow as tf
from fusionlab.nn.models import HALNet # Or any other model

# --- 1. Prepare Dummy Data ---
# (Replace with your actual preprocessed & sequenced data)
B, T, D_dyn = 16, 10, 3  # Batch, TimeSteps, DynamicFeatures
D_stat = 2               # StaticFeatures
D_fut = 1                # FutureFeatures
H = 5                    # Forecast Horizon

# Model expects list: [Static, Dynamic, Future]
dummy_static = np.random.rand(B, D_stat).astype(np.float32)
dummy_dynamic = np.random.rand(B, T, D_dyn).astype(np.float32)
# For 'tft_like' mode, future input spans past + horizon
dummy_future = np.random.rand(B, T + H, D_fut).astype(np.float32)
dummy_target = np.random.rand(B, H, 1).astype(np.float32)

model_inputs = [dummy_static, dummy_dynamic, dummy_future]

# --- 2. Instantiate Model ---
model = HALNet(
    static_input_dim=D_stat,
    dynamic_input_dim=D_dyn,
    future_input_dim=D_fut,
    forecast_horizon=H,
    max_window_size=T,
    output_dim=1,
    hidden_units=16, # Smaller units for quick example
    num_heads=2
)

# --- 3. Compile & Train ---
model.compile(optimizer='adam', loss='mse')
print("Training simple model...")
model.fit(model_inputs, dummy_target, epochs=2, batch_size=4, verbose=0)
print("Training finished.")

# --- 4. Predict ---
print("Making predictions...")
predictions = model.predict(model_inputs)
print("Prediction shape:", predictions.shape)
# Expected: (16, 5, 1) -> (Batch, Horizon, NumOutputs)

(See the Quickstart Guide for a more detailed walkthrough.)


📚 Documentation

For detailed usage, tutorials, API reference, and explanations of the underlying concepts, please see the full documentation:

Read the Documentation


📄 License

This project is licensed under the BSD-3-Clause. See the LICENSE file for details.


🤝 Contributing

We welcome contributions! Whether it's adding new features, fixing bugs, or improving documentation, your help is appreciated. Please see our Contribution Guidelines for more details on how to get started.


📞 Contact & Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fusionlab_learn-0.3.1.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fusionlab_learn-0.3.1-py3-none-any.whl (2.4 MB view details)

Uploaded Python 3

File details

Details for the file fusionlab_learn-0.3.1.tar.gz.

File metadata

  • Download URL: fusionlab_learn-0.3.1.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for fusionlab_learn-0.3.1.tar.gz
Algorithm Hash digest
SHA256 bd2fe4d97341fb12cacee2b0e9d9ee3854ef39021ccf73d488e847b5187b0a26
MD5 c9c9ce82cc96376592064c7da6a0c329
BLAKE2b-256 1728d48f81c1e370231ffb781c1047561102ee2fdb61eaa6f5d370feb671a5bd

See more details on using hashes here.

File details

Details for the file fusionlab_learn-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fusionlab_learn-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11883ed1505739747ebc436b838829ee62f4fa867c45a9a8db335a40a6a230d3
MD5 e747d8b8c1f5fcde459360b006074720
BLAKE2b-256 53989422ddd894054123aea30cc2dc3aa977a0b68145dd7aa0aed76e7b2a9b2c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page