Skip to content

Commit

Permalink
Replaced 'numpy.zeros()' function calls with 'numpy.full()' function …
Browse files Browse the repository at this point in the history
…calls
  • Loading branch information
vruusmann committed Dec 4, 2023
1 parent e5ec2ac commit 4537b89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sklearn2pmml/ensemble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def _eval_step_mask(self, X, predicate):

def fit(self, X, y, **fit_params):
X_eval = self._to_evaluation_dataset(X)
mask = numpy.zeros(X.shape[0], dtype = bool)
mask = numpy.full(X.shape[0], fill_value = False)
for name, estimator, predicate in self.steps:
step_mask = self._eval_step_mask(X_eval, predicate)
step_mask[mask] = False
Expand All @@ -358,7 +358,7 @@ def fit(self, X, y, **fit_params):
def _predict(self, X, predict_method):
result = None
X_eval = self._to_evaluation_dataset(X)
mask = numpy.zeros(X.shape[0], dtype = bool)
mask = numpy.full(X.shape[0], fill_value = False)
for name, estimator, predicate in self.steps:
step_mask = self._eval_step_mask(X_eval, predicate)
step_mask[mask] = False
Expand Down
4 changes: 2 additions & 2 deletions sklearn2pmml/preprocessing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def _eval_step_mask(self, X, predicate):

def fit(self, X, y = None):
X_eval = self._to_evaluation_dataset(X)
mask = numpy.zeros(X.shape[0], dtype = bool)
mask = numpy.full(X.shape[0], fill_value = False)
for name, transformer, predicate in self.steps:
step_mask = numpy.logical_not(mask)
step_mask_eval = self._eval_step_mask(X_eval[step_mask], predicate)
Expand All @@ -673,7 +673,7 @@ def fit(self, X, y = None):
def transform(self, X):
result = None
X_eval = self._to_evaluation_dataset(X)
mask = numpy.zeros(X.shape[0], dtype = bool)
mask = numpy.full(X.shape[0], fill_value = False)
for name, transformer, predicate in self.steps:
step_mask = numpy.logical_not(mask)
step_mask_eval = self._eval_step_mask(X_eval[step_mask], predicate)
Expand Down

0 comments on commit 4537b89

Please sign in to comment.