Skip to content

Commit

Permalink
updating comments and checking regressor interface
Browse files Browse the repository at this point in the history
  • Loading branch information
YibinSun committed Apr 19, 2024
1 parent db52871 commit 4e426a8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/capymoa/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
from typing import Optional

from jpype import _jpype
from moa.classifiers import Classifier as MOA_Classifier_Interface
from moa.classifiers import (
Classifier as MOA_Classifier_Interface,
Regressor as MOA_Regressor_Interface,
)
from moa.core import Utils

from capymoa.instance import Instance, LabeledInstance, RegressionInstance
Expand Down Expand Up @@ -55,12 +58,12 @@ def _extract_moa_learner_CLI(learner):
A string representing the CLI command for creating the MOA learner.
"""

# Check if the base_learner is a MOAClassifier
# Check if the base_learner is a MOAClassifie or a MOARegressor
if isinstance(learner, MOAClassifier) or isinstance(learner, MOARegressor):
learner = _get_moa_creation_CLI(learner.moa_learner)

# ... or a Classifier (Interface from MOA) type
if isinstance(learner, MOA_Classifier_Interface):
# ... or a Classifier or a Regressor (Interfaces from MOA) type
if isinstance(learner, MOA_Classifier_Interface) or isinstance(learner, MOA_Regressor_Interface):
learner = _get_moa_creation_CLI(learner)

# ... or a java object, which we presume is a MOA object (if it is not, MOA will raise the error)
Expand Down

0 comments on commit 4e426a8

Please sign in to comment.