pusion.control.decision_processor module

class pusion.control.decision_processor.DecisionProcessor(config: pusion.model.configuration.Configuration)

Bases: object

DecisionProcessor is the main user interface of the decision fusion framework. It provides all methods for selecting combiners including the AutoCombiner and the GenericCombiner. It also ensures uniformity and correct use of all pusion.core combiners.

Parameters

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

set_coverage(coverage)

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

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. 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. 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.

set_data_split_ratio(validation_size)

Set the size of the validation data used by the AutoCombiner to evaluate all applicable fusion methods in order to select the combiner with the best classification performance. Accordingly, the other data of size 1-validation_size is used to train all individual combiners.

Parameters

validation_size – A float between 0 and 1.0. Ratio of the validation data set.

train(y_ensemble_valid, y_valid, **kwargs)

Train the combiner model determined by the configuration.

Warning

A trainable combiner is always trained with the validation dataset provided by ensemble classifiers.

Parameters
  • y_ensemble_valid

    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.

  • y_validnumpy.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.

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

combine(y_ensemble_test)

Combine decision outputs using the combiner model determined by the configuration.

Parameters

y_ensemble_test

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

numpy.array of shape (n_samples, n_classes). A matrix 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 y_ensemble_test input tensor.

get_multi_combiner_decision_output()

Retrieve the decision fusion outputs obtained by multiple combiners. This function is only callable for configurations including AutoCombiner or GenericCombiner as a method.

Returns

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

get_optimal_combiner(eval_metric=None)

Retrieve the combiner with the best classification performance obtained by the framework, i.e. the AutoCombiner or the GenericCombiner. In case of combining with the GenericCombiner, an Evaluation needs to be set by set_evaluation.

Returns

The combiner object.

get_combiners()

Retrieve combiners (core methods) which are preselected by the framework according to the auto-detected configuration. :return: list of combiner objects obtained by the GenericCombiner or AutoCombiner.

get_combiner()
Returns

Selected combiner object.

report(eval_metric=None)
Returns

The textual evaluation report.

info()

Retrieve the information, the automatic combiner selection is based on.

Returns

tuple of the form ((A, B, C), D), whereby A represents the classification problem (‘MULTI_CLASS’ or ‘MULTI_LABEL’), B the assignment type (‘CRISP’ or ‘CONTINUOUS’) and C the coverage type (‘REDUNDANT’, ‘COMPLEMENTARY’ or ‘COMPLEMENTARY_REDUNDANT’).

D contains the combiner type selection as a list. Possible combiner types are UtilityBasedCombiner, TrainableCombiner and EvidenceBasedCombiner.

get_multi_combiner_runtimes()

Retrieve the train and combine runtime for each combiner used during a generic fusion.

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_evaluation(evaluation)
Parameters

evaluationpusion.control.evaluation.Evaluation object, a combiner evaluation was performed with.

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.