Skip to content

Commit

Permalink
Cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Dec 5, 2023
1 parent d2f7a28 commit af6d6c0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sklearn2pmml/cross_reference/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion sklearn2pmml/decoration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions sklearn2pmml/ensemble/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion sklearn2pmml/feature_selection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit af6d6c0

Please sign in to comment.