Skip to main content

A PyTorch implementation of a NARX neural network.

Project description

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}")

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

narxpy-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

narxpy-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file narxpy-0.1.0.tar.gz.

File metadata

  • Download URL: narxpy-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for narxpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 11698da8970cb274c6a397b017df18af7d76aa958dad0cf96b4edd6e428dbae7
MD5 22ecb35d1d2b0e7096e1b132a02bd38d
BLAKE2b-256 268903b371922a9403ea79a0507569be8ee854871ee17f0414236f7c9e0519bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for narxpy-0.1.0.tar.gz:

Publisher: python-publish.yml on ilmarcopardo/NARX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file narxpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: narxpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for narxpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1608eefecdf6918c0be73fad2bebb1937d2bc799de5bab0dc406b771cca98ec9
MD5 1fb338c7c9737ea027d7c937afe4d5c2
BLAKE2b-256 518a537686fae3012c406056c42f51c12674ba94ad7b430b29a311ba9540eff7

See more details on using hashes here.

Provenance

The following attestation bundles were made for narxpy-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on ilmarcopardo/NARX

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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