Skip to content

Commit

Permalink
attribute redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
jrzkaminski committed Jul 8, 2024
1 parent 6768931 commit 24ca65d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bamt/core/node_models/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ def predict_proba(self, X: np.ndarray) -> np.ndarray:

def __str__(self):
return str(self._classifier)

def __getattr__(self, name: str):
if self._classifier:
return getattr(self._classifier, name)
raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{name}'"
)
7 changes: 7 additions & 0 deletions bamt/core/node_models/regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ def predict_proba(self, X: np.ndarray) -> np.ndarray:

def __str__(self):
return str(self._regressor)

def __getattr__(self, name: str):
if self._regressor:
return getattr(self._regressor, name)
raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute '{name}'"
)

0 comments on commit 24ca65d

Please sign in to comment.