Skip to content

Add LocalOutlierFactor to cuml.neighbors - #8554

Draft
JulienAu wants to merge 1 commit into
NVIDIA:mainfrom
JulienAu:fea-local-outlier-factor
Draft

Add LocalOutlierFactor to cuml.neighbors#8554
JulienAu wants to merge 1 commit into
NVIDIA:mainfrom
JulienAu:fea-local-outlier-factor

Conversation

@JulienAu

@JulienAu JulienAu commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Closes #8504.

Implements LocalOutlierFactor as Python post-processing on top of cuml.neighbors.NearestNeighbors, as discussed in the issue. Both sklearn modes are covered: outlier detection (fit_predict, negative_outlier_factor_, offset_ with contamination handling) and novelty detection (predict, decision_function, score_samples), with the same mode guards as sklearn.

Correctness: 18 tests against sklearn across dtypes, n_neighbors values, both modes, exact duplicates (the self-removal path handles the case where a sample does not come back first in its own neighbor list), contamination validation and pickling. All pass on GPU against the nightly wheel. From the issue prototype: 100k x 16 fits in 2.5 s against 27 s for sklearn with n_jobs=-1, on a GTX 1650 Ti.

Scoped to what the existing NearestNeighbors primitive supports; cuml.accel support is a follow-up per the issue discussion. One question for review: should InteropMixin land now or together with the accel follow-up?

LOF is computed as pure Python post-processing of the GPU neighbor
search from cuml.neighbors.NearestNeighbors: k-distance, reachability,
local reachability density, then the density ratio. Both sklearn modes
are supported, outlier detection and novelty detection, with the same
mode guards. Self-neighbor removal handles exact duplicates, where the
sample is not guaranteed to come back first in the tied block.

Signed-off-by: JulienAu <16043912+JulienAu@users.noreply.github.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cython / Python Cython or Python issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEA] LocalOutlierFactor

2 participants