rindti.utils

class IterDict[source]

Bases: object

Returns a list of dicts with all possible combinations of hyperparameters.

add_arg_prefix(prefix: str, kwargs: dict) dict[source]

Adds the prefix to all the args. Removes None values and “index_mapping”.

Parameters
  • prefix (str) – prefix to add (drug_, prot_ or mlp_ usually)

  • kwargs (dict) – dict of arguments

Returns

Sub-dict of arguments

Return type

dict

get_git_hash()[source]

Get the git hash of the current repository.

read_config(filename: str) dict[source]

Read in yaml config for training.

recursive_apply(ob: Union[Dict, Any], func: Callable) Union[Dict, Any][source]

Apply a function to the nested dict recursively.

remove_arg_prefix(prefix: str, kwargs: dict) dict[source]

Removes the prefix from all the args.

Parameters
  • prefix (str) – prefix to remove (drug_, prot_ or mlp_ usually)

  • kwargs (dict) – dict of arguments

Returns

Sub-dict of arguments

Return type

dict

write_config(filename: str, config: dict) None[source]

Write a config to a file.

minmax_normalise(s: pandas.core.series.Series) pandas.core.series.Series[source]

MinMax normalisation of a pandas series.

split_random(dataset, fracs: list) list[source]

Randomly split dataset.

to_prob(s: pandas.core.series.Series) pandas.core.series.Series[source]

Convert to probabilities.

plot_loss_count_dist(losses: dict) matplotlib.figure.Figure[source]

Plot distribution of times sampled vs avg loss of families.