forked from scikit-learn-contrib/scikit-learn-extra
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_common.py
More file actions
49 lines (42 loc) · 1.56 KB
/
Copy pathtest_common.py
File metadata and controls
49 lines (42 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pytest
from sklearn.utils import estimator_checks
from sklearn_extra.kernel_approximation import Fastfood
from sklearn_extra.kernel_methods import EigenProClassifier, EigenProRegressor
from sklearn_extra.cluster import KMedoids, CommonNNClustering, CLARA
from sklearn_extra.robust import (
RobustWeightedClassifier,
RobustWeightedRegressor,
RobustWeightedKMeans,
)
ALL_ESTIMATORS = [
Fastfood,
KMedoids,
CLARA,
EigenProClassifier,
EigenProRegressor,
CommonNNClustering,
RobustWeightedKMeans,
RobustWeightedRegressor,
RobustWeightedClassifier,
]
@estimator_checks.parametrize_with_checks([cls() for cls in ALL_ESTIMATORS])
def test_all_estimators(estimator, check, request):
# TODO: fix this common test failure cf #41
if isinstance(
estimator, EigenProClassifier
) and "function check_classifier_multioutput" in str(check):
request.applymarker(
pytest.mark.xfail(run=False, reason="See issue #41")
)
# TODO: fix this later, ask people at sklearn to advise on it.
if isinstance(estimator, RobustWeightedRegressor) and (
("function check_regressors_train" in str(check))
or ("function check_estimators_dtypes" in str(check))
):
request.applymarker(pytest.mark.xfail(run=False))
if isinstance(estimator, RobustWeightedClassifier) and (
("function check_classifiers_train" in str(check))
or ("function check_estimators_dtypes" in str(check))
):
request.applymarker(pytest.mark.xfail(run=False))
return check(estimator)