qilisdk.ml.datasets.lorenz

Classes

Lorenz

Lorenz attractor, a chaotic dynamical system.

Functions

integrate_lorenz(→ qilisdk.ml.datasets.dataset.FloatArray)

Integrate the Lorenz system with a fixed-step RK4 scheme.

Module Contents

integrate_lorenz(*, sigma: float, rho: float, beta: float, initial_state: tuple[float, float, float], dt: float, n_steps: int) qilisdk.ml.datasets.dataset.FloatArray[source]

Integrate the Lorenz system with a fixed-step RK4 scheme.

The Lorenz equations are

\[\dot{x} = \sigma (y - x), \quad \dot{y} = x (\rho - z) - y, \quad \dot{z} = x y - \beta z.\]
Parameters:
  • sigma (float) – Prandtl number \(\sigma\).

  • rho (float) – Rayleigh number \(\rho\).

  • beta (float) – Geometric factor \(\beta\).

  • initial_state (tuple[float, float, float]) – Initial (x, y, z) state.

  • dt (float) – Integration step.

  • n_steps (int) – Number of RK4 steps to take.

Returns:

The trajectory, shaped (n_steps + 1, 3).

Return type:

FloatArray

class Lorenz(*, sigma: float = 10.0, rho: float = 28.0, beta: float = 8.0 / 3.0, initial_state: tuple[float, float, float] = (1.0, 1.0, 1.0), dt: float = 0.01, sample_every: int = 5, washout: int = 1000, horizon: int = 1, seed: int | None = None)[source]

Bases: qilisdk.ml.datasets.dataset.Dataset

Lorenz attractor, a chaotic dynamical system.

Configure a Lorenz generator.

Parameters:
  • sigma (float) – Prandtl number \(\sigma\). Defaults to 10.0.

  • rho (float) – Rayleigh number \(\rho\). Defaults to 28.0.

  • beta (float) – Geometric factor \(\beta\). Defaults to 8/3.

  • initial_state (tuple[float, float, float]) – Initial (x, y, z) state. Defaults to (1.0, 1.0, 1.0).

  • dt (float) – Internal integration step. Defaults to 0.01.

  • sample_every (int) – Sub-sampling stride. Defaults to 5.

  • washout (int) – Integration steps discarded as transient. Defaults to 1000.

  • horizon (int) – Prediction horizon in sampled steps. Defaults to 1.

  • seed (int | None) – Unused; the system is deterministic. Defaults to None.

Raises:

ValueError – If dt or sample_every is not positive.

generate(npoints: int) qilisdk.ml.datasets.dataset.DatasetSample[source]

Integrate the Lorenz system and build a prediction sample.

This produces a single time series of length npoints + horizon, discarding the first washout steps, and then sub-sampling every sample_every` steps. The resulting series is split into ``inputs and targets, where targets is the same series shifted forward by horizon.

Parameters:

npoints (int) – Number of time steps to produce.

Returns:

A horizon-step-ahead prediction pair, both arrays shaped (npoints, 3).

Return type:

DatasetSample

Raises:

ValueError – If npoints is not positive.