Simulated Minimum Distance¤
Source code in blackbirds/infer/smd.py
              | 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |  | 
          __init__(loss, optimizer, gradient_horizon=None, progress_bar=False)
¤
  Simulated Minimum Distance. Finds the point in parameter space that
minimizes the distance between the model's output and the observed
data given the loss function loss_fn.
Arguments:
- loss: A callable that returns a (differentiable) loss. Needs to take (parameters, data) as input and return a scalar tensor.
- optimizer: A PyTorch optimizer (eg Adam)
- gradient_horizon: The number of steps to look ahead when computing the gradient. If None, defaults to the number of parameters.
- progress_bar: Whether to display a progress bar.
Source code in blackbirds/infer/smd.py
            | 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |  | 
          run(data, n_epochs=1000, max_epochs_without_improvement=100, parameters_save_dir='best_parameters.pt')
¤
  Runs the SMD algorithm for n_epochs epochs.
Arguments:
- data: The observed data.
- n_epochs: The number of epochs to run.
- max_epochs_without_improvement: The number of epochs to run without improvement before stopping.
- parameters_save_dir: The directory to save the best parameters to.
Source code in blackbirds/infer/smd.py
            | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |  |