@@ -146,6 +146,17 @@ def _run_test(estimator, method, datasets):
146146)
147147
148148
149+ def _skip_neighbors (estimator , method ):
150+ if (
151+ not _IS_INTEL
152+ and ("Neighbors" in estimator or "LocalOutlierFactor" in estimator )
153+ and method in ["score" , "predict" , "kneighbors" , "kneighbors_graph" ]
154+ ):
155+ if daal_check_version ((2025 , "P" , 200 )):
156+ pytest .fail ("Re-verify failure of algorithms in oneDAL 2025.2" )
157+ pytest .skip (f"{ estimator } shows instability on non-Intel(R) hardware" )
158+
159+
149160@pytest .mark .parametrize ("dataframe, queue" , get_dataframes_and_queues ("numpy,array_api" ))
150161@pytest .mark .parametrize ("estimator, method" , gen_models_info (PATCHED_MODELS ))
151162def test_standard_estimator_stability (estimator , method , dataframe , queue ):
@@ -155,14 +166,7 @@ def test_standard_estimator_stability(estimator, method, dataframe, queue):
155166 pytest .skip (f"variation observed in { estimator } .score" )
156167 if estimator in ["IncrementalEmpiricalCovariance" ] and method == "mahalanobis" :
157168 pytest .skip ("allowed fallback to sklearn occurs" )
158- if (
159- not _IS_INTEL
160- and ("Neighbors" in estimator or "LocalOutlierFactor" in estimator )
161- and method in ["score" , "predict" , "kneighbors" , "kneighbors_graph" ]
162- ):
163- if daal_check_version ((2025 , "P" , 200 )):
164- pytest .fail ("Re-verify failure of algorithms in 2025.2 oneDAL" )
165- pytest .skip (f"{ estimator } shows instability on Non-Intel hardware" )
169+ _skip_neighbors (estimator , method )
166170
167171 if "NearestNeighbors" in estimator and "radius" in method :
168172 pytest .skip (f"RadiusNeighbors estimator not implemented in sklearnex" )
@@ -191,14 +195,7 @@ def test_special_estimator_stability(estimator, method, dataframe, queue):
191195 pytest .skip (f"variation observed in KMeans.score" )
192196 if "NearestNeighbors" in estimator and "radius" in method :
193197 pytest .skip (f"RadiusNeighbors estimator not implemented in sklearnex" )
194- if (
195- not _IS_INTEL
196- and ("Neighbors" in estimator or "LocalOutlierFactor" in estimator )
197- and method in ["score" , "predict" , "kneighbors" , "kneighbors_graph" ]
198- ):
199- if daal_check_version ((2025 , "P" , 200 )):
200- pytest .fail ("Re-verify failure of algorithms in 2025.2 oneDAL" )
201- pytest .skip (f"{ estimator } shows instability on Non-Intel hardware" )
198+ _skip_neighbors (estimator , method )
202199
203200 est = SPECIAL_INSTANCES [estimator ]
204201
@@ -227,14 +224,7 @@ def test_sparse_estimator_stability(estimator, method, dataframe, queue):
227224 pytest .skip (f"variation observed in KMeans.{ method } in 2024.7 oneDAL" )
228225 if "NearestNeighbors" in estimator and "radius" in method :
229226 pytest .skip (f"RadiusNeighbors estimator not implemented in sklearnex" )
230- if (
231- not _IS_INTEL
232- and ("Neighbors" in estimator or "LocalOutlierFactor" in estimator )
233- and method in ["score" , "predict" , "kneighbors" , "kneighbors_graph" ]
234- ):
235- if daal_check_version ((2025 , "P" , 200 )):
236- pytest .fail ("Re-verify failure of algorithms in 2025.2 oneDAL" )
237- pytest .skip (f"{ estimator } shows instability on Non-Intel hardware" )
227+ _skip_neighbors (estimator , method )
238228
239229 est = SPARSE_INSTANCES [estimator ]
240230
@@ -259,14 +249,7 @@ def test_other_estimator_stability(estimator, method, dataframe, queue):
259249 pytest .skip (f"variation observed in KMeans.score" )
260250 if "NearestNeighbors" in estimator and "radius" in method :
261251 pytest .skip (f"RadiusNeighbors estimator not implemented in sklearnex" )
262- if (
263- not _IS_INTEL
264- and ("Neighbors" in estimator or "LocalOutlierFactor" in estimator )
265- and method in ["score" , "predict" , "kneighbors" , "kneighbors_graph" ]
266- ):
267- if daal_check_version ((2025 , "P" , 200 )):
268- pytest .fail ("Re-verify failure of algorithms in 2025.2 oneDAL" )
269- pytest .skip (f"{ estimator } shows instability on Non-Intel hardware" )
252+ _skip_neighbors (estimator , method )
270253
271254 est = STABILITY_INSTANCES [estimator ]
272255
0 commit comments