David Landry
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # CRIMS2S This page describes our submission for the 2021 S2S AI Challenge. The first section, **Submission information**, describes what data was used and our safeguards to prevent overfitting and improve reproductibility. The second section, **Methods**, describes our methods in more detail. ## Submission information ### Data used * Multiple fields from the ECMWF hindcasts/forecasts. See the `crims2s/conf/fields/both_easy.yaml` file for a complete list. * `t2m` and `tp` from NCEP and ECCC, as provided on Renku by the challenge organizers. * `orog` for ECMWF, which was not downloaded through Renku, but we provide the file in our repo. ### Safeguards to prevent overfitting We took the following measures to prevent overfitting. * [x] We did not use 2020 observations in training (explicit overfitting and cheating) * We also remove any training data for which the validity time is in 2020 (i.e. the last part of the late 2019 forecasts). * [x] We did not repeatedly verify our model on 2020 observations and incrementally improved my RPSS (implicit overfitting) * The train/validation data and the test data lived in two separate directories for the duration of our development. * [x] We provide RPSS scores for the training period with script skill_by_year, as provided in the template submission. * [x] We tried our best to prevent data leakage. * [x] We honor the train-validate-test split principle. This means that the hindcast data is split into train and validate, whereas test is withheld. - We use the train-validate split for all but our final experiments. In the final push to improve our results, we use the validation set for training. That is, all hyperparamater tuning and model building for calibrating the individual dynamical model forecast was done using the training data only, which was then validated using the validation data. After this is done, and in our final experiment, we include the validation data for training in order to increase sample size. The test set is in a separate folder and was never loaded for training purposes. * [x] We did not use test explicitly in training or implicitly in incrementally adjusting parameters. * [x] We considered cross-validation. - Our validation strategy was not a cross validation, because the amount of time required to train our models make it impractical. Since we use data from all three centers (ECMWF, ECCC and NCEP), we used years 2010, 2017 and 2019 as validation years. That way, we have at least one validation year where the data is available for each center. ### Safeguards for Reproducibility Notebook/code must be independently reproducible from scratch by the organizers (after the competition), if not possible: no prize * [x] All training data is publicly available (no pre-trained private neural networks, as they are not reproducible for us) - All the data was downloaded from renku, except the orography which we provide in the repo. * [x] Code is well documented, readable and reproducible. * Full instructions to execute the code are provided. Reproductibility hiccups are possible, as in any experimental code. We remain available if any support is required. * Some parts of the source code are on the configurable end of the readability/configurability spectrum. This was done to maximize our ability to improve the performance metrics. We provide pointers to the most important parts of the source code in our **Methods** section. We remain available if more explanations are necessary. * [x] Code to reproduce training and predictions is preferred to run within a day on the described architecture. If the training takes longer than a day, please justify why this is needed. Please do not submit training piplelines, which take weeks to train. - Our models comprises deep neural architecture which typically train over many days depending on the GPU power used. In our case, the model training lasts about two days on a GTX 1080 ti. These training times are not out of the ordinary for a convolutional neural network in our experience. - The data preparation step lasts about an hour for us, but is done using about 53 jobs in parallel on a computing cluster. That means that it could take more than 24 hours if only consumer-grade equipment is used. The usage of so many data is justified by a common principle in deep machine learning where a larger data volume typically improve model performance. We can make our version of the pre-processed data available upon request. ## Methods The goal of our contributing model is to make global, 3-category, probabilistic forecasts of temperature and precipitation at the weeks 3-4 and 5-6 lead times. For this, we have developed a so-called "opportunistic mixture model" that blends together five different predictions. The predictions are based on dynamical ensemble forecasts from three global circulation models, as well as the observed climatology. Generally speaking, the blending of the different predictions is according to historical skill, hence the name "opportunistic". Since the observed climatology is used as one of the prediction models, our opportunistic model can be interpreted as a form of Bayesian Model Averaging (Raftery et al., 1997). The model architecture is displayed in the following schematic: ![](https://i.imgur.com/SHLxWy6.png) Briefly, the predictions include: 1. Climatology -- i.e. the observed climatological probability for a given category (1/3 by definition); 2. Dynamical ensemble forecasts obtained from models from three forecasting centres (ECCC, NCEP, and ECMWF) that have been calibrated using ensemble model output statistics (EMOS; Gneiting et al., 2007); 3. Dynamical ensemble forecasts from ECMWF that have been calibrated using a convolutional neural network (CNN). These predictions are then combined using an additional CNN that weights each prediction based on historical skill. We now describe the main steps of our opportunistic model, which includes a detailed description of each prediction method, including implementation details and references to the source code. ### EMOS Model Our model uses an ensemble of EMOS corrected forecasts as its basis. For its parameters $\mu$ and $\sigma$ (where $\mu$ is the ensemble mean and $\sigma$ is the sample standard deviation), our EMOS model uses a rolling window inside a model bank. ![](https://i.imgur.com/LDBKqm9.png) The rolling window has the effect of regularizing the EMOS parameters and avoiding overfitting. Indeed, the parameters for a specific week also have to be good for other weeks neighboring weeks of the year. Consequently, they cannot overfit on the data of a single week. We use a rolling window of 20 weeks for our final submission. Unfortunately, the source code of this EMOS model is heavily factored and perhaps less easily understood. This was done to maximize the configurability of it during the competition. This way, it was possible to try more variants in less time, and optimize the metrics more efficiently. The downside is that the source code could probabily benefit from a rewrite using a fixed configuration, to make it more easily readable. Nevertheless, we point to important parts of its source code. The rolling window logic is implemented in the `PytorchRolllingWindowMultiplexer` and `WeeklyRollingWindowMultiplexer` in the `crims2s/training/model/util.py` file. The linear model logic is implemented in `crims2s/training/model/emos.py` file in the `LinearModel` class. The `MultiplexedNormalEMOSModel` and `RollingWindowNormalEMOSModel` classes interface the rolling window logic with the rest of our training framework. `TempPrecipEMOS` joins two EMOS models together so that we can forecast temperature and precipitation at the same time. ### Convolutional post-processing One of the 5 predictions we mix is the ECMWF forecast post-processed using a convolutional neural network. The convolutional architecture that performs the post-processing is similar to the one of the weight model described below, in that it uses ConvBlocks and skip connections. It is different in that it outputs a 3-category probabilistic forecast instead of relative weights. We refer to the schematics of the weight model for an overview of the architecture. For a more precise description, the source code of the convolutional post-processing model is found in the `ConvPostProcessingJG` class of the `crims2s/training/model/conv.py` file. Its configuration file is `crims2s/training/conf/experiment/model/conv_JG.yaml`. ### Mixing model The mixing model brings all our sub-models together to produce forecasts. The schematic below shows its architecture. The "forward pass" and "backpropagation" arrows show how we go from model input (in blue) to the training loss (in red), and back. The backpropagation allows the "Conv. weight model" (upper middle box) to receive information from all 5 predictions (5 lower left blue boxes). ![](https://i.imgur.com/aCEY1UE.png) The source code of the mixing model is in the `MultiCenterBayesianUpdateModel` class in the`crims2s/training/model/bayes.py` file. Notably, the weighted averaging is done using `einsum` at line 255: ```python= # Meaning of the keys: Batch, Model (prior or ecmwf or eccc), Category, Lead time, lAtitude, lOngitude t2m = torch.einsum("bmclao,bmlao->bclao", t2m_forecasts, t2m_weights) tp = torch.einsum("bmclao,bmlao->bclao", tp_forecasts, tp_weights) ``` The source code of the training logic is in the `S2STercilesModule` class. It is located in the `crims2s/training/lightning.py` file. It uses the Pytoch Lightning interface to define training procedures in PyTorch. The actual training is launched using PyTorch Lightning at line 206 of the `crims2s/training/train.py` file. The configuration file for the training module is `crims2s/training/conf/experiment/module/bayes.yaml`. The configuration file for the overall experiment is `crims2s/training/conf/experiment/bayes_multi_noval_jg.yaml`. #### Weight model The weight model has the task of outputting a relative weight for each model, for each variable (temperature and precipitation), for every initialization time, for every lead time, and at each grid cell. It does so using a convolutional architecture. In the core of the convolutional architecture are two branches. The local branch assigns weights to every grid cell. The global branch captures some of the possibly non-local and larger scale features. It summarizes these features in a 64 dimensions vector. We postulate this vector could summarize important teleconnections such as the Madden-Julian Oscillation. This global context is then re-added to the local representations of the tiles. Then, two prediction heads go from this representation to a set of weights for each variable. This schematic shows the architecture of the weight model, and then shows the architecture of its various components. ![](https://i.imgur.com/fERAM4f.png) The weight model is defined in the `BiheadedWeightModel` class in the `crims2s/training/model/bayes.py` file. It is configured in `crims2s/training/conf/model/bayes_multi_jg_noval.yaml`, under the `weight_model` key. ## Github This was an overview of the key aspects of our submission for the S2S AI challenge. To take this overview further and execute the code, instructions are available in the [repository README](https://github.com/crim-ca/crims2s#reproducing).

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully