summit.multiview_platform package

Subpackages

Submodules

summit.multiview_platform.exec_classif module

arange_metrics(metrics, metric_princ)

Used to get the metrics list in the right order so that the first one is the principal metric specified in args

Parameters:
  • metrics (dict) – The metrics that will be used in the benchmark

  • metric_princ (str) – The name of the metric that need to be used for the hyper-parameter optimization process

Returns:

metrics – The metrics list, but arranged so the first one is the principal one.

Return type:

list of lists

benchmark_init(directory, classification_indices, labels, labels_dictionary, k_folds, dataset_var)

Initializes the benchmark, by saving the indices of the train samples and the cross validation folds.

Parameters:
  • directory (str) – The benchmark’s result directory

  • classification_indices (numpy array) – The indices of the samples, splitted for the train/test split

  • labels (numpy array) – The labels of the dataset

  • labels_dictionary (dict) – The dictionary with labels as keys and their names as values

  • k_folds (sklearn.model_selection.Folds object) – The folds for the cross validation process

exec_benchmark(nb_cores, stats_iter, benchmark_arguments_dictionaries, directory, metrics, dataset_var, track_tracebacks, exec_one_benchmark_mono_core=<function exec_one_benchmark_mono_core>, analyze=<function analyze>, delete=<function delete_HDF5>, analyze_iterations=<function analyze_iterations>)

Used to execute the needed benchmark(s) on multicore or mono-core functions.

Parameters:
  • nb_cores (int) – Number of threads that the benchmarks can use.

  • stats_iter (int) – Number of statistical iterations that have to be done.

  • benchmark_arguments_dictionaries (list of dictionaries) – All the needed arguments for the benchmarks.

  • classification_indices (list of lists of numpy.ndarray) – For each statistical iteration a couple of numpy.ndarrays is stored with the indices for the training set and the ones of the testing set.

  • directories (list of strings) – List of the paths to the result directories for each statistical iteration.

  • directory (string) – Path to the main results directory.

  • multi_class_labels (ist of lists of numpy.ndarray) – For each label couple, for each statistical iteration a triplet of numpy.ndarrays is stored with the indices for the biclass training set, the ones for the biclass testing set and the ones for the multiclass testing set.

  • metrics (list of lists) – metrics that will be used to evaluate the algorithms performance.

  • labels_dictionary (dictionary) – Dictionary mapping labels indices to labels names.

  • nb_labels (int) – Total number of different labels in the dataset.

  • dataset_var (HDF5 dataset file) – The full dataset that wil be used by the benchmark.

  • classifiers_names (list of strings) – List of the benchmarks’s monoview classifiers names.

  • rest_of_the_args – Just used for testing purposes

Returns:

results – The results of the benchmark.

Return type:

list of lists

exec_classif(arguments)

Runs the benchmark with the given arguments

Parameters:

arguments

Returns:

  • >>> exec_classif([–config_path, /path/to/config/files/])

  • >>>

exec_one_benchmark_mono_core(dataset_var=None, labels_dictionary=None, directory=None, classification_indices=None, args=None, k_folds=None, random_state=None, hyper_param_search=None, metrics=None, argument_dictionaries=None, benchmark=None, views=None, views_indices=None, flag=None, labels=None, track_tracebacks=False, nb_cores=1)
extract_dict(classifier_config)

Reverse function of get_path_dict

gen_single_monoview_arg_dictionary(classifier_name, arguments, nb_class, view_index, view_name, hps_kwargs)
gen_single_multiview_arg_dictionary(classifier_name, arguments, nb_class, hps_kwargs, views_dictionary=None)
get_path_dict(multiview_classifier_args)

This function is used to generate a dictionary with each key being the path to the value. If given {“key1”:{“key1_1”:value1}, “key2”:value2}, it will return {“key1.key1_1”:value1, “key2”:value2}

get_random_hps_args(hps_args, classifier_name)
init_argument_dictionaries(benchmark, views_dictionary, nb_class, init_kwargs, hps_method, hps_kwargs)
init_benchmark(cl_type, monoview_algos, multiview_algos)

Used to create a list of all the algorithm packages names used for the benchmark.

First this function will check if the benchmark need mono- or/and multiview algorithms and adds to the right dictionary the asked algorithms. If none is asked by the user, all will be added.

If the keyword “Benchmark” is used, all mono- and multiview algorithms will be added.

Parameters:
  • cl_type (List of string) – List of types of needed benchmark

  • multiview_algos (List of strings) – List of multiview algorithms needed for the benchmark

  • monoview_algos (Listof strings) – List of monoview algorithms needed for the benchmark

  • args (ParsedArgumentParser args) – All the input args (used to tune the algorithms)

Returns:

benchmark – Dictionary resuming which mono- and multiview algorithms which will be used in the benchmark.

Return type:

Dictionary of dictionaries

init_kwargs(args, classifiers_names, framework='monoview')

Used to init kwargs thanks to a function in each monoview classifier package.

Parameters:
  • args (parsed args objects) – All the args passed by the user.

  • classifiers_names (list of strings) – List of the benchmarks’s monoview classifiers names.

Returns:

kwargs – Dictionary resuming all the specific arguments for the benchmark, one dictionary for each classifier.

For example, for Adaboost, the KWARGS will be {“n_estimators”:<value>, “base_estimator”:<value>}

Return type:

Dictionary

init_kwargs_func(args, benchmark)

Dispached the kwargs initialization to monoview and multiview and creates the kwargs variable

Parameters:
  • args (parsed args objects) – All the args passed by the user.

  • benchmark (dict) – The name of the mono- and mutli-view classifiers to run in the benchmark

Returns:

kwargs – The arguments for each mono- and multiview algorithms

Return type:

dict

init_monoview_exps(classifier_names, views_dictionary, nb_class, kwargs_init, hps_method, hps_kwargs)

Used to add each monoview exeperience args to the list of monoview experiences args.

First this function will check if the benchmark need mono- or/and multiview algorithms and adds to the right dictionary the asked algorithms. If none is asked by the user, all will be added.

If the keyword “Benchmark” is used, all mono- and multiview algorithms will be added.

Parameters:
  • classifier_names (dictionary) – All types of monoview and multiview experiments that have to be benchmarked

  • argument_dictionaries (dictionary) – Maps monoview and multiview experiments arguments.

  • views_dictionary (dictionary) – Maps the view names to their index in the HDF5 dataset

  • nb_class (integer) – Number of different labels in the classification

Returns:

benchmark – Dictionary resuming which mono- and multiview algorithms which will be used in the benchmark.

Return type:

Dictionary of dictionaries

init_multiview_exps(classifier_names, views_dictionary, nb_class, kwargs_init, hps_method, hps_kwargs)
is_dict_in(dictionary)

Returns True if any of the dictionary value is a dictionary itself.

Parameters:

dictionary

set_element(dictionary, path, value)

Set value in dictionary at the location indicated by path

Module contents