mirror of
https://github.com/wassname/DeepTime.git
synced 2026-07-02 19:02:12 +08:00
try with stock data
This commit is contained in:
+1
-1
@@ -147,4 +147,4 @@ class ForecastDataset(Dataset):
|
||||
return x, y, x_time, y_time
|
||||
|
||||
def inverse_transform(self, data):
|
||||
return self.scaler.inverse_transform(data)
|
||||
return self.scaler.inverse_transform(data)
|
||||
|
||||
+6
-3
@@ -62,9 +62,12 @@ class Experiment(ABC):
|
||||
# write command file
|
||||
command_file = os.path.join(instance_path, 'command')
|
||||
with open(command_file, 'w') as cmd:
|
||||
# cmd.write(f'python -m {module} '
|
||||
# f'--config_path={instance_config_path} '
|
||||
# f'run >> {instance_path}/instance.log 2>&1')
|
||||
cmd.write(f'python -m {module} '
|
||||
f'--config_path={instance_config_path} '
|
||||
f'run >> {instance_path}/instance.log 2>&1')
|
||||
f'--config_path={instance_config_path} '
|
||||
f'run 2>&1 | tee -a {instance_path}/instance.log')
|
||||
|
||||
@abstractmethod
|
||||
def instance(self):
|
||||
@@ -102,4 +105,4 @@ class Experiment(ABC):
|
||||
def build_experiment(self):
|
||||
if EXPERIMENTS_PATH in str(self.root):
|
||||
raise Exception('Cannot build ensemble from ensemble member configuration.')
|
||||
self.build()
|
||||
self.build()
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
build.experiment_name = 'Stocks/96M'
|
||||
build.module = 'experiments.forecast'
|
||||
build.repeat = 1
|
||||
build.variables_dict = {
|
||||
}
|
||||
|
||||
instance.model_type = 'deeptime'
|
||||
instance.save_vals = False
|
||||
|
||||
get_optimizer.lr = 1e-3
|
||||
get_optimizer.lambda_lr = 1.
|
||||
get_optimizer.weight_decay = 0.
|
||||
|
||||
get_scheduler.warmup_epochs = 5
|
||||
|
||||
get_data.batch_size = 256
|
||||
|
||||
train.loss_name = 'mse'
|
||||
train.epochs = 50
|
||||
train.clip = 10.
|
||||
|
||||
Checkpoint.patience = 7
|
||||
|
||||
deeptime.layer_size = 256
|
||||
deeptime.inr_layers = 5
|
||||
deeptime.n_fourier_feats = 4096
|
||||
deeptime.scales = [0.01, 0.1, 1, 5, 10, 20, 50, 100]
|
||||
|
||||
ForecastDataset.data_path = 'stocks/OXY_2019.csv.gz'
|
||||
ForecastDataset.target = 'RSMKs_18_144_72'
|
||||
ForecastDataset.scale = True
|
||||
ForecastDataset.cross_learn = False
|
||||
ForecastDataset.time_features = []
|
||||
ForecastDataset.normalise_time_features = True
|
||||
ForecastDataset.features = 'M'
|
||||
ForecastDataset.horizon_len = 96
|
||||
ForecastDataset.lookback_mult = 1
|
||||
@@ -0,0 +1,37 @@
|
||||
build.experiment_name = 'Stocks/96S'
|
||||
build.module = 'experiments.forecast'
|
||||
build.repeat = 1
|
||||
build.variables_dict = {
|
||||
}
|
||||
|
||||
instance.model_type = 'deeptime'
|
||||
instance.save_vals = False
|
||||
|
||||
get_optimizer.lr = 1e-3
|
||||
get_optimizer.lambda_lr = 1.
|
||||
get_optimizer.weight_decay = 0.
|
||||
|
||||
get_scheduler.warmup_epochs = 5
|
||||
|
||||
get_data.batch_size = 256
|
||||
|
||||
train.loss_name = 'mse'
|
||||
train.epochs = 50
|
||||
train.clip = 10.
|
||||
|
||||
Checkpoint.patience = 7
|
||||
|
||||
deeptime.layer_size = 256
|
||||
deeptime.inr_layers = 5
|
||||
deeptime.n_fourier_feats = 4096
|
||||
deeptime.scales = [0.01, 0.1, 1, 5, 10, 20, 50, 100]
|
||||
|
||||
ForecastDataset.data_path = 'stocks/OXY_2019.csv.gz'
|
||||
ForecastDataset.target = 'RSMKs_18_144_72'
|
||||
ForecastDataset.scale = True
|
||||
ForecastDataset.cross_learn = False
|
||||
ForecastDataset.time_features = []
|
||||
ForecastDataset.normalise_time_features = True
|
||||
ForecastDataset.features = 'S'
|
||||
ForecastDataset.horizon_len = 96
|
||||
ForecastDataset.lookback_mult = 3
|
||||
@@ -0,0 +1,37 @@
|
||||
build.experiment_name = 'Stocks/96Splus'
|
||||
build.module = 'experiments.forecast'
|
||||
build.repeat = 1
|
||||
build.variables_dict = {
|
||||
}
|
||||
|
||||
instance.model_type = 'deeptime2'
|
||||
instance.save_vals = False
|
||||
|
||||
get_optimizer.lr = 1e-3
|
||||
get_optimizer.lambda_lr = 1.
|
||||
get_optimizer.weight_decay = 0.
|
||||
|
||||
get_scheduler.warmup_epochs = 5
|
||||
|
||||
get_data.batch_size = 256
|
||||
|
||||
train.loss_name = 'mse'
|
||||
train.epochs = 50
|
||||
train.clip = 10.
|
||||
|
||||
Checkpoint.patience = 7
|
||||
|
||||
deeptime2.layer_size = 256
|
||||
deeptime2.inr_layers = 5
|
||||
deeptime2.n_fourier_feats = 4096
|
||||
deeptime2.scales = [0.01, 0.1, 1, 5, 10, 20, 50, 100]
|
||||
|
||||
ForecastDataset.data_path = 'stocks/OXY_2019.csv.gz'
|
||||
ForecastDataset.target = 'RSMKs_18_144_72'
|
||||
ForecastDataset.scale = True
|
||||
ForecastDataset.cross_learn = False
|
||||
ForecastDataset.time_features = []
|
||||
ForecastDataset.normalise_time_features = True
|
||||
ForecastDataset.features = 'S'
|
||||
ForecastDataset.horizon_len = 96
|
||||
ForecastDataset.lookback_mult = 3
|
||||
@@ -0,0 +1,37 @@
|
||||
build.experiment_name = 'Stocks/96Splusshort'
|
||||
build.module = 'experiments.forecast'
|
||||
build.repeat = 1
|
||||
build.variables_dict = {
|
||||
}
|
||||
|
||||
instance.model_type = 'deeptime2'
|
||||
instance.save_vals = False
|
||||
|
||||
get_optimizer.lr = 1e-3
|
||||
get_optimizer.lambda_lr = 1.
|
||||
get_optimizer.weight_decay = 0.
|
||||
|
||||
get_scheduler.warmup_epochs = 5
|
||||
|
||||
get_data.batch_size = 256
|
||||
|
||||
train.loss_name = 'mse'
|
||||
train.epochs = 50
|
||||
train.clip = 10.
|
||||
|
||||
Checkpoint.patience = 7
|
||||
|
||||
deeptime2.layer_size = 256
|
||||
deeptime2.inr_layers = 5
|
||||
deeptime2.n_fourier_feats = 4096
|
||||
deeptime2.scales = [0.01, 0.1, 1, 5, 10, 20, 50, 100]
|
||||
|
||||
ForecastDataset.data_path = 'stocks/OXY_2019.csv.gz'
|
||||
ForecastDataset.target = 'RSMKs_18_144_72'
|
||||
ForecastDataset.scale = True
|
||||
ForecastDataset.cross_learn = False
|
||||
ForecastDataset.time_features = []
|
||||
ForecastDataset.normalise_time_features = True
|
||||
ForecastDataset.features = 'S'
|
||||
ForecastDataset.horizon_len = 6
|
||||
ForecastDataset.lookback_mult = 8
|
||||
@@ -0,0 +1,37 @@
|
||||
build.experiment_name = 'Stocks/96Sshort'
|
||||
build.module = 'experiments.forecast'
|
||||
build.repeat = 1
|
||||
build.variables_dict = {
|
||||
}
|
||||
|
||||
instance.model_type = 'deeptime'
|
||||
instance.save_vals = False
|
||||
|
||||
get_optimizer.lr = 1e-3
|
||||
get_optimizer.lambda_lr = 1.
|
||||
get_optimizer.weight_decay = 0.
|
||||
|
||||
get_scheduler.warmup_epochs = 5
|
||||
|
||||
get_data.batch_size = 256
|
||||
|
||||
train.loss_name = 'mse'
|
||||
train.epochs = 50
|
||||
train.clip = 10.
|
||||
|
||||
Checkpoint.patience = 7
|
||||
|
||||
deeptime.layer_size = 256
|
||||
deeptime.inr_layers = 5
|
||||
deeptime.n_fourier_feats = 4096
|
||||
deeptime.scales = [0.01, 0.1, 1, 5, 10, 20, 50, 100]
|
||||
|
||||
ForecastDataset.data_path = 'stocks/OXY_2019.csv.gz'
|
||||
ForecastDataset.target = 'RSMKs_18_144_72'
|
||||
ForecastDataset.scale = True
|
||||
ForecastDataset.cross_learn = False
|
||||
ForecastDataset.time_features = []
|
||||
ForecastDataset.normalise_time_features = True
|
||||
ForecastDataset.features = 'S'
|
||||
ForecastDataset.horizon_len = 6
|
||||
ForecastDataset.lookback_mult = 8
|
||||
+17
-2
@@ -1,4 +1,5 @@
|
||||
# install environment
|
||||
|
||||
```sh
|
||||
# try with pip torch WORKS!
|
||||
export PROJ=deeptime
|
||||
@@ -13,11 +14,12 @@ pip install tsai
|
||||
|
||||
# note that I've also recorded the env in requirements
|
||||
|
||||
python -m experiments.forecast --config_path=storage/experiments/Exchange/192S/repeat=0/config.gin run >> storage/experiments/Exchange/192S/repeat=0/instance.log 2>&1%
|
||||
python -m experiments.forecast --config_path=storage/experiments/Exchange/192S/repeat=0/config.gin run | tee -a storage/experiments/Exchange/192S/repeat=0/instance.log 2>&1%
|
||||
```
|
||||
|
||||
# run
|
||||
|
||||
```
|
||||
```sh
|
||||
python -m experiments.forecast --config_path=storage/experiments/Exchange/96S/repeat=0/config.gin run
|
||||
|
||||
python -m experiments.forecast --config_path=storage/experiments/Exchange/96Splus/repeat=0/config.gin run
|
||||
@@ -31,3 +33,16 @@ python -m experiments.forecast --config_path=storage/experiments/Exchange/96Ssho
|
||||
# Lessons
|
||||
|
||||
Single variate works much better. The output is not just a straight line. Likely because we have limited the output, not the input
|
||||
|
||||
# stocks
|
||||
|
||||
```sh
|
||||
python -m experiments.forecast --config_path=experiments/configs/Stocks/96S.gin build_experiment
|
||||
python -m experiments.forecast --config_path=storage/experiments/Stocks/96S/repeat=0/config.gin run
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
make build-all path=experiments/configs/Stocks
|
||||
./run.sh
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
for dataset in ECL ETTm2 Exchange ILI Traffic Weather; do
|
||||
for dataset in ECL ETTm2 Exchange ILI Traffic Weather Stocks; do
|
||||
for instance in `/bin/ls -d storage/experiments/$dataset/*/*`; do
|
||||
echo $instance
|
||||
make run command=${instance}/command
|
||||
|
||||
+36
-42
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user