Browse Source

[ENH] add save and load method to ABLModel

pull/3/head
Gao Enhao 3 years ago
parent
commit
1830daffd4
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      abl/learning/abl_model.py

+ 14
- 0
abl/learning/abl_model.py View File

@@ -101,6 +101,20 @@ class ABLModel:
data_X, _ = self.merge_data(X)
data_Y, _ = self.merge_data(Y)
return self.classifier_list[0].fit(X=data_X, y=data_Y)
def save(self, *args, **kwargs) -> None:
_model = self.classifier_list[0]
if hasattr(_model, "save"):
self._model.save(*args, **kwargs)
else:
raise NotImplementedError(f"{type(_model).__name__} object dosen't have the save method")
def load(self, *args, **kwargs):
_model = self.classifier_list[0]
if hasattr(_model, "load"):
_model.load(*args, **kwargs)
else:
raise NotImplementedError(f"{type(_model).__name__} object dosen't have the load method")

@staticmethod
def merge_data(X):


Loading…
Cancel
Save