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 separation apart). A classifier trained with class prior train_prior (uniform by default) reports posteriors mock.posteriors, calibrated when temperature is one (its log-likelihoods are divided by temperature); mock.likelihoods divides them by the training prior (route A, Likelihoods.from_table()). mock.response is tallied with Response.from_labelled() from a validation set of n_validation objects drawn with the training prior, scored by their feature; with mock.measurements["feature"] it gives route C (Likelihoods.from_binned()). The test-set prevalence prevalence (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; None gives fractions rising as the square of the class index.

train_priorarray_like (n_classes,), optional

Class prior the classifier was trained with; None is 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.