From af6d6c0ca0e9e5be3f7f53532afc636b3d508a90 Mon Sep 17 00:00:00 2001 From: Villu Ruusmann Date: Tue, 5 Dec 2023 17:58:01 +0200 Subject: [PATCH] Cleaned up code --- sklearn2pmml/cross_reference/tests/__init__.py | 2 +- sklearn2pmml/decoration/__init__.py | 2 +- sklearn2pmml/ensemble/tests/__init__.py | 6 +++--- sklearn2pmml/feature_selection/__init__.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sklearn2pmml/cross_reference/tests/__init__.py b/sklearn2pmml/cross_reference/tests/__init__.py index ebba3d9..7599c1a 100644 --- a/sklearn2pmml/cross_reference/tests/__init__.py +++ b/sklearn2pmml/cross_reference/tests/__init__.py @@ -155,7 +155,7 @@ def test_make_recaller_union(self): "int": [-1, 1] } recaller_union = make_recaller_union(memory, ["int"]) - X = numpy.full((2, 1), 0, dtype = int) + X = numpy.full((2, 1), fill_value = 0) Xt = recaller_union.fit_transform(X) self.assertEqual((2, 2), Xt.shape) self.assertEqual([-1, 1], Xt[:, 0].tolist()) diff --git a/sklearn2pmml/decoration/__init__.py b/sklearn2pmml/decoration/__init__.py index 5474391..fb9e251 100644 --- a/sklearn2pmml/decoration/__init__.py +++ b/sklearn2pmml/decoration/__init__.py @@ -105,7 +105,7 @@ def is_missing(X, missing_value): return pandas.isnull(X) return X == missing_value if type(self.missing_values) is list: - mask = numpy.full(X.shape, False, dtype = bool) + mask = numpy.full(X.shape, fill_value = False) for missing_value in self.missing_values: mask = numpy.logical_or(mask, is_missing(X, missing_value)) return mask diff --git a/sklearn2pmml/ensemble/tests/__init__.py b/sklearn2pmml/ensemble/tests/__init__.py index aaa5e21..6646c21 100644 --- a/sklearn2pmml/ensemble/tests/__init__.py +++ b/sklearn2pmml/ensemble/tests/__init__.py @@ -163,17 +163,17 @@ def test_mask_params(self): "second" : numpy.asarray([[False, "A"], [False, "B"], [True, "C"], [False, "D"], [True, "E"]], dtype = object), "any" : "any" } - mask = numpy.full((5, ), True) + mask = numpy.full((5, ), fill_value = True) masked_params = _mask_params(params, mask) self.assertTrue(params["first"].tolist(), masked_params["first"].tolist()) self.assertTrue(params["second"].tolist(), masked_params["second"].tolist()) self.assertTrue(params["any"], masked_params["any"]) - mask = numpy.asarray([False, True, False, False, True], dtype = bool) + mask = numpy.asarray([False, True, False, False, True]) masked_params = _mask_params(params, mask) self.assertEqual([[1], [0]], masked_params["first"].tolist()) self.assertEqual([[False, "B"], [True, "E"]], masked_params["second"].tolist()) self.assertEqual(params["any"], masked_params["any"]) - mask = numpy.full((5, ), False) + mask = numpy.full((5, ), fill_value = False) masked_params = _mask_params(params, mask) self.assertEqual([], masked_params["first"].tolist()) self.assertEqual([], masked_params["second"].tolist()) diff --git a/sklearn2pmml/feature_selection/__init__.py b/sklearn2pmml/feature_selection/__init__.py index 40a3144..a1aa24f 100644 --- a/sklearn2pmml/feature_selection/__init__.py +++ b/sklearn2pmml/feature_selection/__init__.py @@ -19,7 +19,7 @@ def _get_support_mask(self): def fit(self, X, y = None): rows, cols = X.shape - mask = numpy.full((cols), True, dtype = bool) + mask = numpy.full((cols), fill_value = True) if isinstance(X, DataFrame): X = X.values for left in range(cols):