scgen.SCGEN.train¶
- SCGEN.train(max_epochs=None, use_gpu=None, accelerator='auto', devices='auto', train_size=0.9, validation_size=None, shuffle_set_split=True, batch_size=128, early_stopping=False, plan_kwargs=None, **trainer_kwargs)¶
Train the model.
- Parameters
- max_epochs
int
|None
Optional
[int
] (default:None
) Number of passes through the dataset. If None, defaults to np.min([round((20000 / n_cells) * 400), 400])
- use_gpu
str
|int
|bool
|None
Union
[str
,int
,bool
,None
] (default:None
) Use default GPU if available (if True), or index of GPU to use (if int), or name of GPU (if str, e.g., ‘cuda:0’), or use CPU (if False). Passing in use_gpu!=None will override accelerator and devices arguments. This argument is deprecated in v1.0 and will be removed in v1.1. Please use accelerator and devices instead.
- accelerator
str
(default:'auto'
) Supports passing different accelerator types (“cpu”, “gpu”, “tpu”, “ipu”, “hpu”, “mps, “auto”) as well as custom accelerator instances.
- devices
int
|List
[int
] |str
Union
[int
,List
[int
],str
] (default:'auto'
) The devices to use. Can be set to a non-negative index (int or str), a sequence of device indices (list or comma-separated str), the value -1 to indicate all available devices, or “auto” for automatic selection based on the chosen accelerator. If set to “auto” and accelerator is not determined to be “cpu”, then devices will be set to the first available device.
- train_size
float
(default:0.9
) Size of training set in the range [0.0, 1.0].
- validation_size
float
|None
Optional
[float
] (default:None
) Size of the test set. If None, defaults to 1 - train_size. If train_size + validation_size < 1, the remaining cells belong to a test set.
- shuffle_set_split
bool
(default:True
) Whether to shuffle indices before splitting. If False, the val, train, and test set are split in the sequential order of the data according to validation_size and train_size percentages.
- batch_size
int
(default:128
) Minibatch size to use during training.
- early_stopping
bool
(default:False
) Perform early stopping. Additional arguments can be passed in **kwargs. See
Trainer
for further options.- plan_kwargs
dict
|None
Optional
[dict
] (default:None
) Keyword args for
TrainingPlan
. Keyword arguments passed to train() will overwrite values present in plan_kwargs, when appropriate.- **trainer_kwargs
Other keyword args for
Trainer
.
- max_epochs