Metadata-Version: 2.1
Name: narxpy
Version: 0.1.0
Summary: A PyTorch implementation of a NARX neural network.
Home-page: https://github.com/ilmarcopardo/NARX
Author: Marco Pardini
Author-email: marco.pardini@phd.unipi.it
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch >=1.8.0

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