Diversity

deslib.util.diversity.Q_statistic(y, y_pred1, y_pred2)[source]

Calculates the Q-statistics diversity measure between a pair of classifiers. The Q value is in a range [-1, 1]. Classifiers that tend to classify the same object correctly will have positive values of Q, and Q = 0 for two independent classifiers.

Parameters:
y : array of shape = [n_samples]:

class labels of each sample in X.

y_pred1 : array of shape = [n_samples]:

predicted class labels by the classifier 1 for each sample in X.

y_pred2 : array of shape = [n_samples]:

predicted class labels by the classifier 2 for each sample in X.

Returns:
Q : The q-statistic measure between two classifiers
deslib.util.diversity.double_fault(y, y_pred1, y_pred2)[source]

Calculates the double fault (df) measure. This measure represents the probability that both classifiers makes the wrong prediction. A lower value of df means the base classifiers are less likely to make the same error. This measure must be minimized to increase diversity.

Parameters:
y : array of shape = [n_samples]:

class labels of each sample in X.

y_pred1 : array of shape = [n_samples]:

predicted class labels by the classifier 1 for each sample in X.

y_pred2 : array of shape = [n_samples]:

predicted class labels by the classifier 2 for each sample in X.

Returns:
df : The double fault measure between two classifiers

References

Giacinto, Giorgio, and Fabio Roli. “Design of effective neural network ensembles for image classification purposes.” Image and Vision Computing 19.9 (2001): 699-707.

deslib.util.diversity.negative_double_fault(y, y_pred1, y_pred2)[source]

The negative of the double fault measure. This measure should be maximized for a higher diversity.

Parameters:
y : array of shape = [n_samples]:

class labels of each sample in X.

y_pred1 : array of shape = [n_samples]:

predicted class labels by the classifier 1 for each sample in X.

y_pred2 : array of shape = [n_samples]:

predicted class labels by the classifier 2 for each sample in X.

Returns:
df : The negative double fault measure between two classifiers

References

Giacinto, Giorgio, and Fabio Roli. “Design of effective neural network ensembles for image classification purposes.” Image and Vision Computing 19.9 (2001): 699-707.

deslib.util.diversity.ratio_errors(y, y_pred1, y_pred2)[source]

Calculates Ratio of errors diversity measure between a pair of classifiers. A higher value means that the base classifiers are less likely to make the same errors. The ratio must be maximized for a higher diversity.

Parameters:
y : array of shape = [n_samples]:

class labels of each sample in X.

y_pred1 : array of shape = [n_samples]:

predicted class labels by the classifier 1 for each sample in X.

y_pred2 : array of shape = [n_samples]:

predicted class labels by the classifier 2 for each sample in X.

Returns:
ratio : The q-statistic measure between two classifiers

References

Aksela, Matti. “Comparison of classifier selection methods for improving committee performance.” Multiple Classifier Systems (2003): 159-159.