Hyperplane generator: points split by a random linear boundary.
Labels each point by the side of a randomly oriented hyperplane it lands on, giving a linearly separable problem in any number of dimensions. Weights can be made to drift between samples, which turns it into a concept-drift stream for testing incremental learners.
Classes
Hyperplane data generator.
Generates data points in n-dimensional space separated by a random hyperplane. Points are classified based on which side of the hyperplane they fall on.
The hyperplane is defined by:
w_1 x_1 + w_2 x_2 + \dots + w_n x_n = \text{threshold}
Constructor
__init__( self, n_samples: int = 100, n_features: int = 10, n_drift_features: int = 0, noise: float = 0.0, random_state: Optional[int] = None, )
Parameters
n_samples
int
= 100
Number of samples to generate.
n_features
int
= 10
Number of features (dimensions).
n_drift_features
int
= 0
Number of features with changing weights (concept drift).
noise
float
= 0.0
Fraction of labels to flip (noise).
random_state
int or None
= None
Random seed for reproducibility.
python
>>> from tuiml.datasets.generators.classification import Hyperplane
>>> gen = Hyperplane(n_samples=1000, n_features=10, random_state=0)
>>> data = gen.generate()
>>> data.X.shape
(1000, 10)
>>> sorted(set(data.y.tolist()))
[0, 1]