-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* β¨ Add new model * β¨ Add new images * β¨ Add new utility function * β¨ Add new utility function * β¨ Add new utility function * π Adjust default cfg values
- Loading branch information
1 parent
b58ce12
commit 2c3445a
Showing
67 changed files
with
7,056 additions
and
2,941 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Historical Inertia: A Neglected but Powerful Baseline for Long Sequence Time-series Forecasting | ||
|
||
## Citation | ||
|
||
``` | ||
@article{DBLP:journals/corr/abs-2103-16349, | ||
author = {Yue Cui and | ||
Jiandong Xie and | ||
Kai Zheng}, | ||
title = {Historical Inertia: An Ignored but Powerful Baseline for Long Sequence | ||
Time-series Forecasting}, | ||
journal = {CoRR}, | ||
volume = {abs/2103.16349}, | ||
year = {2021}, | ||
url = {https://arxiv.org/abs/2103.16349}, | ||
eprinttype = {arXiv}, | ||
eprint = {2103.16349}, | ||
timestamp = {Wed, 07 Apr 2021 15:31:46 +0200}, | ||
biburl = {https://dblp.org/rec/journals/corr/abs-2103-16349.bib}, | ||
bibsource = {dblp computer science bibliography, https://dblp.org} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
DEVICE: "cuda:0" | ||
|
||
IO: | ||
LOOKBACK: 720 | ||
HORIZON: 48 | ||
|
||
TRAINING: | ||
TRAIN_DATA_SPLIT: "col" | ||
TRAIN_DATA_RATIO: 0.75 | ||
NUM_EPOCHS: 1 | ||
|
||
MODEL: | ||
NAME: "HistricalInertia" | ||
|
||
DATASET: | ||
BASE_START_INDEX: 48 | ||
NORM_PER_DATASET: False | ||
|
||
DATALOADER: | ||
BATCH_SIZE_TRAIN: 32 | ||
|
||
METRICS: | ||
NAMES: ["MAE", "MSE"] | ||
ARGS: [{}, {}] | ||
|
||
SCALER: | ||
NAME: "StandardScaler" | ||
|
||
LOGGER: | ||
LOG_DIR: "hi-ett-h1-sam" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# TODO: Add unnormalized results | ||
|
||
import pandas as pd | ||
import torch | ||
from tqdm import tqdm | ||
from tsts.metrics import MAE, MSE | ||
from tsts.scalers import StandardScaler | ||
from tsts.solvers import TimeSeriesForecaster | ||
|
||
lookback = 720 | ||
horizon = 48 | ||
start = 12 * 30 * 24 + 4 * 30 * 24 + lookback | ||
end = 12 * 30 * 24 + 8 * 30 * 24 + lookback - horizon | ||
|
||
X = pd.read_csv("/path/to/ETTh1.csv") | ||
X = X[["OT"]] | ||
X = X.values | ||
X = torch.tensor(X, dtype=torch.float32) | ||
|
||
solver = TimeSeriesForecaster("./hi-ett-h1.yml") | ||
|
||
# Initialize scalers with training dataset | ||
num_train_samples = int(0.75 * (12 * 30 * 24 + 4 * 30 * 24)) | ||
X_scaler = StandardScaler() | ||
X_scaler.fit(X[:num_train_samples]) | ||
y_scaler = StandardScaler() | ||
y_scaler.fit(X[:num_train_samples]) | ||
|
||
metric1 = MSE() | ||
metric2 = MAE() | ||
|
||
for i in tqdm(range(start, end)): | ||
x = X[i - lookback : i] | ||
y = X[i : i + horizon] | ||
y_mask = torch.ones_like(y) | ||
x = X_scaler.transform(x) | ||
y = y_scaler.transform(y) | ||
Z = solver.predict(x) | ||
metric1.update(Z, y, y_mask) | ||
metric2.update(Z, y, y_mask) | ||
|
||
score1 = metric1() | ||
score2 = metric2() | ||
print(f"MSE: {score1}") | ||
print(f"MAE: {score2}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pandas as pd | ||
import torch | ||
from tsts.solvers import TimeSeriesForecaster | ||
|
||
start = 0 | ||
end = 12 * 30 * 24 + 4 * 30 * 24 | ||
|
||
X = pd.read_csv("/path/to/ETTh1.csv") | ||
X = X[["OT"]] | ||
X = X.values | ||
X = X[start:end] | ||
X = torch.tensor(X, dtype=torch.float32) | ||
|
||
solver = TimeSeriesForecaster("./hi-ett-h1.yml") | ||
solver.fit([X]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 74b06218c3307010ebd142fcaea93044 | ||
config: 293831d798069392d74282626242223e | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.