memilio.surrogatemodel.utils.helper_functions

Functions

calc_split_index(n[, split_train, ...])

Calculating the indixes for a split_train:split_valid:split_test decomposition of a set with size n

flat_input(input)

Flatten input dimension

interpolate_age_groups(data_entry)

! Interpolates the age groups from the population data into the age groups used in the simulation.

normalize_simulation_data(data, transformer, ...)

Transforms the data by a logarithmic normalization.

remove_confirmed_compartments(result_array, ...)

Removes the confirmed compartments which are not used in the data generation.

memilio.surrogatemodel.utils.helper_functions.calc_split_index(
n,
split_train=0.7,
split_valid=0.2,
split_test=0.1,
)

Calculating the indixes for a split_train:split_valid:split_test decomposition of a set with size n

It must hold split_train + split_valid + split_test = 1

Parameters:
  • n – integer value

  • split_train – value between 0 and 1

  • split_valid – value between 0 and 1

  • split_test – value between 0 and 1

Returns:

a list of the form [i_train, i_valid, i_test]

memilio.surrogatemodel.utils.helper_functions.flat_input(input)

Flatten input dimension

Parameters:

input – input array of size (n,k,l)

Returns:

reshaped array of size (n, k*l)

memilio.surrogatemodel.utils.helper_functions.interpolate_age_groups(data_entry)

! Interpolates the age groups from the population data into the age groups used in the simulation. We assume that the people in the age groups are uniformly distributed. @param data_entry Data entry containing the population data. @return List containing the population in each age group used in the simulation.

memilio.surrogatemodel.utils.helper_functions.normalize_simulation_data(
data,
transformer,
num_runs,
num_groups=6,
num_compartments=8,
)

Transforms the data by a logarithmic normalization. Reshaping is necessary, because the transformer needs an array with dimension <= 2.

Parameters:
  • data – Data to be transformed.

  • transformer – Transformer used for the transformation.

  • num_runs – Number of samples represented by the data.

  • num_groups – Number of age groups represented by data.

  • num_compartments – Number of compartments.

Returns:

Transformed data.

memilio.surrogatemodel.utils.helper_functions.remove_confirmed_compartments(
result_array,
delete_indices,
)

Removes the confirmed compartments which are not used in the data generation.

Parameters:
  • result_array – Array containing the simulation results.

  • delete_indices – flat indices indicating position containing data from confirmed compartments.

Returns:

Array containing the simulation results without the confirmed compartments.