Datasets
The datasets module provides a family of equation-based generators for various
datasets that are commonly used in machine-learning research.
Every generator derives from Dataset and exposes a common
generate() method:
from qilisdk.ml.datasets import NARMA
dataset = NARMA(order=10, seed=0)
sample = dataset.generate(1000)
inputs, targets = sample
The returned DatasetSample is an (inputs, targets) pair.
You can also visualize the generated datasets using the .draw() method of each generator:
from qilisdk.ml.datasets import NARMA
dataset = NARMA(order=10, seed=0)
sample = dataset.generate(1000)
dataset.draw(sample, style="1d")
Available generators
NARMA— Nonlinear Auto-Regressive Moving Average system identification.MackeyGlass— Mackey–Glass chaotic delay differential equation.Lorenz— Lorenz attractor.SantaFeLaser— Santa Fe laser intensity (Lorenz–Haken equations).HenonMap— Hénon map.LogisticMap— Logistic map.
NARMA
The Nonlinear Auto-Regressive Moving Average (NARMA) benchmark is a
system-identification task. A random input stream \(u(t) \sim \mathcal{U}(0, 0.5)\) drives an order-\(n\)
nonlinear recurrence whose output \(y(t)\) must be predicted from \(u\):
The default coefficients \((\alpha, \beta, \gamma, \delta) = (0.3, 0.05, 1.5, 0.1)\) correspond to the ubiquitous
NARMA10 task (order=10). Unlike the other generators, inputs are the random drive \(u\) and targets
are the system response \(y\); both are shaped (npoints, 1). Because the drive is random, a seed can be specified to ensure reproducibility.
from qilisdk.ml.datasets import NARMA
inputs, targets = NARMA(order=10, input_range=(0.0, 0.5), seed=42).generate(2000)
print(inputs.shape, targets.shape)
MackeyGlass
The MackeyGlass system is a nonlinear delay differential equation that
produces a chaotic attractor:
With the standard parameters \(\beta = 0.2\), \(\gamma = 0.1\), \(n = 10\), the behaviour is set by the
delay \(\tau\): the series is periodic for small \(\tau\), mildly chaotic at \(\tau = 17\), and increasingly
chaotic beyond. The equation is integrated with a fixed-step RK4 scheme at resolution dt and sub-sampled every
sample_every steps.
from qilisdk.ml.datasets import MackeyGlass
inputs, targets = MackeyGlass(tau=17.0).generate(2000)
print(inputs.shape, targets.shape)
Lorenz
The Lorenz attractor is a three-dimensional chaotic dynamical system:
The trajectory is integrated with RK4 and sub-sampled, yielding a horizon-step-ahead prediction task over the
three-dimensional state, so inputs and targets are both shaped (npoints, 3).
from qilisdk.ml.datasets import Lorenz
inputs, targets = Lorenz(sigma=10.0, rho=28.0).generate(2000)
print(inputs.shape, targets.shape)
SantaFeLaser
The original Santa Fe Time Series Competition Data Set A is a recording of the chaotic intensity pulsations of a
far-infrared \(\mathrm{NH_3}\) laser. Rather than shipping the recording,
SantaFeLaser reproduces the same qualitative dynamics from first
principles using the single-mode Lorenz–Haken laser equations:
where \(E\) is the field amplitude, \(P\) the polarization and \(N\) the population inversion. The measured
quantity is the laser intensity \(I \propto E^2\), which is non-negative and reproduces the behaviour of the
Santa Fe recording. Both inputs and targets are shaped (npoints, 1).
from qilisdk.ml.datasets import SantaFeLaser
inputs, targets = SantaFeLaser().generate(2000)
print(inputs.min() >= 0.0)
HenonMap
The HenonMap is a two-dimensional discrete chaotic system:
which is chaotic for the parameters \(a = 1.4\), \(b = 0.3\). generate() returns a horizon-step-ahead
prediction task over the two-dimensional state, so inputs and targets are both shaped (npoints, 2).
from qilisdk.ml.datasets import HenonMap
inputs, targets = HenonMap(a=1.4, b=0.3).generate(2000)
print(inputs.shape, targets.shape)
LogisticMap
The LogisticMap is a simple one-dimensional chaotic system:
which becomes chaotic as the growth rate \(r\) approaches 4 (the default \(r = 3.9\) sits well inside the
chaotic regime). generate() returns a horizon-step-ahead prediction task, so inputs and targets are
shaped (npoints, 1).
from qilisdk.ml.datasets import LogisticMap
inputs, targets = LogisticMap(r=3.9, horizon=1).generate(2000)
print(inputs.shape, targets.shape)