pusion.auto.generic_combiner

class pusion.auto.generic_combiner.GenericCombiner

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

The GenericCombiner (GC) allows for automatic decision fusion using all methods provided by the framework, which are applicable to the given problem. The key feature of this combiner is the transparency in terms of it’s outer behaviour. Based on the usage (i.e. method calls) and the automatically detected configuration, the GenericCombiner preselects all compatible methods from pusion.core. The main purpose is to retrieve fusion results obtained by the all applicable methods. The main difference to the AutoCombiner is that decision fusion results are handed over to the user for further comparison and selection. Thus, GC is not suitable for the online fusion.

set_coverage(coverage)

Set the coverage in case of complementary-redundant classification data.

Parameters

coverage – The coverage is described by using a nested list. Each list describes the classifier based on its position. Elements of those lists (integers) describe the actual class coverage of the respective classifier. E.g., with [[0,1], [0,2,3]] the classes 0,1 are covered by the first classifier and 0,2,3 are covered by the second one.

set_evidence(evidence)

Set the evidence for evidence based combiners. This method preselects all combiners of type EvidenceBasedCombiner.

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 Generic Combiner. This method detects the configuration based on the decision_tensor and trains all trainable combiners that are applicable to this configuration.

Parameters
  • decision_tensor

    numpy.array of shape (n_classifiers, n_samples, n_classes) or a list of numpy.array elements of shape (n_samples, n_classes’), where n_classes’ is classifier-specific due to the coverage.

    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.

train_par(decision_tensor, true_assignments)

Train the Generic Combiner by training individual combiners in parallel. This method detects the configuration based on the decision_tensor and trains all trainable combiners that are applicable to this configuration.

Parameters
  • decision_tensor

    numpy.array of shape (n_classifiers, n_samples, n_classes) or a list of numpy.array elements of shape (n_samples, n_classes’), where n_classes’ is classifier-specific due to the coverage.

    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.

train_seq(decision_tensor, true_assignments)

Train the Generic Combiner by training individual combiners in sequence. This method detects the configuration based on the decision_tensor and trains all trainable combiners that are applicable to this configuration.

Parameters
  • decision_tensor

    numpy.array of shape (n_classifiers, n_samples, n_classes) or a list of numpy.array elements of shape (n_samples, n_classes’), where n_classes’ is classifier-specific due to the coverage.

    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 using the AutoCombiner (AC) model. Both continuous and crisp classification outputs are supported. This procedure involves combining decision outputs by each individual method which is applicable to the detected configuration.

Parameters

decision_tensor

numpy.array of shape (n_classifiers, n_samples, n_classes) or a list of numpy.array elements of shape (n_samples, n_classes’), where n_classes’ is classifier-specific due to the coverage.

Tensor of either crisp or continuous decision outputs by different classifiers per sample.

Returns

list of numpy.array of shape (n_samples, n_classifiers). Fusion results obtained by selected fusion methods. The list is aligned with the list of preselected fusion methods (retrievable by get_combiners()).

combine_par(decision_tensor)

Combine decision outputs by GC. Both continuous and crisp classification outputs are supported. This procedure involves combining decision outputs by each individual method which is applicable to the detected configuration. Each combine procedure is spawned in a separate thread and thus performed in parallel.

Parameters

decision_tensor

numpy.array of shape (n_classifiers, n_samples, n_classes) or a list of numpy.array elements of shape (n_samples, n_classes’), where n_classes’ is classifier-specific due to the coverage.

Tensor of either crisp or continuous decision outputs by different classifiers per sample.

Returns

list of numpy.array of shape (n_samples, n_classifiers). Fusion results obtained by selected fusion methods. The list is aligned with the list of preselected fusion methods (retrievable by get_combiners()).

combine_seq(decision_tensor)

Combine decision outputs by GC. Both continuous and crisp classification outputs are supported. This procedure involves combining decision outputs by each individual method which is applicable to the detected configuration. Each combine procedure is initiated in sequence.

Parameters

decision_tensor

numpy.array of shape (n_classifiers, n_samples, n_classes) or a list of numpy.array elements of shape (n_samples, n_classes’), where n_classes’ is classifier-specific due to the coverage.

Tensor of either crisp or continuous decision outputs by different classifiers per sample.

Returns

list of numpy.array of shape (n_samples, n_classifiers). Fusion results obtained by selected fusion methods. The list is aligned with the list of preselected fusion methods (retrievable by get_combiners()).

get_pac()
Returns

tuple of detected problem, assignment type and coverage type.

get_combiners()
Returns

list of core methods preselected by the AutoCombiner.

get_combiner_type_selection()
Returns

list of combiner types established by usage.

get_multi_combiner_decision_tensor()
Returns

list of numpy.array of shape (n_samples, n_classifiers). Fusion results obtained by selected fusion methods. The list is aligned with the list of preselected fusion methods (retrievable by get_combiners()).

get_multi_combiner_runtimes()
Returns

A tuple of two lists of tuples describing the train and combine runtimes respectively. Each inner tuple key value indexes the list of preselected fusion methods (retrievable by get_combiners()).

set_parallel(parallel=True)

Set whether the training and the combining of selected combiners should be executed sequentially or in parallel. :param parallel: If True, training and combining is performed in parallel respectively. Otherwise in sequence.