alan-turing-institute / deepsensor

A Python package for tackling diverse environmental prediction tasks with NPs.
https://alan-turing-institute.github.io/deepsensor/
MIT License
94 stars 16 forks source link

Fix forecasting lead times and improve forecasting functionality #132

Closed tom-andersson closed 1 month ago

tom-andersson commented 1 month ago

This PR improves forecasting functionality in DeepSensor:

  1. Fixes a bug where models set up with a TaskLoader with target_delta_t containing values >0 would have model.predict only return the longest lead time (if there ar multiple lead times).
  2. Previously, the time dim in model.predict forecasts would only correspond to the initialisation time, which is confusing. This PR adds an init_time and lead_time dim alongside a time coordinate (which is the valid time of the forecast, which is more intuitive and enables comparison with non-forecast ground truth with a single time dim).
  3. Adds a convenient deepsensor.eval.metrics.compute_errors method which takes the Prediction returned by model.predict and computes the differences between the "mean" entry of model predictions with those in a target dataset for each variable in the Prediction, returning an xarray.Dataset of errors from which mean statistics can be computed.

Google Colab demonstrator here.

Notes:

Closes https://github.com/alan-turing-institute/deepsensor/issues/130 Addresses one of the desiderata of https://github.com/alan-turing-institute/deepsensor/issues/30

tom-andersson commented 1 month ago

Google Colab demonstrator here