graphcast icon indicating copy to clipboard operation
graphcast copied to clipboard

Different loss values for seemingly same forecast

Open tvonich opened this issue 1 year ago • 6 comments

I performed "1 Eval Step" forecast with Graphcast small using dataset_source-era5_date-2022-01-01_res-1.0_levels-13_steps-01.nc, steps-12.nc, and steps-40.nc.

The loss is different for each case even though we are only performing a 6 hr forecast in each case. Why might this be? As I understand it, the prediction should be the same in all these cases and the target should also be the same (ERA5 Reanalysis 6hr into the future).

Loss Values: 0.9296875 for 6hr forecast 1-step data 01 Jan 2022 0.69140625 for 6hr forecast 12-step data 01 Jan 2022 0.66015625 for 6hr forecast 40-step data 01 Jan 2022

tvonich avatar Dec 04 '23 18:12 tvonich

One confusing thing about the extract_inputs_targets_forcings is it does it right-aligned instead of left-aligned, so your dataset may start from the same dates, but your actual inputs are not the same date.

tewalds avatar Dec 20 '23 08:12 tewalds

One confusing thing about the extract_inputs_targets_forcings is it does it right-aligned instead of left-aligned, so your dataset may start from the same dates, but your actual inputs are not the same date.

Hey Timo, That would explain it. Why is it structured this way? How does the training method deal with it?

tvonich avatar Jan 13 '24 19:01 tvonich

I'm not sure why this was chosen as the default, but sometimes you want to know how your error changes as you predict the same time from different points in the past. There should probably be an option for choosing left vs right alignment. @alvarosg may have more context here.

tewalds avatar Jan 14 '24 01:01 tewalds

Thanks for the quick response. This work will hopefully get me going on the 1st chapter of my dissertation.

The differences I'm getting are fairly subtle. For example, I just ran a 12 hour forecast with the step-04 netcdf and did the same with the step-40 netcdf. The 6 hr and 12 hr losses are in the jpeg. If alignment was the issue, I'd think the differences would be really large in this case. Would you tend to agree or am I thinking about this the wrong way? image

tvonich avatar Jan 14 '24 01:01 tvonich

The step-04.nc should be a subset of step-40.nc, I think with the same initial time. That should be pretty easy to verify by loading both and looking at the data. Then just make sure you're extracting the data correctly for your use case. Feel free to send a PR with a left/right alignment option.

tewalds avatar Jan 14 '24 02:01 tewalds

Ok. Yep. I see how it picks out the inputs and targets now. I'll make a few changes and try to submit a pull request this week. Thanks!

tvonich avatar Jan 14 '24 05:01 tvonich