Skip to content

Expose some private attrs in cuml.accel#7197

Merged
rapids-bot[bot] merged 2 commits intorapidsai:branch-25.10from
jcrist:expose-some-private-attrs-cuml-accel
Sep 9, 2025
Merged

Expose some private attrs in cuml.accel#7197
rapids-bot[bot] merged 2 commits intorapidsai:branch-25.10from
jcrist:expose-some-private-attrs-cuml-accel

Conversation

@jcrist
Copy link
Copy Markdown
Member

@jcrist jcrist commented Sep 8, 2025

Previously we never exposed private attributes in cuml.accel's proxy implementation. In most cases this is the correct choice, however some estimators have private attributes that downstream consumers may still use.

Previously we exposed those as a one-off way. We now add a builtin mechanism, and expand support a bit. In particular, the neighbors classifiers now expose the _tree attribute (it's always None, but that should be supported by consumers).

This was motivated by getting cuml.accel to work with PyOD.

Fixes #6530.

Previously we never exposed private attributes in `cuml.accel`'s proxy
implementation. In most cases this is the correct choice, however some
estimators have private attributes that downstream consumers may still
use.

Previously we exposed those as a one-off way. We now add a builtin
mechanism, and expand support a bit. In particular, the `neighbors`
classifiers now expose the `_tree` attribute (it's always `None`, but
that should be supported by consumers).

This was motivated by getting `cuml.accel` to work with `PyOD`.
@jcrist jcrist self-assigned this Sep 8, 2025
@jcrist jcrist added the Cython / Python Cython or Python issue label Sep 8, 2025
@jcrist jcrist requested a review from a team as a code owner September 8, 2025 21:55
@jcrist jcrist added the improvement Improvement / enhancement to an existing function label Sep 8, 2025
@jcrist jcrist requested a review from dantegd September 8, 2025 21:55
@jcrist jcrist added non-breaking Non-breaking change cuml-accel Issues related to cuml.accel labels Sep 8, 2025
This line wasn't harming anything, but is also no longer needed.

class TSNE(ProxyBase):
_gpu_class = cuml.manifold.TSNE
_not_implemented_attributes = frozenset(("n_iter_",))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't related to this PR, but was something I just noticed in passing. We added support for n_iter_ in #7142, but forget to remove this line.

Since the check is only hit on an AttributeError, having this here wasn't harming anything, but it's also not needed. Removing it in this PR to avoid pushing another 1-line PR.

@jcrist
Copy link
Copy Markdown
Member Author

jcrist commented Sep 8, 2025

With this PR I can confirm that the example in #6530 runs successfully under cuml.accel.

@jcrist
Copy link
Copy Markdown
Member Author

jcrist commented Sep 9, 2025

/merge

@rapids-bot rapids-bot Bot merged commit 42b75b7 into rapidsai:branch-25.10 Sep 9, 2025
101 checks passed
@jcrist jcrist deleted the expose-some-private-attrs-cuml-accel branch September 9, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuml-accel Issues related to cuml.accel Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] AttributeError when using cuml.accel with PyOD KNN

3 participants