Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
37d544a
Enhance DEVELOPER_GUIDE with testing best practices and guidelines
csadorf Apr 9, 2025
4f110a9
Add instructions for running tests in DEVELOPER_GUIDE.md
csadorf Apr 11, 2025
ebdb9e6
Add test parameter levels section to DEVELOPER_GUIDE.md
csadorf Apr 14, 2025
9a5789f
Update TODO comment date in test_logreg_penalty_deprecation function
csadorf Apr 14, 2025
0db0e1a
Improve consistency in use of pytest.mark.parametrize and hypothesis.
csadorf Apr 14, 2025
a539277
Remove obsolete algorithms hypothesis strategy.
csadorf Apr 16, 2025
562e855
Rename dataset compatibility functions for clarity
csadorf Apr 23, 2025
147a49e
Refactor floating dtypes strategy in testing module
csadorf Apr 23, 2025
f0a6b9b
Drop stress_param from test_linear_model.py.
csadorf Apr 30, 2025
86a5d75
Drop unit_param and quality_param from test_linear_model.py
csadorf Apr 30, 2025
0ac1318
Do not prefer exhaustive parameterization.
csadorf Apr 30, 2025
7d89d15
Increase acceptance tolerance for test_elasticnet_model test.
csadorf Apr 30, 2025
8f54cfb
Use hypothesis for most parametrization in test_linear_module.py.
csadorf Apr 30, 2025
4f22010
fixup! Use hypothesis for most parametrization in test_linear_module.py.
csadorf Apr 30, 2025
01711d8
Clarify documentation on dataset size parametrization.
csadorf Apr 30, 2025
a82178c
Use dataset_dtypes strategy consistently.
csadorf Apr 30, 2025
d2cd432
Merge branch 'branch-25.06' into tests/improve-test-docs-and-linear-m…
csadorf May 5, 2025
362f8ed
Merge branch 'branch-25.06' into tests/improve-test-docs-and-linear-m…
csadorf May 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/cuml/cuml/testing/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
)


def sklearn_compatible_dataset(X_train, X_test, y_train, _=None):
def is_sklearn_compatible_dataset(X_train, X_test, y_train, _=None):
"""Check if a dataset is compatible with scikit-learn's requirements.

Parameters
Expand Down Expand Up @@ -65,7 +65,7 @@ def sklearn_compatible_dataset(X_train, X_test, y_train, _=None):
)


def cuml_compatible_dataset(X_train, X_test, y_train, _=None):
def is_cuml_compatible_dataset(X_train, X_test, y_train, _=None):
"""Check if a dataset is compatible with cuML's requirements.

Parameters
Expand Down Expand Up @@ -308,8 +308,8 @@ def with_dtype(data, dtype):

__all__ = [
# Dataset compatibility
"sklearn_compatible_dataset",
"cuml_compatible_dataset",
"is_sklearn_compatible_dataset",
"is_cuml_compatible_dataset",
# Dataset generation
"make_classification",
"make_classification_dataset",
Expand Down
34 changes: 24 additions & 10 deletions python/cuml/cuml/testing/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@
import cupy as cp
import numpy as np
from hypothesis import assume
from hypothesis.extra.numpy import (
array_shapes,
arrays,
floating_dtypes,
integer_dtypes,
)
from hypothesis.extra.numpy import array_shapes, arrays
from hypothesis.extra.numpy import floating_dtypes as np_floating_dtypes
from hypothesis.extra.numpy import integer_dtypes
from hypothesis.strategies import (
composite,
integers,
Expand Down Expand Up @@ -78,6 +75,23 @@
]


@composite
def dataset_dtypes(draw, sizes=(32, 64)):
"""Generate floating point dtypes supported by cuML for datasets.

This strategy generates only little-endian float32 and float64 dtypes,
which are the floating point types supported by cuML for datasets.

Args:
sizes: A tuple of bit sizes to generate dtypes for. Defaults to
(32, 64) to generate float32 and float64 dtypes.

Returns:
A strategy that generates numpy dtypes.
"""
return draw(np_floating_dtypes(sizes=sizes, endianness="<"))


@composite
def cuml_array_input_types(draw):
"""Generates all supported cuml array input types."""
Expand Down Expand Up @@ -329,7 +343,7 @@ def _get_limits(strategy):
@composite
def standard_datasets(
draw,
dtypes=floating_dtypes(),
dtypes=dataset_dtypes(),
n_samples=integers(min_value=0, max_value=200),
n_features=integers(min_value=0, max_value=200),
*,
Expand Down Expand Up @@ -393,7 +407,7 @@ def combined_datasets_strategy(*datasets, name=None, doc=None):
@composite
def strategy(
draw,
dtypes=floating_dtypes(),
dtypes=dataset_dtypes(),
n_samples=integers(min_value=1, max_value=200),
n_features=integers(min_value=1, max_value=200),
):
Expand Down Expand Up @@ -467,7 +481,7 @@ def split_datasets(
@composite
def standard_regression_datasets(
draw,
dtypes=floating_dtypes(),
dtypes=dataset_dtypes(),
n_samples=integers(min_value=100, max_value=200),
n_features=integers(min_value=100, max_value=200),
*,
Expand Down Expand Up @@ -562,7 +576,7 @@ def standard_regression_datasets(
@composite
def standard_classification_datasets(
draw,
dtypes=floating_dtypes(),
dtypes=dataset_dtypes(),
n_samples=integers(min_value=100, max_value=200),
n_features=integers(min_value=10, max_value=20),
*,
Expand Down
Loading