# sysidentpy **Repository Path**: bbindong/sysidentpy ## Basic Information - **Project Name**: sysidentpy - **Description**: No description available - **Primary Language**: Unknown - **License**: BSD-3-Clause - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-09 - **Last Updated**: 2026-05-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
## How do I install SysIdentPy?
The easiest way to get SysIdentPy running is to install it using ``pip``
``` console
pip install sysidentpy
```
### Requirements
`SysIdentPy` requires:
- Python (>= 3.10)
- NumPy (>= 1.19.2) for numerical algorithms
- Matplotlib >= 3.3.2 for static plotting and visualizations
- Pytorch (>=1.7.1) for building NARX neural networks
- scipy (>= 1.8.0) for numerical and optimization algorithms
The library is compatible with Linux, Windows, and macOS. Some examples may also require additional packages like pandas.
For more details, check our [installation guide](https://sysidentpy.org/getting-started/getting-started/)
## Experimental Array API Support
SysIdentPy includes experimental, opt-in Array API support following the same general approach used by SciPy and scikit-learn.
- Enable dispatch with `set_config(array_api_dispatch=True)` or `config_context(array_api_dispatch=True)`.
- Current backend-native support includes the supported model structure selection algorithms, simulation, metrics, utilities, and the `Polynomial`, `Fourier`, and `Bilinear` basis functions.
- Current automated coverage is strongest for NumPy, PyTorch, and `array_api_strict`. CuPy and JAX remain experimental compatibility targets.
- On non-NumPy backends, 1-step prediction stays backend-native. Sequential prediction (`steps_ahead=None` and `steps_ahead > 1`) currently runs through a NumPy/CPU fallback and converts predictions back to the original namespace/device.
See the [Array API dispatch guide](https://sysidentpy.org/user-guide/how-to/array-api-dispatch/) for the exact support matrix and current limitations.
## What are the main features of SysIdentPy?
| Feature | What is this? |
|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| NARMAX philosophy | You can build variations of NARMAX models like NARX, NAR, NARMA, NFIR, ARMA, ARX, AR, and others. |
| Model Structure Selection | Easy-to-use methods to select the best terms to build your models, including FROLS, MetaMSS, AOLS, UOFR, Entropic Regression, RMSS, and Orthogonal Floating Search (OSF, OIF, OOS/O2S), with several combinations with parameter estimation techniques to select the model terms. |
| Basis Function | You can use up to 8 different basis functions to build your models. You can set linear and nonlinear basis functions and ensemble them to get custom NARMAX models. |
| Parameter Estimation | More than 15 methods to estimate the model parameters and test different structure selection scenarios. |
| Multiobjective Parameter Estimation | You can use affine information to estimate the model parameters minimizing different objective functions. |
| Model Simulation | You can reproduce results from papers easily with SimulateNARMAX class. Moreover, you can test published models with different parameter estimation methods and compare the performance. |
| Neural NARX | You can use SysIdentPy with Pytorch to create custom neural NARX models architectures which support all the optimizers and loss functions from Pytorch. |
| General Estimators | You can use estimators from packages like scikit-learn, Catboost, and many other compatible interfaces and composition tools to create NARMAX models. |
## Why does SysIdentPy exist?
SysIdentPy aims to be a free and open-source package to help the community to design NARMAX models for System Identification and TimeSeries Forecasting. More than that, be a free and robust alternative to one of the most used tools to build NARMAX models, which is the Matlab's System Identification Toolbox.
The project is actively maintained by Wilson R. L. Junior and looking for contributors.
## How do I use SysIdentPy?
The [SysIdentPy documentation](https://sysidentpy.org) includes more than 20 examples to help get you started:
- Quickstart guide, for an [entry-level description of the main SysIdentPy concepts](https://sysidentpy.org/getting-started/quickstart-guide/)
- A dedicated section focusing on SysIdentPy features, like model structure selection algorithms, basis functions, parameter estimation, and more.
- A dedicated section focusing on use cases using SysIdentPy with real world datasets. Besides, there is some brief comparisons and benchmarks against other time series tools, like Prophet, Neural Prophet, ARIMA, and more.
### Examples
```python
from torch import nn
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sysidentpy.metrics import root_relative_squared_error
from sysidentpy.utils.generate_data import get_siso_data
# Generate a dataset of a simulated dynamical system
x_train, x_valid, y_train, y_valid = get_siso_data(
n=1000,
colored_noise=False,
sigma=0.001,
train_percentage=80
)
```
#### Building Polynomial NARX models with FROLS algorithm
```python
from sysidentpy.model_structure_selection import FROLS
from sysidentpy.basis_function import Polynomial
from sysidentpy.parameter_estimation import LeastSquares
from sysidentpy.metrics import root_relative_squared_error
from sysidentpy.utils.generate_data import get_siso_data
from sysidentpy.utils.display_results import results
from sysidentpy.utils.plotting import plot_residues_correlation, plot_results
from sysidentpy.residues.residues_correlation import (
compute_residues_autocorrelation,
compute_cross_correlation,
)
basis_function = Polynomial(degree=2)
estimator = LeastSquares()
model = FROLS(
order_selection=True,
n_info_values=3,
ylag=2,
xlag=2,
info_criteria="aic",
estimator=estimator,
err_tol=None,
basis_function=basis_function,
)
model.fit(X=x_train, y=y_train)
yhat = model.predict(X=x_valid, y=y_valid)
rrse = root_relative_squared_error(y_valid, yhat)
print(rrse)
r = pd.DataFrame(
results(
model.final_model, model.theta, model.err,
model.n_terms, err_precision=8, dtype='sci'
),
columns=['Regressors', 'Parameters', 'ERR'])
print(r)
```
```console
Regressors Parameters ERR
0 x1(k-2) 0.9000 0.95556574
1 y(k-1) 0.1999 0.04107943
2 x1(k-1)y(k-1) 0.1000 0.00335113
````
```python
plot_results(y=y_valid, yhat=yhat, n=100, figsize=(14, 3), linewidth=1.5)
```

#### NARX Neural Network
```python
from sysidentpy.neural_network import NARXNN
from sysidentpy.basis_function import Polynomial
from sysidentpy.utils.plotting import plot_residues_correlation, plot_results
from sysidentpy.residues.residues_correlation import compute_residues_autocorrelation
from sysidentpy.residues.residues_correlation import compute_cross_correlation
class NARX(nn.Module):
def __init__(self):
super().__init__()
self.lin = nn.Linear(4, 10)
self.lin2 = nn.Linear(10, 10)
self.lin3 = nn.Linear(10, 1)
self.tanh = nn.Tanh()
def forward(self, xb):
z = self.lin(xb)
z = self.tanh(z)
z = self.lin2(z)
z = self.tanh(z)
z = self.lin3(z)
return z
basis_function=Polynomial(degree=1)
narx_net = NARXNN(
net=NARX(),
ylag=2,
xlag=2,
basis_function=basis_function,
model_type="NARMAX",
loss_func='mse_loss',
optimizer='Adam',
epochs=200,
verbose=False,
optim_params={'betas': (0.9, 0.999), 'eps': 1e-05} # optional parameters of the optimizer
)
narx_net.fit(X=x_train, y=y_train)
yhat = narx_net.predict(X=x_valid, y=y_valid)
plot_results(y=y_valid, yhat=yhat, n=100, figsize=(14, 3), linewidth=1.5)
```

#### Catboost-narx
```python
from catboost import CatBoostRegressor
from sysidentpy.general_estimators import NARX
from sysidentpy.basis_function import Polynomial
from sysidentpy.utils.plotting import plot_residues_correlation, plot_results
from sysidentpy.residues.residues_correlation import compute_residues_autocorrelation
from sysidentpy.residues.residues_correlation import compute_cross_correlation
basis_function=Polynomial(degree=1)
catboost_narx = NARX(
base_estimator=CatBoostRegressor(
iterations=300,
learning_rate=0.1,
depth=6),
xlag=2,
ylag=2,
basis_function=basis_function,
fit_params={'verbose': False}
)
catboost_narx.fit(X=x_train, y=y_train)
yhat = catboost_narx.predict(X=x_valid, y=y_valid)
plot_results(y=y_valid, yhat=yhat, n=100, figsize=(14, 3), linewidth=1.5)
```

#### Catboost without NARX configuration
The following is the Catboost performance without the NARX configuration.
```python
catboost = CatBoostRegressor(
iterations=300,
learning_rate=0.1,
depth=6
)
catboost.fit(x_train, y_train, verbose=False)
plot_results(y=y_valid, yhat=catboost.predict(x_valid), n=100, figsize=(14, 3), linewidth=1.5)
```

The examples directory has several Jupyter notebooks with tutorials of how to use the package and some specific applications of sysidentpy. Try it out!
## Communication
- Discord server: https://discord.gg/8eGE3PQ
[](https://discord.gg/8eGE3PQ)
- Website: http://sysidentpy.org
## Citation
[](https://joss.theoj.org/papers/10.21105/joss.02384)
If you use SysIdentPy on your project, please [drop me a line](mailto:wilsonrljr@outlook.com).
If you use SysIdentPy on your scientific publication, we would appreciate citations to the following paper:
- Lacerda et al., (2020). SysIdentPy: A Python package for System Identification using NARMAX models. Journal of Open Source Software, 5(54), 2384, https://doi.org/10.21105/joss.02384
```
@article{Lacerda2020,
doi = {10.21105/joss.02384},
url = {https://doi.org/10.21105/joss.02384},
year = {2020},
publisher = {The Open Journal},
volume = {5},
number = {54},
pages = {2384},
author = {Wilson Rocha Lacerda Junior and Luan Pascoal Costa da Andrade and Samuel Carlos Pessoa Oliveira and Samir Angelo Milani Martins},
title = {SysIdentPy: A Python package for System Identification using NARMAX models},
journal = {Journal of Open Source Software}
}
```
## Inspiration
The documentation and structure (even this section) is openly inspired by Scikit-learn, EinsteinPy, and many others as we used (and keep using) them to learn.
## Contributors