trial_simulation.tabular.GaussianCopula

class pytrial.tasks.trial_simulation.tabular.gaussian_copula.GaussianCopula(experiment_id='trial_simulation.tabular.gaussiancopula')[source]

Bases: pytrial.tasks.trial_simulation.tabular.base.TabularSimulationBase

Implement Gaussian Copula model for tabular patient simulation.

Parameters

experiment_id (str, optional (default='trial_simulation.tabular.gaussiancopula')) – The name of current experiment. Decide the saved model checkpoint name.

fit(train_data)[source]

Train gaussian copula model to simulate patient outcome with tabular input data.

Parameters

train_data (dict or TabularPatientBase) – The training data, which is the real tabular patient data.

load_model(checkpoint=None)[source]

Save the learned gaussian copula model to the disk.

Parameters

checkpoint (str or None) –

The path to the saved model.

  • If a directory, the only checkpoint file .model will be loaded.

  • If a filepath, will load from this file;

  • If None, will load from self.checkout_dir.

predict(n=200)[source]

simulate a new tabular data with number_of_predictions.

Parameters

n (int) – The number of synthetic samples to generation.

Returns

ypred – A new tabular data simulated by the model

Return type

TabularPatientBase

save_model(output_dir=None)[source]

Save the learned gaussian copula model to the disk.

Parameters

output_dir (str or None) – The dir to save the learned model. If set None, will save model to self.checkout_dir.