pusion.core.decision_templates_combiner¶
- class pusion.core.decision_templates_combiner.DecisionTemplatesCombiner¶
Bases:
pusion.core.combiner.TrainableCombiner
The
DecisionTemplatesCombiner
(DT) is adopted from the decision fusion method originally proposed by Kuncheva 1. A decision template is the average matrix of all decision profiles, which correspond to samples of one specific class. A decision profile contains classification outputs from all classifiers for a sample in a row-wise fashion. The decision fusion is performed based on distance calculations between decision templates and the decision profile generated from the ensemble outputs.- 1
Ludmila I Kuncheva. Combining pattern classifiers: methods and algorithms. John Wiley & Sons, 2014.
- train(decision_tensor, true_assignments)¶
Train the Decision Templates Combiner model by precalculating decision templates from given decision outputs and true class assignments. Both continuous and crisp classification outputs are supported. This procedure involves calculating means of decision profiles (decision templates) for each true class.
- Parameters
decision_tensor – numpy.array of shape (n_classifiers, n_samples, n_classes). Tensor of either crisp or continuous decision outputs by different classifiers per sample.
true_assignments – numpy.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 using the Decision Templates method. Both continuous and crisp classification outputs are supported. Combining requires a trained
DecisionTemplatesCombiner
.- Parameters
decision_tensor – numpy.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 either crisp or continuous class assignments which represents fused decisions obtained by the minimum distance between decision profiles of
decision_tensor
and precalculated decision templates. Axis 0 represents samples and axis 1 the class assignments which are aligned with axis 2 indecision_tensor
input tensor.
- class pusion.core.decision_templates_combiner.CRDecisionTemplatesCombiner¶
Bases:
pusion.core.decision_templates_combiner.DecisionTemplatesCombiner
The
CRDecisionTemplatesCombiner
is a modification ofDecisionTemplatesCombiner
that also supports complementary-redundant decision outputs. Therefore the input is transformed, such that all missing classification assignments are considered as a constant, respectively. To use methodstrain()
andcombine()
a coverage needs to be set first by the inheritedset_coverage()
method.- train(decision_outputs, true_assignments)¶
Train the Decision Templates Combiner model by precalculating decision templates from given decision outputs and true class assignments. Both continuous and crisp classification outputs are supported. This procedure involves calculating means of decision profiles (decision templates) for each true class.
- Parameters
decision_outputs – list 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 either crisp or continuous decision outputs per sample.
true_assignments – numpy.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_outputs)¶
Combine decision outputs by using the Decision Templates method. Both continuous and crisp classification outputs are supported. Combining requires a trained
CRDecisionTemplatesCombiner
.- Parameters
decision_outputs – list 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 or continuous decision outputs per sample.
- Returns
A matrix (numpy.array) of crisp or continuous class assignments which represents fused decisions. Axis 0 represents samples and axis 1 the class labels which are aligned with axis 2 in
decision_tensor
input tensor.