narxpy: PyTorch NARX Implementation
A simple, reusable PyTorch implementation of a Nonlinear Autoregressive Network with Exogenous Inputs (NARX).
Features
- Supports configurable input/output delays (
d_i,d_o). - Handles multi-dimensional exogenous (
x) and endogenous (y) time series. - Configurable hidden layer size and output activation function.
- Supports different simulation modes:
- Close Loop (Parallel): Uses own predictions for feedback (standard simulation/forecasting).
- Open Loop (Series-Parallel): Uses provided true values for feedback (teacher forcing, common for training).
- Includes optional bootstrapping for initializing close-loop simulations.
Installation
pip install narxpy
Usage
import torch
from narxpy import NARX
model = NARX(d_i=d_i, d_o=d_o, d_x=d_x, d_y=d_y, d_hl=d_hl, act_func=act_func)
# --- Run Modes ---
# 1. Close Loop (Simulation - Default)
y_pred_close = model(x_data, mode="close")
print(f"Close loop output shape: {y_pred_close.shape}")
# 2. Open Loop (Teacher Forcing)
y_pred_open = model(x_data, mode="open", y=y_true)
print(f"Open loop output shape: {y_pred_open.shape}")
# 3. Close Loop with Bootstrap
y_pred_bootstrap = model(x_data, mode="close", y=y_true, bootstrap=bootstrap_steps)
print(f"Bootstrap output shape: {y_pred_bootstrap.shape}")
Metadata
Release files for narxpy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| narxpy-0.1.0.tar.gz | 8.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| narxpy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / narxpy-0.1.0.tar.gz
| Download URL | narxpy-0.1.0.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11698da8970cb274c6a397b017df18af7d76aa958dad0cf96b4edd6e428dbae7
|
|
BLAKE2b-256 checksum How to use checksums |
268903b371922a9403ea79a0507569be8ee854871ee17f0414236f7c9e0519bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 18, 2025.
Transparency logRelease files / narxpy-0.1.0-py3-none-any.whl
| Download URL | narxpy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1608eefecdf6918c0be73fad2bebb1937d2bc799de5bab0dc406b771cca98ec9
|
|
BLAKE2b-256 checksum How to use checksums |
518a537686fae3012c406056c42f51c12674ba94ad7b430b29a311ba9540eff7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 18, 2025.
Transparency log