From 4537b89da1bd570b4e3cd508543cae639dac6633 Mon Sep 17 00:00:00 2001 From: Villu Ruusmann Date: Mon, 4 Dec 2023 21:44:08 +0200 Subject: [PATCH] Replaced 'numpy.zeros()' function calls with 'numpy.full()' function calls --- sklearn2pmml/ensemble/__init__.py | 4 ++-- sklearn2pmml/preprocessing/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sklearn2pmml/ensemble/__init__.py b/sklearn2pmml/ensemble/__init__.py index 9472d09..6c073ea 100644 --- a/sklearn2pmml/ensemble/__init__.py +++ b/sklearn2pmml/ensemble/__init__.py @@ -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 @@ -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 diff --git a/sklearn2pmml/preprocessing/__init__.py b/sklearn2pmml/preprocessing/__init__.py index b7369cc..d2094e2 100644 --- a/sklearn2pmml/preprocessing/__init__.py +++ b/sklearn2pmml/preprocessing/__init__.py @@ -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) @@ -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)