pusion.core.naive_bayes_combiner¶
- class pusion.core.naive_bayes_combiner.NaiveBayesCombiner¶
Bases:
pusion.core.combiner.EvidenceBasedCombiner
,pusion.core.combiner.TrainableCombiner
The
NaiveBayesCombiner
(NB) is a fusion method based on the Bayes theorem which is applied according to Kuncheva 1 and Titterington et al. 2. NB uses the confusion matrix as an evidence to calculate the a-priori probability and the bayesian belief value, which in turn the decision fusion bases on. NB requires outputs from uncorrelated classifiers in the ensemble.- 1(1,2)
Ludmila I Kuncheva. Combining pattern classifiers: methods and algorithms. John Wiley & Sons, 2014.
- 2
DM Titterington, GD Murray, LS Murray, DJ Spiegelhalter, AM Skene, JDF Habbema, and GJ Gelpke. Comparison of discrimination techniques applied to a complex data set of head injured patients. Journal of the Royal Statistical Society: Series A (General), 144(2):145–161, 1981.
- set_evidence(evidence)¶
Set the evidence given by confusion matrices calculated according to Kuncheva 1 for each ensemble classifier.
- Parameters
evidence – numpy.array of shape (n_classifiers, n_classes, n_classes). Confusion matrices for each of n classifiers.
- train(decision_tensor, true_assignments)¶
Train the Naive Bayes 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_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 Naive Bayes method. Continuous decision outputs are converted to crisp multiclass predictions using the MAX rule. Combining requires a trained
NaiveBayesCombiner
or evidence set withset_evidence
.- 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 crisp class assignments which represents fused decisions obtained by the maximum 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.naive_bayes_combiner.CRNaiveBayesCombiner¶
Bases:
pusion.core.naive_bayes_combiner.NaiveBayesCombiner
The
CRNaiveBayesCombiner
is a modification ofNaiveBayesCombiner
that also supports complementary-redundant decision outputs. Therefore the input is transformed, such that all missing classification assignments are considered as 0, respectively. To callcombine()
a coverage needs to be set first by the inheritedset_coverage()
method.- train(decision_outputs, true_assignments)¶
Train the Naive Bayes 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_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 Naive Bayes method. Continuous decision outputs are converted to crisp multiclass predictions using the MAX rule. Combining requires a trained
NaiveBayesCombiner
or evidence set withset_evidence
.- 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 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.