amazon-science / unconditional-time-series-diffusion

Official PyTorch implementation of TSDiff models presented in the NeurIPS 2023 paper "Predict, Refine, Synthesize: Self-Guiding Diffusion Models for Probabilistic Time Series Forecasting"
Apache License 2.0
127 stars 25 forks source link

Reproduce Figure 3 #8

Closed hmnza closed 5 months ago

hmnza commented 6 months ago

Hi! How are you?

After resolving various issues that arose during the process of configuring the environment, I basically reproduced the CRPS indicators mentioned in your article by running the commands "Python bin/train_model. py - c configs/train_tsdiff/train_uber_tlc. yaml" and "Python bin/guidance-experience.py - c configs/guidance/guidance_uber_tlc. yaml -- ckpt/path/to/ckpt". However, when I tried to reproduce Figure 3 in the article, which is "Example forecasts generated by TSDiff-Q for time series in Electricity, KDDCup, and Exchange three datasets with different frequencies and/or prediction lengths.", I did not find the corresponding code. What should I do to reproduce that figure?

Thanks!

hmnza commented 5 months ago

I have been trying various codes to reproduce Figure 3 in the past few days, but the images I have created are extremely chaotic and have a huge gap from Figure 3. I really have no other choice, what should I do to reproduce Figure 3?

abdulfatir commented 5 months ago

Hi! Are you able to reproduce the CRPS numbers? Also, can you please specify what is the exact problem you're facing? Saying "extremely chaotic and have a huge gap" doesn't really help me understand your problem. cc @marcelkollovieh

hmnza commented 5 months ago

I successfully obtained the CRPS indicators for the UberTLC dataset by executing the commands "python bin/train_model.py -c configs/train_tsdiff/train_uber_tlc.yaml" and "python bin/guidance_experiment.py -c configs/guidance/guidance_uber_tlc.yaml --ckpt /path/to/ckpt". After that, I wanted to generate a figure similar to Figure 3 in the article, so I attempted to accomplish this task by executing some commands in bin/guidance_experiment.py. I tried several times, and only three of them were successful in generating figures, but all three were far from Figure 3. Below are the commands I used, and the corresponding figures are attached. FIRST: forecasts = list(tqdm(forecast_it, total=len(transformed_testdata))) tss = list(ts_it) plt.clf() for i in range(len(forecasts)): forecast_entry = forecasts[i] target_entry = tss[i] plt.plot(forecast_entry.mean, color='r', label='Forecast') plt.plot(target_entry.values, color='b', label='Actual') plt.legend() SECOND: forecasts = list(tqdm(forecast_it, total=len(transformed_testdata))) tss = list(ts_it) plt.clf() for i in range(30): forecast_entry = forecasts[i] target_entry = tss[i] plt.plot(forecast_entry.mean, color='r', label='Forecast') plt.plot(target_entry.values, color='b', label='Actual') plt.legend() THIRD:(The corresponding figure here I've deleted from the original and only have a screenshot.) forecasts = list(tqdm(forecast_it, total=len(transformed_testdata))) tss = list(ts_it) plt.clf() for i in range(len(forecasts)): forecast_entry = forecasts[i] target_entry = tss[i] plt.plot(forecast_entry.mean[:30], color='r') plt.plot(target_entry.values[:30], color='b') Of course, there are also commands for importing drawing packages, creating canvases, saving drawing files, etc. that I wrote in the rest of bin/guidance_experiment.py, but those have not caused any issues. Not only do I want to make plots similar to Figure 3 on the Uber TLC dataset, but I also want to reproduce Figure 3 on datasets such as Exchange.What should I do to achieve this? wt wt1 wt2

DennisZZQ commented 2 days ago

@hmnza Hi, do you find how to plot the figure 3?