qbiocode.data_generation.make_swiss_roll module#
Generate synthetic 3D Swiss roll datasets for manifold learning tasks.
This module creates multiple configurations of 3D Swiss roll datasets with varying sample sizes, noise levels, and hole configurations, useful for testing dimensionality reduction and manifold learning algorithms.
Summary#
Functions:
Generate multiple 3D Swiss roll datasets with varying parameters. |
Reference#
- generate_swiss_roll_datasets(n_samples=[100, 120, 140, 160, 180, 200, 220, 240, 260, 280], noise=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9], hole=[True, False], save_path=None, random_state=42)[source]#
Generate multiple 3D Swiss roll datasets with varying parameters.
Creates a series of 3D datasets where samples lie on a Swiss roll manifold, a classic benchmark for manifold learning and dimensionality reduction algorithms. Each configuration varies the number of samples, noise level, and whether the roll has a hole in the center.
- Parameters:
n_samples (list of int, default=range(100, 300, 20)) – List of sample sizes to generate for each configuration.
noise (list of float, default=[0.1, 0.2, ..., 0.9]) – List of noise standard deviations to apply to the data.
hole (list of bool, default=[True, False]) – List of boolean values indicating whether to generate Swiss roll with hole.
save_path (str, optional) – Directory path where datasets and configuration files will be saved.
random_state (int, default=42) – Random seed for reproducibility.
- Returns:
Saves CSV files for each dataset configuration and a JSON file with all configuration parameters.
- Return type:
None
Notes
Each dataset is saved as ‘swiss_roll_data-{i}.csv’ where i is the configuration number
Configuration parameters are saved in ‘dataset_config.json’
The last column ‘class’ contains the position along the manifold (continuous values)
Swiss roll is a standard benchmark for testing manifold learning algorithms
Examples
>>> from qbiocode.data_generation import generate_swiss_roll_datasets >>> generate_swiss_roll_datasets(n_samples=[200], noise=[0.1], hole=[False], save_path='data') Generating swiss roll dataset...