pusion.core.weighted_voting_combiner

class pusion.core.weighted_voting_combiner.WeightedVotingCombiner

Bases: pusion.core.combiner.EvidenceBasedCombiner, pusion.core.combiner.TrainableCombiner

The WeightedVotingCombiner (WV) is a weighted voting schema adopted from Kuncheva (eq. 4.43) 1. Classifiers with better performance (i.e. accuracy) are given more weight contributing to final decisions. Nevertheless, if classifiers of high performance disagree on a sample, low performance classifiers may contribute to the final decision.

1(1,2)

Ludmila I Kuncheva. Combining pattern classifiers: methods and algorithms. John Wiley & Sons, 2014.

set_evidence(evidence)

Set the evidence given by confusion matrices calculated according to Kuncheva 1 for each ensemble classifier.

Parameters

evidencenumpy.array of shape (n_classifiers, n_classes, n_classes). Confusion matrices for each of n classifiers.

train(decision_tensor, true_assignments)

Train the Weighted Voting combiner model by precalculating confusion matrices from given decision outputs and true class assignments. Continuous decision outputs are converted into crisp multiclass assignments using the MAX rule.

Parameters
  • decision_tensornumpy.array of shape (n_classifiers, n_samples, n_classes). Tensor of either crisp or continuous decision outputs by different classifiers per sample.

  • true_assignmentsnumpy.array of shape (n_samples, n_classes). Matrix of either crisp or continuous class assignments which are considered true for each sample during the training procedure.

combine(decision_tensor)

Combine decision outputs by the weighted voting schema. Classifiers with better performance (i.e. accuracy) are given more authority over final decisions. Combining requires a trained WeightedVotingCombiner or evidence set with set_evidence.

Parameters

decision_tensornumpy.array of shape (n_classifiers, n_samples, n_classes). Tensor of either crisp or continuous decision outputs by different classifiers per sample.

Returns

A matrix (numpy.array) of crisp class assignments which represents fused decisions obtained by the maximum weighted class support. Axis 0 represents samples and axis 1 the class assignments which are aligned with axis 2 in decision_tensor input tensor.

class pusion.core.weighted_voting_combiner.CRWeightedVotingCombiner

Bases: pusion.core.weighted_voting_combiner.WeightedVotingCombiner

The CRWeightedVotingCombiner is a modification of WeightedVotingCombiner that also supports complementary-redundant decision outputs. Therefore the input is transformed to a unified tensor representation supporting undefined class assignments. The mean is calculated only for assignments which are defined. To call methods train() and combine(), a coverage needs to be set first by the inherited set_coverage() method.

train(decision_outputs, true_assignments)

Train the Weighted Voting combiner model by precalculating confusion matrices from given decision outputs and true class assignments. Continuous decision outputs are converted into crisp multiclass assignments using the MAX rule.

Parameters
  • decision_outputslist of numpy.array matrices, each of shape (n_samples, n_classes’), where n_classes’ is classifier-specific and described by the coverage. Each matrix corresponds to one of n_classifiers classifiers and contains crisp decision outputs per sample.

  • true_assignmentsnumpy.array of shape (n_samples, n_classes). Matrix of crisp class assignments which is considered true for each sample during the training procedure.

combine(decision_outputs)

Combine decision outputs by the weighted voting schema. Classifiers with better performance (i.e. accuracy) are given more authority over final decisions. Combining requires a trained WeightedVotingCombiner or evidence set with set_evidence.

Parameters

decision_outputslist of numpy.array matrices, each of shape (n_samples, n_classes’), where n_classes’ is classifier-specific and described by the coverage. Each matrix corresponds to one of n_classifiers classifiers and contains crisp decision outputs per sample.

Returns

A matrix (numpy.array) of crisp class assignments which are obtained by the best representative class for a certain classifier’s behaviour per sample. Axis 0 represents samples and axis 1 all the class labels which are provided by the coverage.