pusion.core.combiner

class pusion.core.combiner.Combiner

Bases: object

Combiner’s root class. This class as well as the subclasses in this module set the structure for each combiner provided by the framework. It also accommodates methods and attributes which are essential for combiner’s registration and obtainment.

Each combiner to be registered in the framework, needs to base at least one of the following classes:

Furthermore, it needs a list _SUPPORTED_PAC of supported PAC tuples set as a class attribute. A PAC tuple is a tuple of string constants (classification problem, assignment type and coverage type). See:

  • pusion.util.constants.Problem

  • pusion.util.constants.AssignmentType

  • pusion.util.constants.CoverageType

respectively. Example of a new combiner:

class NewCombiner(TrainableCombiner):

_SUPPORTED_PAC = [
    (Problem.MULTI_CLASS, AssignmentType.CRISP, CoverageType.REDUNDANT),
    (Problem.MULTI_CLASS, AssignmentType.CONTINUOUS, CoverageType.REDUNDANT)
]

def train(self, decision_outputs, true_assignments):
    pass

def combine(self, decision_outputs):
    pass

Warning

Note that a new combiner also needs to be inserted into the pusion.Method class within pusion.__init__.py file.

classmethod obtain(config)

Obtain a combiner registered by the framework.

Parameters

configpusion.model.configuration.Configuration. User-defined configuration.

Returns

A combiner object.

abstract combine(decision_tensor)

Abstract method. Combine decision outputs by combiner’s implementation.

Parameters

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

Returns

numpy.array of shape (n_samples, n_classes). A matrix of class assignments which represents fused decisions obtained by combiner’s implementation. Axis 0 represents samples and axis 1 the class assignments which are aligned with axis 2 in decision_tensor input tensor.

set_coverage(coverage)

Set the coverage for complementary-redundant decisions.

Parameters

coveragelist of list elements. Each inner list contains classes as integers covered by a classifier, which is identified by the positional index of the respective list.

class pusion.core.combiner.UtilityBasedCombiner

Bases: pusion.core.combiner.Combiner

A combiner of type UtilityBasedCombiner fuses decisions solely based on the outputs of the ensemble classifiers. It does not take any further information or evidence about respective ensemble classifiers into account.

abstract combine(decision_tensor)

Abstract method. Combine decision outputs by combiner’s implementation.

Parameters

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

Returns

numpy.array of shape (n_samples, n_classes). A matrix of class assignments which represents fused decisions obtained by combiner’s implementation. Axis 0 represents samples and axis 1 the class assignments which are aligned with axis 2 in decision_tensor input tensor.

class pusion.core.combiner.TrainableCombiner

Bases: pusion.core.combiner.Combiner

A combiner of type TrainableCombiner needs to be trained using decision outputs of the ensemble classifiers with true class assignments in order to combine decisions of unknown samples.

abstract combine(decision_tensor)

Abstract method. Combine decision outputs by combiner’s implementation.

Parameters

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

Returns

numpy.array of shape (n_samples, n_classes). A matrix of class assignments which represents fused decisions obtained by combiner’s implementation. Axis 0 represents samples and axis 1 the class assignments which are aligned with axis 2 in decision_tensor input tensor.

abstract train(decision_tensor, true_assignments, **kwargs)

Abstract method. Train combiner’s implementation using decision outputs an appropriate true assignments.

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

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

  • **kwargs – The **kwargs parameter may be used to use additional test data for the AutoFusion selection procedure.

class pusion.core.combiner.EvidenceBasedCombiner

Bases: pusion.core.combiner.Combiner

A combiner of type EvidenceBasedCombiner takes an additional evidence into account while combining outputs of ensemble classifiers. Thus, it is able to empower better classifiers in order to obtain a fusion result with higher overall classification performance.

abstract combine(decision_tensor)

Abstract method. Combine decision outputs by combiner’s implementation.

Parameters

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

Returns

numpy.array of shape (n_samples, n_classes). A matrix of class assignments which represents fused decisions obtained by combiner’s implementation. Axis 0 represents samples and axis 1 the class assignments which are aligned with axis 2 in decision_tensor input tensor.

abstract set_evidence(evidence)

Abstract method. Set the evidence for evidence-based combiner implementations. The evidence is given by confusion matrices calculated according to Kuncheva 1.

1

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

Parameters

evidencelist of numpy.array elements of shape (n_classes, n_classes). Confusion matrices for each ensemble classifier.