pyrcn.datasets¶
The pyrcn.datasets includes datasets for reference experiments.
- pyrcn.datasets.load_digits(*, n_class: Union[int, integer] = 10, return_X_y: bool = False, as_frame: bool = False, as_sequence: bool = False) Union[Bunch, tuple]¶
Load and return the digits dataset (classification).
Each datapoint is a 8x8 image of a digit. ================= ============== Classes 10 Samples per class ~180 Samples total 1797 Dimensionality 64 Features integers 0-16 ================= ============== Read more in the User Guide.
- Parameters
n_class (Union[int, np.integer], default=10) – The number of classes to return. Between 0 and 10.
return_X_y (bool, default=False) – If True, returns
(data, target)instead of a Bunch object. See below for more information about the data and target object. .. versionadded:: 0.18as_frame (bool, default=False) – If True, the data is a pandas DataFrame including columns with appropriate dtypes (numeric). The target is a pandas DataFrame or Series depending on the number of target columns. If return_X_y is True, then (data, target) will be pandas DataFrames or Series as described below. .. versionadded:: 0.23
- Returns
data (
Bunch) – Dictionary-like object, with the following attributes. data : {ndarray, dataframe} of shape (1797, 64)The flattened data matrix. If as_frame=True, data will be a pandas DataFrame.
- target: {ndarray, Series} of shape (1797,)
The classification target. If as_frame=True, target will be a pandas Series.
- feature_names: list
The names of the dataset columns.
- target_names: list
The names of target classes. .. versionadded:: 0.20
- frame: DataFrame of shape (1797, 65)
Only present when as_frame=True. DataFrame with data and target. .. versionadded:: 0.23
- images: {ndarray} of shape (1797, 8, 8)
The raw image data.
- DESCR: str
The full description of the dataset.
(data, target) (tuple if
return_X_yis True)
- pyrcn.datasets.lorenz(n_timesteps: int, n_future: int = 1, sigma: float = 10.0, rho: float = 28.0, beta: float = 2.6666666666666665, x_0: Union[List, ndarray] = [1.0, 1.0, 1.0], h: float = 0.03, **kwargs: Dict) Tuple[ndarray, ndarray]¶
Lorenz time-series.
Lorenz timeseries 1 2, computed from the Lorenz delayed differential equation: .. math:
\\frac{dx}{dt} = \\sigma(y - x) \\frac{dy}{dt} = x(\\rho - z) - y \\frac{dz}{dt} = xy - \\beta z
- Parameters
n_timesteps (int) – Number of timesteps to compute.
n_future (int, default = 1) – distance between input and target samples.
sigma (float, default = 10) – \(\\sigma\) parameter of the system.
rho (float, default = 28.) – \(\\rho\) parameter of the equation.
beta (float, default = :math: \frac{8}{3}) – \(\\beta\) parameter of the equation.
x_0 (Union[List, np.ndarray], default = [1.0, 1.0, 1.0]) – Initial condition of the timeseries.
h (float, default = 0.03) – Discretization step for the Runge-Kutta method. Can be assimilated to the number of discrete point computed per timestep.
- Returns
Lorenz attractor timeseries.
- Return type
np.ndarray
Note
This code was inspired and adapted from the ReservoirPy library 3.
References
- 1
E. N. Lorenz, ‘Deterministic Nonperiodic Flow’, Journal of the Atmospheric Sciences, vol. 20, no. 2, pp. 130–141, Mar. 1963, doi: 10.1175/1520-0469(1963)020<0130:DNF>2.0.CO;2.
- 2
‘Lorenz system <https://en.wikipedia.org/wiki/Lorenz_system>’_ on Wikipedia.
- 3
Trouvain et al., ‘ReservoirPy: an Efficient and User-Friendly Library to Design Echo State Networks’, In International Conference on Artificial Neural Networks (pp. 494-505). Springer, Cham.
- pyrcn.datasets.mackey_glass(n_timesteps: int, n_future: int = 1, tau: int = 17, beta: float = 0.2, gamma: float = 0.1, n: int = 10, x_0: float = 1.2, h: float = 1.0, random_state: Optional[Union[int, RandomState]] = 42) Tuple[ndarray, ndarray]¶
Mackey-Glass time-series.
Mackey-Glass timeseries 4 5, computed from the Mackey-Glass delayed differential equation: .. math:
\\frac{dx}{dt} = \\beta\\frac{x(t-\\tau)}{1+x(t-\\tau)^n}-\\gamma x(t)
- Parameters
n_timesteps (int) – Number of timesteps to compute.
n_future (int, default = 1) – distance between input and target samples.
tau (int, default = 17) – Time delay \(\\tau\) of the Mackey-Glass equation. Other values can strongly change the chaotic behaviour of the timeseries.
beta (float, default = 0.2) – \(\\beta\) parameter of the equation.
gamma (float, default = 0.1) – \(\\gamma\) parameter of the equation.
n (int, default = 10) – \(n\) parameter of the equation.
x_0 (float, default = 1.2) – Initial condition of the timeseries.
h (float, default = 1.0) – Discretization step for the Runge-Kutta method. Can be assimilated to the number of discrete point computed per timestep.
random_state (Union[int, np.random.RandomState, None], default=42) – Random state seed for reproducibility.
- Returns
Mackey-Glass timeseries.
- Return type
np.ndarray
Note
This code was inspired and adapted from the ReservoirPy library 6.
References
- 4
M. C. Mackey and L. Glass, ‘Oscillation and chaos in physiological control systems’, Science, vol. 197, no. 4300, pp. 287–289, Jul. 1977, doi: 10.1126/science.267326.
- 5
‘Mackey-Glass equation <http://www.scholarpedia.org/article/Mackey-Glass_equation>’_ on Scholarpedia.
- 6
Trouvain et al., ‘ReservoirPy: an Efficient and User-Friendly Library to Design Echo State Networks’, In International Conference on Artificial Neural Networks (pp. 494-505). Springer, Cham.