Skip to content

Commit 737bcd3

Browse files
authored
Fix sklearn 1.0.1 tests (#836)
1 parent a1d1968 commit 737bcd3

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

daal4py/sklearn/neighbors/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def stock_fit(self, X, y):
415415
class KNeighborsMixin(BaseKNeighborsMixin):
416416
def kneighbors(self, X=None, n_neighbors=None, return_distance=True):
417417
daal_model = getattr(self, '_daal_model', None)
418-
if X is not None:
418+
if X is not None and self.metric != "precomputed":
419419
X = check_array(
420420
X, accept_sparse='csr', dtype=[
421421
np.float64, np.float32])

daal4py/sklearn/neighbors/_classification.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,6 @@ def predict(self, X):
169169

170170
@support_usm_ndarray()
171171
def predict_proba(self, X):
172+
if sklearn_check_version('1.0'):
173+
self._check_feature_names(X, reset=False)
172174
return BaseKNeighborsClassifier.predict_proba(self, X)

daal4py/sklearn/neighbors/_regression.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,6 @@ def fit(self, X, y):
9393

9494
@support_usm_ndarray()
9595
def predict(self, X):
96+
if sklearn_check_version('1.0'):
97+
self._check_feature_names(X, reset=False)
9698
return BaseKNeighborsRegressor.predict(self, X)

deselected_tests.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ deselected_tests:
128128
- tests/test_common.py::test_estimators[NuSVR()-check_sample_weights_invariance(kind=zeros)] <1.0
129129
- tests/test_common.py::test_estimators[NuSVC()-check_class_weight_classifiers] <1.0
130130
- tests/test_multioutput.py::test_multi_output_classification
131-
- tests/test_multioutput.py::test_classifier_chain_tuple_order >=0.24,<=1.0
131+
- tests/test_multioutput.py::test_classifier_chain_tuple_order >=0.24,<=1.1
132132

133133
# Different results sklearnex and sklearn linear regression with weights. Need to investigate.
134134
- inspection/tests/test_permutation_importance.py::test_permutation_importance_sample_weight >=1.0
135135

136136
# Patched and unpatched kmeans belong same values to different clusters. Need to investigate.
137-
- /preprocessing/tests/test_discretization.py::test_nonuniform_strategies[kmeans-expected_2bins1-expected_3bins1-expected_5bins1] >=1.0
137+
- preprocessing/tests/test_discretization.py::test_nonuniform_strategies[kmeans-expected_2bins1-expected_3bins1-expected_5bins1] >=1.0,<=1.1
138138

139139
# OOB scores in sklearn and oneDAL are different because of different random nuber generators
140140
- ensemble/tests/test_forest.py::test_forest_classifier_oob[X2-y2-0.65-array-RandomForestClassifier]
@@ -198,6 +198,8 @@ deselected_tests:
198198
# test checks that only exact number of options is used
199199
- tests/test_config.py::test_config_context
200200

201+
# HalvingGridSearchCV with Ridge and PCA didn't have feature_name_in. Need to fix.
202+
- tests/test_common.py::test_pandas_column_name_consistency >=1.0.1
201203
# --------------------------------------------------------
202204
# Not need of testing for daal4py patching
203205
reduced_tests:

0 commit comments

Comments
 (0)