multiview_generator.utils

utils

format_array(input, size, type_needed=int)

Used to test that : * if the input is an array, it is the right size, * if it is either a string, or a saclar, build an array with input repeated size times.

Parameters:
  • input – either a string, a scalar or an array-like

  • size – an int, the size of the output array

Returns:

a numpy.ndarray of shape (size, )

get_config_from_file(file_path)

Loads the configuration for the yaml config file

Parameters:

file_path – path to the config file.

Returns:

init_class_weights(class_weights, n_classes)

Initializes the class weights. Sets a unifrom distribution if no distribution is specified.

Parameters:
  • class_weights

  • n_classes

Returns:

init_error_matrix(error_matrix, n_classes, n_views)

Initializes the error matrix

Parameters:
  • error_matrix

  • n_classes

  • n_views

Returns:

init_random_state(random_state)

Initalizes the random state.

Parameters:

random_state

Returns:

init_array_attr(attr, n_repeat, base_val=0)

Transforms a unique attribute into an array with the same value.

Parameters:
  • attr

  • n_repeat

  • base_val

Returns:

init_list(input, size, type_needed=dict)

Transforms a unique attribute into a list with the same value.

Parameters:
  • attr

  • n_repeat

  • base_val

Returns: