Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 14 additions & 8 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ files:
output: none
includes:
# "devcontainers" includes everything in "all", excluding test_python_xgboost
# The libxgboost package depends on librmm but we do not want to have a
# package depending on librmm in devcontainers since it should be built
# from source.
- common_build
- cuda
- cuda_version
Expand Down Expand Up @@ -715,17 +718,20 @@ dependencies:
packages:
- dask-ml>=2024
test_python_xgboost:
common:
- output_types: [conda]
packages:
# We must separate xgboost into its own list so that it is not
# included in the "devcontainers" key. The libxgboost package depends
# on librmm but we do not want to have a package depending on librmm
# in devcontainers since it should be built from source.
- rapids-xgboost==26.8.*,>=0.0.0a0
specific:
- output_types: [conda]
matrices:
- matrix:
py: "3.11"
packages: []
- matrix:
packages:
- rapids-xgboost==26.8.*,>=0.0.0a0
- output_types: [requirements, pyproject]
matrices:
- matrix:
py: "3.11"
packages: []
- matrix:
cuda: "12.*"
cuda_suffixed: "true"
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/cluster/agglomerative.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ class AgglomerativeClustering(ClusterMixin, CMajorInputTagMixin, Base):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/cluster/dbscan.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ class DBSCAN(InteropMixin,
Note: this option does not set the maximum total memory used in the
DBSCAN computation and so this value will not be able to be set to
the total memory available on the device.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/cluster/hdbscan/hdbscan.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,7 @@ class HDBSCAN(InteropMixin, ClusterMixin, CMajorInputTagMixin, Base):
utilizing plotting tools. This requires the `hdbscan` CPU Python
package to be installed.

output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/cluster/kmeans.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ class KMeans(InteropMixin,
batched pairwise distance computation is :py:`max_samples_per_batch *
n_clusters`. It might become necessary to lower this number when
`n_clusters` becomes prohibitively large.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/cluster/spectral_clustering.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ class SpectralClustering(InteropMixin,
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used.
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/covariance/empirical_covariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class EmpiricalCovariance(InteropMixin, Base):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/covariance/ledoit_wolf.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ class LedoitWolf(InteropMixin, Base):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
5 changes: 2 additions & 3 deletions python/cuml/cuml/dask/cluster/dbscan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#

Expand Down Expand Up @@ -45,8 +45,7 @@ class DBSCAN(BaseEstimator, DelayedPredictionMixin, DelayedTransformMixin):
Note: this option does not set the maximum total memory used in the
DBSCAN computation and so this value will not be able to be set to
the total memory available on the device.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
5 changes: 2 additions & 3 deletions python/cuml/cuml/dask/linear_model/elastic_net.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#

Expand Down Expand Up @@ -46,8 +46,7 @@ class ElasticNet(BaseEstimator):
rather than looping over features sequentially by default.
This (setting to 'random') often leads to significantly faster
convergence especially when tol is higher than 1e-4.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
5 changes: 2 additions & 3 deletions python/cuml/cuml/dask/linear_model/logistic_regression.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#

Expand Down Expand Up @@ -93,8 +93,7 @@ class LogisticRegression(LinearRegression):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/decomposition/incremental_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ class IncrementalPCA(PCA):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/decomposition/pca.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ class PCA(InteropMixin,
Whitening allows each component to have unit variance and removes
multi-collinearity. It might be beneficial for downstream
tasks like LinearRegression where correlated features cause problems.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/decomposition/tsvd.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ class TruncatedSVD(InteropMixin,
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
5 changes: 2 additions & 3 deletions python/cuml/cuml/ensemble/randomforestclassifier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
import cupy as cp
import numpy as np
Expand Down Expand Up @@ -125,8 +125,7 @@ class RandomForestClassifier(ClassifierMixin, BaseRandomForestModel):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
5 changes: 2 additions & 3 deletions python/cuml/cuml/ensemble/randomforestregressor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
import cuml.internals.nvtx as nvtx
from cuml.common.doc_utils import generate_docstring, insert_into_docstring
Expand Down Expand Up @@ -117,8 +117,7 @@ class RandomForestRegressor(RegressorMixin, BaseRandomForestModel):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/feature_extraction/_tfidf.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ class TfidfTransformer(Base):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
28 changes: 25 additions & 3 deletions python/cuml/cuml/internals/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import re
import threading
import warnings

import pylibraft.common.handle

Expand All @@ -15,7 +16,10 @@
import cuml.internals.logger as logger
import cuml.internals.nvtx as nvtx
from cuml.internals.mixins import TagsMixin, _ensure_transformer_tags
from cuml.internals.outputs import infer_output_type
from cuml.internals.outputs import (
infer_output_type,
warn_if_output_type_deprecated,
)

_THREAD_STATE = threading.local()

Expand Down Expand Up @@ -51,6 +55,14 @@ def get_handle(*, n_streams=0, device_ids=None):
return pylibraft.common.handle.Handle(n_streams=n_streams)


class _DeprecatedOutputTypeDescriptor:
"""A descriptor to warn when a deprecated `output_type` is configured."""

def __set__(self, obj, value):
warn_if_output_type_deprecated(value)
obj.__dict__["output_type"] = value


class Base(TagsMixin):
"""Base class for cuml estimators.

Expand All @@ -73,8 +85,7 @@ class Base(TagsMixin):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down Expand Up @@ -114,6 +125,8 @@ def predict(self, X):
return cp.ones(len(X), dtype="int32")
"""

output_type = _DeprecatedOutputTypeDescriptor()

def __init__(
self,
*,
Expand Down Expand Up @@ -240,6 +253,15 @@ class output type and global output type.
else:
# Determine the output from the input
output_type = infer_output_type(inp)
if output_type == "numba":
warnings.warn(
"Outputting `numba` arrays was deprecated "
"in version 26.08 and will be removed "
"in version 26.10. In the future this call will return a "
"`cupy` array instead. You may silence this warning by "
"explicitly setting `output_type='cupy'` now.",
FutureWarning,
)

return output_type

Expand Down
29 changes: 29 additions & 0 deletions python/cuml/cuml/internals/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import contextlib
import functools
import inspect
import warnings

import cudf
import cupy as cp
Expand Down Expand Up @@ -55,6 +56,33 @@ def check_output_type(output_type: str) -> str:
return output_type


def warn_if_output_type_deprecated(output_type: str):
"""Warn if the specified `output_type` is deprecated"""
if isinstance(output_type, str) and output_type in (
"numba",
"array",
"df_obj",
"dataframe",
"series",
):
alt = "cupy" if output_type in ("numba", "array") else "cudf"
if output_type in ("dataframe", "series"):
suffix = (
" Note that `output_type='cudf'` will return `cudf.Series` "
"objects for 1-dimensional outputs and `cudf.DataFrame` "
"objects for 2-dimensional outputs. You may need to "
"update consumers as necessary."
)
else:
suffix = ""
warnings.warn(
f"`output_type={output_type!r}` was deprecated in version 26.08 "
"and will be removed in version 26.10. Please use "
f"`output_type={alt!r}` instead.{suffix}",
FutureWarning,
)
Comment thread
jcrist marked this conversation as resolved.
Comment thread
jcrist marked this conversation as resolved.


def set_global_output_type(output_type):
"""Set the global output type.

Expand Down Expand Up @@ -132,6 +160,7 @@ def set_global_output_type(output_type):
"""
if output_type is not None:
output_type = check_output_type(output_type)
warn_if_output_type_deprecated(output_type)
GlobalSettings().output_type = output_type


Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/kernel_ridge/kernel_ridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ class KernelRidge(InteropMixin, RegressorMixin, Base):
kernel_params : mapping of str to any, default=None
Additional parameters (keyword arguments) for kernel function passed
as callable object.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
5 changes: 2 additions & 3 deletions python/cuml/cuml/linear_model/elastic_net.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
import cupy as cp
Expand Down Expand Up @@ -69,8 +69,7 @@ class ElasticNet(
features sequentially by default. This (setting to 'random') often
leads to significantly faster convergence especially when tol is higher
than 1e-4.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
3 changes: 1 addition & 2 deletions python/cuml/cuml/linear_model/lars.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ class Lars(RegressorMixin, Base):
verbose : int or boolean, default=False
Sets logging level. It must be one of `cuml.common.logger.level_*`.
See :ref:`verbosity-levels` for more info.
output_type : {'input', 'array', 'dataframe', 'series', 'df_obj', \
'numba', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
output_type : {None, 'input', 'cupy', 'numpy', 'cudf', 'pandas'}, default=None
Return results and set estimator attributes to the indicated output
type. If None, the output type set at the module level
(`cuml.global_settings.output_type`) will be used. See
Expand Down
Loading
Loading