Next-Gen Temporal Fusion Architectures for Time-Series Forecasting
Project description
fusionlab-learn
A Research-Oriented Library for Advanced Time Series Forecasting with Hybrid, Transformer, and Physics-Informed Models
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
HALNetandXTFTthat 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
TransFlowSubsNetthat 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:
- Gated Residual Networks (GRNs) & Variable Selection Networks (VSNs)
- Specialized Attention Layers:
CrossAttention,HierarchicalAttention, andMemoryAugmentedAttention - Multi-Scale LSTMs for capturing temporal patterns at various resolutions.
⚛️ 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
HALNetandXTFT. - The tuner's
.create()factory method automatically infers data dimensions, making setup fast and easy.
🚀 Getting Started
Installation
-
Prerequisites:
- Python 3.9+
- TensorFlow >=2.15
-
Install from PyPI (Recommended):
pip install fusionlab-learn
-
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:
📄 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
-
Bug Reports & Feature Requests: The best place to report issues, ask questions about usage, or request new features is the GitHub Issues page for the project.
-
Developer Contact: For direct inquiries related to the project's origins or specific collaborations, you can reach the author:
- Name: Laurent Kouadio
- 📧 Email: etanoyau@gmail.com
- 💼 LinkedIn: linkedin.com/in/laurent-kouadio-483b2baa
- 🆔 ORCID: 0000-0001-7259-7254
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd2fe4d97341fb12cacee2b0e9d9ee3854ef39021ccf73d488e847b5187b0a26
|
|
| MD5 |
c9c9ce82cc96376592064c7da6a0c329
|
|
| BLAKE2b-256 |
1728d48f81c1e370231ffb781c1047561102ee2fdb61eaa6f5d370feb671a5bd
|
File details
Details for the file fusionlab_learn-0.3.1-py3-none-any.whl.
File metadata
- Download URL: fusionlab_learn-0.3.1-py3-none-any.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11883ed1505739747ebc436b838829ee62f4fa867c45a9a8db335a40a6a230d3
|
|
| MD5 |
e747d8b8c1f5fcde459360b006074720
|
|
| BLAKE2b-256 |
53989422ddd894054123aea30cc2dc3aa977a0b68145dd7aa0aed76e7b2a9b2c
|