1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-06 12:30:57 +08:00

Almost success to run GRU

This commit is contained in:
Young
2024-07-10 05:59:49 +00:00
parent e2879d9b1e
commit a9fc3435ab
2 changed files with 52 additions and 45 deletions

View File

@@ -55,11 +55,24 @@ class TestNN(TestAutoData):
# tabular dataset
tbds = DatasetH(handler=data_handler, segments=segments)
model_l = [
GeneralPTNN(
n_epochs=2,
pt_model_uri="qlib.contrib.model.pytorch_gru_ts.GRUModel",
pt_model_kwargs={
"d_feat":3,
"hidden_size":8,
"num_layers":1,
"dropout":0.,
},
),
]
for ds in (tsds, tbds):
ptnn = GeneralPTNN()
ptnn.fit(ds) # It works
ptnn.predict(ds) # It works
for ds, model in zip((tsds, tbds), model_l):
model.fit(ds) # It works
model.predict(ds) # It works
break
if __name__ == "__main__":