You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run the covariates.ipynb and I could not understand what is the cov_forecast from the model.forecast_with_covariates.
It is a list of 48 array, each array has 24 forecasted values. what is the 48 array anyway? And I notice that the number could change if you change context_len and horizon_len.
for i, example in enumerate(input_data()):
raw_forecast, _ = model.forecast(
inputs=example["inputs"], freq=[0] * len(example["inputs"])
)
start_time = time.time()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I run the covariates.ipynb and I could not understand what is the cov_forecast from the model.forecast_with_covariates.
It is a list of 48 array, each array has 24 forecasted values. what is the 48 array anyway? And I notice that the number could change if you change context_len and horizon_len.
`# Benchmark
batch_size = 128
context_len = 120
horizon_len = 24
input_data = get_batched_data_fn(batch_size = 128)
metrics = defaultdict(list)
import time
for i, example in enumerate(input_data()):
raw_forecast, _ = model.forecast(
inputs=example["inputs"], freq=[0] * len(example["inputs"])
)
start_time = time.time()
cov_forecast, ols_forecast = model.forecast_with_covariates(
inputs=example["inputs"],
dynamic_numerical_covariates={
"gen_forecast": example["gen_forecast"],
},
dynamic_categorical_covariates={
"week_day": example["week_day"],
},
static_numerical_covariates={},
static_categorical_covariates={
"country": example["country"]
},
freq=[0] * len(example["inputs"]),
xreg_mode="xreg + timesfm", # default
ridge=0.0,
force_on_cpu=False,
normalize_xreg_target_per_input=True, # default
)
print(
f"\rFinished batch {i} linear in {time.time() - start_time} seconds",
end="",
)
metrics["eval_mae_timesfm"].extend(
mae(raw_forecast[:, :horizon_len], example["outputs"])
)
metrics["eval_mae_xreg_timesfm"].extend(mae(cov_forecast, example["outputs"]))
metrics["eval_mae_xreg"].extend(mae(ols_forecast, example["outputs"]))
metrics["eval_mse_timesfm"].extend(
mse(raw_forecast[:, :horizon_len], example["outputs"])
)
metrics["eval_mse_xreg_timesfm"].extend(mse(cov_forecast, example["outputs"]))
metrics["eval_mse_xreg"].extend(mse(ols_forecast, example["outputs"]))
print()
for k, v in metrics.items():
print(f"{k}: {np.mean(v)}")`
Beta Was this translation helpful? Give feedback.
All reactions