Skip to content

Commit

Permalink
Renamed '_BaseEnsemble.recaller' attribute to 'controller'
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Sep 20, 2023
1 parent a231304 commit ea17da5
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions sklearn2pmml/ensemble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def predict_proba(self, X, **predict_proba_params):

class _BaseEnsemble(_BaseComposition):

def __init__(self, steps, recaller):
def __init__(self, steps, controller):
for step in steps:
if type(step) is not tuple:
raise TypeError("Step is not a tuple")
Expand All @@ -191,7 +191,10 @@ def __init__(self, steps, recaller):
if not isinstance(predicate, (str, Predicate)):
raise TypeError()
self.steps = steps
self.recaller = recaller
if controller:
if not hasattr(controller, "transform"):
raise TypeError()
self.controller = controller

@property
def _steps(self):
Expand All @@ -209,8 +212,8 @@ def set_params(self, **kwargs):
return self

def _to_evaluation_dataset(self, X):
if self.recaller is not None:
return self.recaller.transform(X)
if self.controller is not None:
return self.controller.transform(X)
return X

def _to_sparse(X, step_mask, step_result):
Expand Down Expand Up @@ -262,8 +265,8 @@ def augment(self, X):

class EstimatorChain(_BaseEnsemble):

def __init__(self, steps, recaller = None, multioutput = True):
super(EstimatorChain, self).__init__(steps, recaller)
def __init__(self, steps, controller = None, multioutput = True):
super(EstimatorChain, self).__init__(steps, controller)
self.multioutput = multioutput

def fit(self, X, y, **fit_params):
Expand Down Expand Up @@ -324,8 +327,8 @@ def predict_proba(self, X):

class SelectFirstEstimator(_BaseEnsemble):

def __init__(self, steps, recaller):
super(SelectFirstEstimator, self).__init__(steps, recaller)
def __init__(self, steps, controller):
super(SelectFirstEstimator, self).__init__(steps, controller)

def fit(self, X, y, **fit_params):
X_eval = self._to_evaluation_dataset(X)
Expand Down Expand Up @@ -369,13 +372,13 @@ def predict(self, X):

class SelectFirstRegressor(SelectFirstEstimator, RegressorMixin):

def __init__(self, steps, recaller = None):
super(SelectFirstRegressor, self).__init__(steps, recaller)
def __init__(self, steps, controller = None):
super(SelectFirstRegressor, self).__init__(steps, controller)

class SelectFirstClassifier(SelectFirstEstimator, ClassifierMixin):

def __init__(self, steps, recaller = None):
super(SelectFirstClassifier, self).__init__(steps, recaller)
def __init__(self, steps, controller = None):
super(SelectFirstClassifier, self).__init__(steps, controller)

def predict_proba(self, X):
return self._predict(X, "predict_proba")

0 comments on commit ea17da5

Please sign in to comment.