qxmt.datasets.generate.linear module#
- qxmt.datasets.generate.linear.generate_linear_regression_data(n_samples=100, n_features=2, noise=0.1, scale=1.0, random_seed=None)#
Generate random data for linear regression.
- Parameters:
n_samples (int, optional) – Number of samples. Defaults to 100.
n_features (int, optional) – Number of features. Defaults to 2.
noise (float, optional) – Noise level to add to the target. Defaults to 0.1.
scale (float, optional) – Scale of the data. Defaults to 1.0.
random_seed (int, optional) – Random seed for reproducibility. Defaults to None.
- Returns:
Generated features and target values
- Return type:
Tuple[np.ndarray, np.ndarray]
- qxmt.datasets.generate.linear.generate_linear_separable_data(n_samples=100, n_features=2, n_classes=2, noise=0.1, scale=1.0, random_seed=None)#
Generate random linear separable data for multi-class classification.
- Parameters:
n_samples (int, optional) – sample size. Defaults to 100.
n_features (int, optional) – dimension of feature. Defaults to 2.
n_classes (int, optional) – number of classes. Defaults to 2.
noise (float, optional) – noise level. Defaults to 0.1.
scale (float, optional) – scale of data. Defaults to 1.0.
random_seed (int, optional) – random seed. Defaults to None.
- Returns:
generated data and label
- Return type:
tuple[np.ndarray, np.ndarray]