Example losses¤
SingleOutput_SimulateAndMMD
¤
Example implementation of a loss that simulates from the model and computes the MMD between the model output and observed data y. (This treats the entries in y and in the simulator output as exchangeable.)
Arguments:
y
: torch.Tensor containing a single univariate time series.model
: An instance of a Model.gradient_horizon
: An integer or None. Sets horizon over which gradients are retained. If None, infinite horizon used.
Source code in blackbirds/losses.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
SingleOutput_SimulateAndMSELoss
¤
Computes MSE between observed data y and simulated data at theta (to be passed during call).
Arguments:
model
: An instance of a Model. The model that you'd like to "fit".gradient_horizon
: Specifies the gradient horizon to use. None implies infinite horizon.
Source code in blackbirds/losses.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
UnivariateMMDLoss
¤
Source code in blackbirds/losses.py
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
__init__(y)
¤
Computes MMD between data y and simulated output x (to be passed during call).
Arguments:
y
: torch.Tensor containing a single univariate time series.
Source code in blackbirds/losses.py
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 |
|