site_selection.SiteSelectionBase

class pytrial.tasks.site_selection.base.SiteSelectionBase(experiment_id='test')[source]

Abstract class for all sequential patient data simulations.

Parameters

experiment_id (str, optional (default = 'test')) – The name of current experiment.

eval(mode=False)[source]

Swith the model to the validation mode. Work samely as model.eval() in pytorch.

Parameters

mode (bool, optional (default = False)) – If False, switch to the validation mode.

abstract fit(train_data)[source]

Fit function needs to be implemented after subclass.

Parameters

train_data (Any) – Training data.

abstract load_model(checkpoint)[source]

Load the pretrained model from disk, needs to be implemented after subclass.

Parameters

checkpoint (str) – The path to the checkpoint file.

abstract predict(test_data)[source]

Prediction function needs to be implemented after subclass.

Parameters

test_data (Any) – Testing data.

abstract save_model(output_dir)[source]

Save the model to disk, needs to be implemented after subclass.

Parameters

output_dir (str) – The path to the output directory.

train(mode=True)[source]

Swith the model to the training mode. Work samely as model.train() in pytorch.

Parameters

mode (bool, optional (default = True)) – If True, switch to the training mode.