deepsensor.model.defaults#
- compute_greatest_data_density(task_loader)[source]#
Computes data-informed settings for the model’s internal grid density (ppu, points per unit).
Loops over all context and target variables in the
TaskLoader
and computes the data resolution for each. The model ppu is then set to the maximum data ppu.- Parameters:
task_loader (
TaskLoader
) – TaskLoader object containing context and target sets.- Returns:
max_density (int) – The maximum data density (ppu) across all context and target variables, where ‘density’ is the number of points per unit of input space (in both spatial dimensions).
- gen_decoder_scale(model_ppu)[source]#
Computes informed setting for the decoder SetConv scale.
This sets the length scale of the Gaussian basis functions used interpolate from the model’s internal grid to the target locations.
The decoder scale should be as small as possible given the model’s internal grid. The value chosen is 1 / model_ppu (i.e. the length scale is equal to the model’s internal grid spacing).
- Parameters:
model_ppu (int) – Model ppu (points per unit), i.e. the number of points per unit of input space.
- Returns:
float – Decoder scale.
- gen_encoder_scales(model_ppu, task_loader)[source]#
Computes data-informed settings for the encoder SetConv scale for each context set.
This sets the length scale of the Gaussian basis functions used to encode the context sets.
For off-grid station data, the scale should be as small as possible given the model’s internal grid density (ppu, points per unit). The value chosen is 0.5 / model_ppu (i.e. half the model’s internal resolution).
For gridded data, the scale should be such that the functional representation smoothly interpolates the data. This is determined by computing the data resolution (the distance between the nearest two data points) for each context variable. The encoder scale is then set to 0.5 * data_resolution.
- Parameters:
model_ppu (int) – Model ppu (points per unit), i.e. the number of points per unit of input space.
task_loader (
TaskLoader
) – TaskLoader object containing context and target sets.
- Returns:
list[float] – List of encoder scales for each context set.