Skip to content

Commit

Permalink
FIX fix hypothesis logistic regression tests for Scipy 1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
dantegd committed Jan 9, 2025
1 parent 51e1ec4 commit d0f5823
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
13 changes: 12 additions & 1 deletion python/cuml/cuml/tests/test_arima.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
from cuml.internals.safe_imports import gpu_only_import
import statsmodels.api as sm
from sklearn.model_selection import train_test_split
from cuml.internals.safe_imports import cpu_only_import_from
from cuml.internals.safe_imports import (
cpu_only_import_from,
gpu_only_import_from,
)
import warnings
import os
import pytest
Expand All @@ -49,6 +52,7 @@
approx_fprime = cpu_only_import_from("scipy.optimize", "approx_fprime")

cudf = gpu_only_import("cudf")
cudf_pandas_active = gpu_only_import_from("cudf.pandas", "LOADED")


###############################################################################
Expand Down Expand Up @@ -410,6 +414,13 @@ def fill_interpolation(df_in):
@pytest.mark.parametrize("dtype", [np.float64])
def test_integration(key, data, dtype):
"""Full integration test: estimate, fit, forecast"""
if (
data.dataset == "endog_hourly_earnings_by_industry_missing_exog"
and cudf_pandas_active
):
pytest.skip(
reason="https://github.com/rapidsai/cuml/issues/6209"
)
order, seasonal_order, intercept = extract_order(key)
s = max(1, seasonal_order[3])

Expand Down
10 changes: 5 additions & 5 deletions python/cuml/cuml/tests/test_linear_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
# Copyright (c) 2019-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -629,7 +629,7 @@ def test_logistic_regression_model_default(dtype):


@given(
dtype=floating_dtypes(sizes=(32, 64)),
dtype=st.sampled_from((np.float32, np.float64)),
order=st.sampled_from(("C", "F")),
sparse_input=st.booleans(),
fit_intercept=st.booleans(),
Expand Down Expand Up @@ -661,7 +661,7 @@ def test_logistic_regression_model_digits(
assert score >= acceptable_score


@given(dtype=floating_dtypes(sizes=(32, 64)))
@given(dtype=st.sampled_from((np.float32, np.float64)))
def test_logistic_regression_sparse_only(dtype, nlp_20news):

# sklearn score with max_iter = 10000
Expand All @@ -685,7 +685,7 @@ def test_logistic_regression_sparse_only(dtype, nlp_20news):
@given(
dataset=split_datasets(
standard_classification_datasets(
dtypes=floating_dtypes(sizes=(32, 64)),
dtypes=st.sampled_from((np.float32, np.float64)),
n_classes=st.sampled_from((2, 10)),
n_features=st.just(20),
n_informative=st.just(10),
Expand Down Expand Up @@ -727,7 +727,7 @@ def test_logistic_regression_decision_function(
@given(
dataset=split_datasets(
standard_classification_datasets(
dtypes=floating_dtypes(sizes=(32, 64)),
dtypes=st.sampled_from((np.float32, np.float64)),
n_classes=st.sampled_from((2, 10)),
n_features=st.just(20),
n_informative=st.just(10),
Expand Down

0 comments on commit d0f5823

Please sign in to comment.