Experiment and Problem
- class optexp.Experiment(optim: Optimizer, problem: Problem, eval_every: int, steps: int, seed: int = 0, hardware_config: HardwareConfig = StrictManualConfig(num_devices=1, micro_batch_size=None, eval_micro_batch_size=None, num_workers=0, device='auto'), group: str = 'default')[source]
Specify an experiment.
- Parameters:
optim (Optimizer) – optimizer to use.
problem (Problem) – problem to solve.
eval_every (int) – often to evaluate the metrics.
steps (int) – total number of steps. To convert from epochs, use
optexp.utils.epochs_to_steps().seed (int, optional) – seed for the random number generator. Defaults to 0.
hardware_config (HardwareConfig, optional) – implementation details. Defaults to
StrictManualConfig().group (str, optional) – name for logging. Defaults to
"default".
- class optexp.Problem(model: Model, dataset: Dataset, batch_size: int, lossfunc: LossLikeMetric, metrics: Iterable[Metric], datapipe: DataPipe = TensorDataPipe(), init_callback: InitCallback | None = None)[source]
Specify a problem.
- Parameters:
model (Model) – model to optimize.
dataset (Dataset) – dataset to fit the model to.
batch_size (int) – effective batch size. To use gradient accumulation, set the
micro_batch_sizeinoptexp.hardwareconfig.HardwareConfig.lossfunc (Metric) – loss function to use for optimization.
metrics (Iterable[Metric]) – metrics to evaluate.