Skip to content

Commit

Permalink
MacOS OpenMP and input validation fixes (#1338)
Browse files Browse the repository at this point in the history
* Extend CI and Nightly timeout to 2h

* Update validation of function input

* Correct KMeans FutureWarning

* Deselect KMeans FutureWarning for 1.4.dev0 sklearn version

* Set SKLEARN_SKIP_OPENMP_TEST in macOS nightly
  • Loading branch information
Alexsandruss committed Jun 28, 2023
1 parent ef94204 commit 9eb6afe
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .ci/pipeline/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
displayName: 'PEP 8 check'
- job: Linux
timeoutInMinutes: 120
strategy:
matrix:
Python3.7_Sklearn1.0:
Expand All @@ -82,6 +83,7 @@ jobs:
steps:
- template: build-and-test-lnx.yml
- job: MacOS
timeoutInMinutes: 120
strategy:
matrix:
Python3.7_Sklearn1.0:
Expand All @@ -104,6 +106,7 @@ jobs:
steps:
- template: build-and-test-mac.yml
- job: Windows
timeoutInMinutes: 120
strategy:
matrix:
Python3.7_Sklearn1.0:
Expand Down
5 changes: 5 additions & 0 deletions .ci/pipeline/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
displayName: 'Run jupyter notebook demo'
- job: LinuxNightly
timeoutInMinutes: 120
strategy:
matrix:
Python3.10_SklearnMain:
Expand All @@ -92,16 +93,20 @@ jobs:
steps:
- template: build-and-test-lnx.yml
- job: MacOSNightly
timeoutInMinutes: 120
strategy:
matrix:
Python3.10_SklearnMain:
PYTHON_VERSION: '3.10'
SKLEARN_VERSION: 'main'
pool:
vmImage: 'macos-12'
variables:
SKLEARN_SKIP_OPENMP_TEST: 'true'
steps:
- template: build-and-test-mac.yml
- job: WindowsNightly
timeoutInMinutes: 120
strategy:
matrix:
Python3.10_SklearnMain:
Expand Down
2 changes: 1 addition & 1 deletion daal4py/sklearn/cluster/_k_means_0_23.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def is_string(s, target_str):

default_n_init = 10
if n_init in ['auto', 'warn']:
if n_init == "warn" and not sklearn_check_version('1.2'):
if n_init == "warn" and sklearn_check_version('1.2'):
warnings.warn(
"The default value of `n_init` will change from "
f"{default_n_init} to 'auto' in 1.4. Set the value of `n_init`"
Expand Down
4 changes: 3 additions & 1 deletion daal4py/sklearn/metrics/_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ def roc_auc_score(


if sklearn_check_version('1.3'):
validation_kwargs = {'prefer_skip_nested_validation': True} \
if sklearn_check_version('1.4') else {}
roc_auc_score = validate_params(
{
"y_true": ["array-like"],
Expand All @@ -192,5 +194,5 @@ def roc_auc_score(
"max_fpr": [Interval(Real, 0.0, 1, closed="right"), None],
"multi_class": [StrOptions({"raise", "ovr", "ovo"})],
"labels": ["array-like", None],
}
}, **validation_kwargs
)(roc_auc_score)
4 changes: 3 additions & 1 deletion daal4py/sklearn/model_selection/_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ def train_test_split(*arrays, **options):


if sklearn_check_version('1.3'):
validation_kwargs = {'prefer_skip_nested_validation': True} \
if sklearn_check_version('1.4') else {}
train_test_split = validate_params({
"test_size": [
Interval(RealNotInt, 0, 1, closed="neither"),
Expand All @@ -272,4 +274,4 @@ def train_test_split(*arrays, **options):
"random_state": ["random_state"],
"shuffle": ["boolean"],
"stratify": ["array-like", None],
})(train_test_split)
}, **validation_kwargs)(train_test_split)
3 changes: 3 additions & 0 deletions deselected_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
# will exclude deselection in versions 0.18.1, and 0.18.2 only.

deselected_tests:
# test for KMeans FutureWarning is not removed from sklearn tests suit yet
- cluster/tests/test_k_means.py::test_change_n_init_future_warning[KMeans-10] ==1.4.dev0

# Non-critical, but there are significant numerical differences in doctest results
- pipeline.py::sklearn.pipeline.FeatureUnion
- ensemble/_forest.py::sklearn.ensemble._forest.RandomForestRegressor
Expand Down

0 comments on commit 9eb6afe

Please sign in to comment.