Skip to content

[MRG] make check_preprocessor private #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions metric_learn/base_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def score_pairs(self, pairs):
learner is.
"""

def check_preprocessor(self):
def _check_preprocessor(self):
"""Initializes the preprocessor"""
if _is_arraylike(self.preprocessor):
self.preprocessor_ = ArrayIndexer(self.preprocessor)
Expand Down Expand Up @@ -92,7 +92,7 @@ def _prepare_inputs(self, X, y=None, type_of_inputs='classic',
y: `numpy.ndarray` (optional)
The checked input labels array.
"""
self.check_preprocessor()
self._check_preprocessor()
return check_input(X, y,
type_of_inputs=type_of_inputs,
preprocessor=self.preprocessor_,
Expand Down
4 changes: 2 additions & 2 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ class MockMetricLearner(MahalanobisMixin):

mock_algo = MockMetricLearner(preprocessor=preprocessor)
with pytest.raises(ValueError) as e:
mock_algo.check_preprocessor()
mock_algo._check_preprocessor()
assert str(e.value) == ("Invalid type for the preprocessor: {}. You should "
"provide either None, an array-like object, "
"or a callable.".format(type(preprocessor)))
Expand Down Expand Up @@ -812,7 +812,7 @@ def test_error_message_t_score_pairs(estimator, _):
"""
estimator = clone(estimator)
set_random_state(estimator)
estimator.check_preprocessor()
estimator._check_preprocessor()
triplets = np.array([[[1.3, 6.3], [3., 6.8], [6.5, 4.4]],
[[1.9, 5.3], [1., 7.8], [3.2, 1.2]]])
with pytest.raises(ValueError) as raised_err:
Expand Down