Exemplo n.º 1
0
def main(cfg: DictConfig):
    for i in range(100):
        seed = i + 1000
        seed_everything(seed)
        sequence_length = cfg.params[0].sequence_length
        hidden_layer = cfg.params[1].hidden_layer
        hidden_feature = cfg.params[2].hidden_feature
        activation = cfg.params[3].activation

        KOSPI200Dataset.setup(train_length=train_length,
                              val_length=val_length,
                              test_length=test_length,
                              sequence_length=sequence_length
                              )  # 2020.07.03 615일(개장일 기준) 이전이 2018.01.02

        comet_logger = CometLogger(
            api_key="SWhvV0XPkHV8tPdU8Nv67EXxU",
            workspace="dldjwls3",  # Optional
            project_name=f"stock-candidate-{train_length}days",
            experiment_name=
            f'gcn_{sequence_length}_{activation}_{hidden_layer}_{hidden_feature}'
        )

        model = Baseline(seed=seed,
                         sequence_length=sequence_length,
                         num_feature=5,
                         activation=activation,
                         hidden_layer=hidden_layer,
                         hidden_feature=hidden_feature)
        trainer = Trainer(max_epochs=120, gpus=-1, logger=comet_logger)
        trainer.fit(model)
Exemplo n.º 2
0
def main(cfg: DictConfig):
    seed = 1
    train_length = 500
    val_length = 30
    test_length = 585

    sequence_length = 9
    hidden_layer = 4
    hidden_feature = 1
    activation = 'sigmoid'

    seed_everything(seed)
    KOSPI200Dataset.setup(train_length=train_length,
                          val_length=val_length,
                          test_length=test_length,
                          sequence_length=sequence_length
                          )  # 2020.07.03 615일(개장일 기준) 이전이 2018.01.02

    comet_logger = CometLogger(
        api_key="SWhvV0XPkHV8tPdU8Nv67EXxU",
        workspace="dldjwls3",  # Optional
        project_name="stock-test",
        experiment_name='test')

    model = Baseline(seed=seed,
                     sequence_length=sequence_length,
                     num_feature=5,
                     activation=activation,
                     hidden_layer=hidden_layer,
                     hidden_feature=hidden_feature)
    trainer = Trainer(max_epochs=120, gpus=-1, logger=comet_logger)
    trainer.fit(model)
Exemplo n.º 3
0
def main(cfg: DictConfig):
    train_length = 500
    val_length = 30
    test_length = 585

    opt = Optimizer(
        config,
        api_key='SWhvV0XPkHV8tPdU8Nv67EXxU',
        project_name=f'stock-gcn-experiment-sequences-{train_length}days')
    for experiment in opt.get_experiments():
        seed = 1
        seed_everything(seed)

        hidden_layer = experiment.get_parameter('hidden_layer')
        hidden_feature = experiment.get_parameter('hidden_feature')
        activation = experiment.get_parameter('activation')
        sequence_length = experiment.get_parameter('sequence_length')

        KOSPI200Dataset.setup(train_length=train_length,
                              val_length=val_length,
                              test_length=test_length,
                              sequence_length=sequence_length
                              )  # 2020.07.03 615일(개장일 기준) 이전이 2018.01.02

        comet_logger = CometLogger(
            api_key="SWhvV0XPkHV8tPdU8Nv67EXxU",
            workspace="dldjwls3",  # Optional
            project_name=f'stock-gcn-experiment-sequences-{train_length}days',
            experiment_name=
            f'gcn_{sequence_length}_{activation}_{hidden_layer}_{hidden_feature}',
            experiment_key=experiment.get_key())

        model = Baseline(seed=seed,
                         sequence_length=sequence_length,
                         num_feature=5,
                         hidden_layer=hidden_layer,
                         hidden_feature=hidden_feature,
                         activation=activation)
        trainer = Trainer(max_epochs=120, gpus=-1, logger=comet_logger)
        trainer.fit(model)
Exemplo n.º 4
0
def main(cfg: DictConfig):
    for i in range(20):
        train_length = 300
        val_length = 30
        test_length = 585 - 30 * i

        seed = 1017
        seed_everything(seed)
        sequence_length = 10
        hidden_layer = 5
        hidden_feature = 12
        activation = 'sigmoid'

        KOSPI200Dataset.setup(train_length=train_length,
                              val_length=val_length,
                              test_length=test_length,
                              sequence_length=sequence_length
                              )  # 2020.07.03 615일(개장일 기준) 이전이 2018.01.02

        comet_logger = CometLogger(
            api_key="SWhvV0XPkHV8tPdU8Nv67EXxU",
            workspace="dldjwls3",  # Optional
            project_name=f"stock-rolling-simulation-{train_length}days",
            experiment_name=
            f'{seed}seed_gcn_{sequence_length}_{activation}_{hidden_layer}_{hidden_feature}'
        )

        model = Baseline(seed=seed,
                         sequence_length=sequence_length,
                         num_feature=5,
                         activation=activation,
                         hidden_layer=hidden_layer,
                         hidden_feature=hidden_feature)
        trainer = Trainer(max_epochs=120, gpus=-1, logger=comet_logger)
        trainer.fit(model)
        trainer.test(model)
Exemplo n.º 5
0
 def val_dataloader(self):
     val_dataset = KOSPI200Dataset(mode='val')
     return DataLoader(val_dataset, batch_size=batch_size, shuffle=False)
Exemplo n.º 6
0
 def train_dataloader(self) -> DataLoader:
     train_dataset = KOSPI200Dataset()
     return DataLoader(train_dataset, num_workers=4, batch_size=batch_size, shuffle=True)
Exemplo n.º 7
0
 def prepare_data(self) -> None:
     KOSPI200Dataset.load_data()
     KOSPI200Dataset.process_data()
Exemplo n.º 8
0
 def test_dataloader(self):
     test_dataset = KOSPI200Dataset(mode='val') # validation 에서의 일 수익률을 확인하고 싶어
     return DataLoader(test_dataset, batch_size=batch_size, shuffle=False)