Reference / binference.simulate.mock_categorical
binference.simulate.mock_categorical¶
- binference.simulate.mock_categorical(n_objects=2000, n_classes=4, *, prevalence=None, train_prior=None, separation=1.5, temperature=1.0, n_validation=500, rng=None)[source]¶
A quantification problem: classifier outputs over unordered classes.
Each object has a one-dimensional feature drawn from a unit-variance Gaussian whose mean depends on its class (means
separationapart). A classifier trained with class priortrain_prior(uniform by default) reports posteriorsmock.posteriors, calibrated whentemperatureis one (its log-likelihoods are divided bytemperature);mock.likelihoodsdivides them by the training prior (route A,Likelihoods.from_table()).mock.responseis tallied withResponse.from_labelled()from a validation set ofn_validationobjects drawn with the training prior, scored by their feature; withmock.measurements["feature"]it gives route C (Likelihoods.from_binned()). The test-set prevalenceprevalence(default: a skewed vector) differs from the training prior (label shift).- Parameters:
- n_objectsint, optional
Number of objects in the target set.
- n_classesint, optional
Number of classes.
- prevalencearray_like (n_classes,), optional
Class fractions of the target set;
Nonegives fractions rising as the square of the class index.- train_priorarray_like (n_classes,), optional
Class prior the classifier was trained with;
Noneis uniform.- separationfloat, optional
Distance between the class means of the feature.
- temperaturefloat, optional
Divisor of the classifier’s log-likelihoods; one is calibrated.
- n_validationint, optional
Objects in the labelled validation set.
- rngint, Generator or None
Random number generator.