tvo.exp

class tvo.exp.EVOConfig(n_states, n_parents, n_generations, parent_selection='fitness', crossover=True, n_children=None, mutation='uniform', bitflip_frequency=None, K_init_file=None)[source]

Configuration object for EVO E-step.

Parameters:
  • n_states (int) – Number of variational states per datapoint to keep in memory.

  • n_parents (int) – Number of parent states to select at each EVO generation. Must be <= n_states.

  • parent_selection (str) –

    Parent selection algorithm for EVO. Must be one of:

    • ’fitness’: fitness-proportional parent selection

    • ’uniform’: random uniform parent selection

  • crossover (bool) – Whether crossover should be applied or not. Must be False if n_children is specified.

  • n_children (int) – Number of children per parent to generate via mutation at each EVO generation. Required if crossover is False.

  • mutation (str) –

    Mutation algorithm for EVO. Must be one of:

    • ’sparsity’: bits are flipped so that states tend towards current model sparsity.

    • ’uniform’: random uniform selection of bits to flip.

  • bitflip_frequency (float) – Probability of flipping a bit during the mutation step (e.g. 2/H for an average of 2 bitflips per mutation). Required when using the ‘sparsity’ mutation algorithm.

  • K_init_file (str) – Full path to H5 file providing initial states

class tvo.exp.EpochLog(epoch, results, runtime=None)[source]

Experiment epoch log.

print()[source]

Print epoch log.

In MPI runs, this method is no-op for all processes but the one with rank 0.

class tvo.exp.FullEMConfig(n_latents)[source]

Full EM configuration.

class tvo.exp.FullEMSingleCauseConfig(n_latents)[source]

Full EM configuration.

class tvo.exp.RandomSamplingConfig(n_states, n_samples, sparsity=0.5, K_init_file=None)[source]

Configuration object for random sampling.

Parameters:
  • n_states (int) – Number of variational states per datapoint to keep in memory.

  • n_samples (int) – Number of new variational states to randomly draw.

  • sparsity (float) – average fraction of active units in sampled states.

  • K_init_file (str) – Full path to H5 file providing initial states

class tvo.exp.TVSConfig(n_states, n_prior_samples, n_marginal_samples, K_init_file=None)[source]

Configuration object for TVS E-step.

Parameters:
  • n_states (int) – Number of variational states per datapoint to keep in memory.

  • n_prior_samples (int) – Number of new variational states to be sampled from prior.

  • n_marginal_samples (int) – Number of new variational states to be sampled from approximated marginal p(s_h=1|vec{y}^{(n)}, Theta).

  • K_init_file (str) – Full path to H5 file providing initial states

class tvo.exp.Testing(conf, estep_conf, model, data_file)[source]

Test given model on given dataset for the given number of epochs.

Parameters:
  • conf (ExpConfig) – Experiment configuration.

  • estep_conf (EStepConfig) – Instance of a class inheriting from EStepConfig.

  • model (Trainable) – model to test

  • data_file (str) – Path to an HDF5 file containing the training dataset. Datasets with name “test_data” and “data” will be searched in the file, in this order.

Only E-steps are run. Model parameters are not updated.

class tvo.exp.Training(conf, estep_conf, model, train_data_file, val_data_file=None)[source]

Train model on given dataset for the given number of epochs.

Parameters:
  • conf (ExpConfig) – Experiment configuration.

  • estep_conf (EStepConfig) – Instance of a class inheriting from EStepConfig.

  • model (Trainable) – model to train

  • train_data_file (str) – Path to an HDF5 file containing the training dataset. Datasets with name “train_data” and “data” will be searched in the file, in this order.

  • val_data_file (str) – Path to an HDF5 file containing the training dataset. Datasets with name “val_data” and “data” will be searched in the file, in this order.

On the validation dataset, Training only performs E-steps without updating the model parameters.