1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-16 17:12:20 +08:00

Update models to enable save/load

This commit is contained in:
Jactus
2021-02-04 17:23:10 +08:00
committed by you-n-g
parent 6a670828a5
commit b84686b215
12 changed files with 35 additions and 34 deletions

View File

@@ -164,7 +164,7 @@ class GATs(Model):
else:
raise NotImplementedError("optimizer {} is not supported!".format(optimizer))
self._fitted = False
self.fitted = False
self.GAT_model.to(self.device)
def mse(self, pred, label):
@@ -297,7 +297,7 @@ class GATs(Model):
# train
self.logger.info("training...")
self._fitted = True
self.fitted = True
for step in range(self.n_epochs):
self.logger.info("Epoch%d:", step)
@@ -329,7 +329,7 @@ class GATs(Model):
torch.cuda.empty_cache()
def predict(self, dataset):
if not self._fitted:
if not self.fitted:
raise ValueError("model is not fitted yet!")
dl_test = dataset.prepare("test", col_set=["feature", "label"], data_key=DataHandlerLP.DK_I)