Agrawal generator: synthetic loan-applicant records.
Draws nine attributes describing a loan applicant and labels each record with one of ten hand-written decision functions, so the difficulty of the learning problem is chosen rather than fixed. A tunable share of labels is flipped, which makes it a standard source of noisy, non-linear classification data.
Classes
Agrawal data generator.
Generates data using various classification functions defined by Agrawal. The generator creates 9 numeric attributes (salary, commission, age, etc.) and assigns a binary class based on one of 10 classification functions.
The nine attributes describe a loan applicant, and are generated in this order with these ranges:
salary 20000 - 150000 commission 0 - 75000 (0 when salary >= 75000) age 20 - 80 education_level 0 - 4 car 1 - 20 zipcode 0 - 8 house_value 50000 - 1000000, scaled by zipcode years_house 0 - 30 loan 0 - 500000
Constructor
__init__( self, n_samples: int = 100, function: int = 1, perturbation: float = 0.05, random_state: Optional[int] = None, )
Parameters
n_samples
int
= 100
Number of samples to generate.
function
int
= 1
Classification function (1-10).
perturbation
float
= 0.05
Amount of noise to add (0.0-1.0).
random_state
int or None
= None
Random seed for reproducibility.
python
>>> from tuiml.datasets.generators.classification import Agrawal
>>> gen = Agrawal(n_samples=1000, function=1)
>>> data = gen.generate()
>>> data.X.shape
(1000, 9)
>>> data.feature_names[:3]
['salary', 'commission', 'age']