pusion.core.behaviour_knowledge_space_combiner¶
- class pusion.core.behaviour_knowledge_space_combiner.BehaviourKnowledgeSpaceCombiner¶
Bases:
pusion.core.combiner.TrainableCombiner
The
BehaviourKnowledgeSpaceCombiner
(BKS) is adopted from the decision fusion method originally proposed by Huang, Suen et al. 1. BKS analyses the behaviour of multiple classifiers based on their classification outputs with respect to each available class. This behaviour is recorded by means of a lookup table, which is used for final combination of multiple classification outputs for a sample.- 1
Yea S Huang and Ching Y Suen. The behavior-knowledge space method for combination of multiple classifiers. In IEEE computer society conference on computer vision and pattern recognition, 347–347. Institute of Electrical Engineers Inc (IEEE), 1993.
- train(decision_tensor, true_assignments)¶
Train the Behaviour Knowledge Space model (BKS) by extracting the classification configuration from all classifiers and summarizing samples of each true class that leads to that configuration. This relationship is recorded in a lookup table. Only crisp classification outputs are supported.
- Parameters
decision_tensor – numpy.array of shape (n_classifiers, n_samples, n_classes). Tensor of crisp decision outputs by different classifiers per sample.
true_assignments – numpy.array of shape (n_samples, n_classes). Matrix of crisp class assignments which are considered true for each sample during the training procedure.
- combine(decision_tensor)¶
Combine decision outputs by the Behaviour Knowledge Space (BKS) method. This procedure involves looking up the most representative class for a given classification output regarding the behaviour of all classifiers in the ensemble. Only crisp classification outputs are supported. If a trained lookup entry is not present for a certain classification configuration, no decision fusion can be made for the sample, which led to that configuration. In this case, the decision fusion is a zero vector.
- Parameters
decision_tensor – numpy.array of shape (n_classifiers, n_samples, n_classes). Tensor of crisp decision outputs by different classifiers 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 the class labels which are aligned with axis 2 in
decision_tensor
input tensor.
- class pusion.core.behaviour_knowledge_space_combiner.CRBehaviourKnowledgeSpaceCombiner¶
Bases:
pusion.core.behaviour_knowledge_space_combiner.BehaviourKnowledgeSpaceCombiner
The
CRBehaviourKnowledgeSpaceCombiner
is a modification ofBehaviourKnowledgeSpaceCombiner
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 Behaviour Knowledge Space model (BKS) by extracting the classification configuration from all classifiers and summarizing samples of each true class that leads to that configuration. This relationship is recorded in a lookup table. Only crisp classification outputs are supported.
- 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 decision outputs per sample.
true_assignments – numpy.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 Behaviour Knowledge Space (BKS) method. This procedure involves looking up the most representative class for a given classification output regarding the behaviour of all classifiers in the ensemble. Only crisp classification outputs are supported. If a trained lookup entry is not present for a certain classification configuration, no decision fusion can be made for the sample, which led to that configuration. In this case, the decision fusion is a zero vector.
- 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 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.