autoqild.classifiers.blind_classifiers

Classes implementing classifiers which predicts a constant function which predict label only using the outputs of the dataset, which are used as baselines for detecting information leakage.

Classes

MajorityVoting(**kwargs)

A classifier that always predicts the most frequent class.

PriorClassifier([random_state])

PriorClassifier is a simple classifier that predicts class labels based on the prior distribution of the classes in the training data.

RandomClassifier(**kwargs)

A classifier that predicts classes randomly according to a uniform distribution.

class autoqild.classifiers.blind_classifiers.MajorityVoting(**kwargs)[source]

Bases: DummyClassifier

A classifier that always predicts the most frequent class.

Parameters:

**kwargs (dict, optional) – Additional keyword arguments to pass to DummyClassifier.

class autoqild.classifiers.blind_classifiers.PriorClassifier(random_state=None, **kwargs)[source]

Bases: DummyClassifier

PriorClassifier is a simple classifier that predicts class labels based on the prior distribution of the classes in the training data. This classifier is essentially a wrapper around the DummyClassifier from scikit-learn with a strategy set to prior.

Parameters:
  • random_state (int or None, optional, default=None) – Random state for reproducibility.

  • **kwargs (dict, optional) – Additional keyword arguments to pass to DummyClassifier.

class_probabilities

The prior probabilities of each class, calculated from the training data.

Type:

array-like of shape (n_classes,)

classes_

The unique classes found in the training data.

Type:

array-like of shape (n_classes,)

n_classes

The number of unique classes in the training data.

Type:

int

random_state

Random state instance for reproducibility.

Type:

RandomState

fit(X, y, sample_weight=None)[source]

Fit the classifier according to the given training data.

Parameters:
  • X (array-like of shape (n_samples, n_features)) – Training data.

  • y (array-like of shape (n_samples,)) – Target values.

  • sample_weight (array-like of shape (n_samples,), optional) – Sample weights.

Returns:

self – Fitted estimator.

Return type:

PriorClassifier

predict(X)[source]

Perform classification on samples in X.

Parameters:

X (array-like of shape (n_samples, n_features)) – Input data.

Returns:

y_pred – Predicted class labels.

Return type:

array-like of shape (n_samples,)

class autoqild.classifiers.blind_classifiers.RandomClassifier(**kwargs)[source]

Bases: DummyClassifier

A classifier that predicts classes randomly according to a uniform distribution.

Parameters:

**kwargs (dict, optional) – Additional keyword arguments to pass to DummyClassifier.