Is your feature request related to a problem? Please describe.
cuML just gained IsolationForest, but LocalOutlierFactor, the other go to sklearn outlier detector, has no GPU counterpart and no cuml.accel proxy. In my anomaly detection benchmark I compare classical ML against deep methods that run on GPU, and LOF being CPU only skews every runtime comparison.
Describe the solution you'd like
A LocalOutlierFactor estimator in cuml.neighbors. The expensive part already exists: NearestNeighbors.kneighbors on GPU. Everything LOF adds is post processing of the (distances, indices) pair: k distance, reachability distance, local reachability density, then the ratio. I prototyped exactly that in a few lines of cupy on top of cuml.neighbors.NearestNeighbors: it matches sklearn's negative_outlier_factor_ to about 1e-6 (except a handful of points with tied neighbor distances, where any implementation picks different equidistant neighbors), and fits 100k x 16 in 2.5 s against 27 s for sklearn with n_jobs=-1, on a laptop GPU (GTX 1650 Ti). No new C++ or CUDA involved. A cuml.accel proxy can follow, the neighbors overrides already cover NearestNeighbors, KNeighborsClassifier, KNeighborsRegressor and KernelDensity.
Additional context
I would be happy to implement it: fit and fit_predict with negative_outlier_factor_ first, the novelty mode (score_samples on new data, same post processing on a kneighbors query) as a follow up. For completeness, OneClassSVM would be the other classic sklearn outlier detector, but the SVM solver only knows C_SVC, NU_SVC, EPSILON_SVR and NU_SVR, so that one needs new C++ work, while LOF needs none. Is this something the team would welcome?
Is your feature request related to a problem? Please describe.
cuML just gained IsolationForest, but LocalOutlierFactor, the other go to sklearn outlier detector, has no GPU counterpart and no cuml.accel proxy. In my anomaly detection benchmark I compare classical ML against deep methods that run on GPU, and LOF being CPU only skews every runtime comparison.
Describe the solution you'd like
A LocalOutlierFactor estimator in cuml.neighbors. The expensive part already exists: NearestNeighbors.kneighbors on GPU. Everything LOF adds is post processing of the (distances, indices) pair: k distance, reachability distance, local reachability density, then the ratio. I prototyped exactly that in a few lines of cupy on top of cuml.neighbors.NearestNeighbors: it matches sklearn's negative_outlier_factor_ to about 1e-6 (except a handful of points with tied neighbor distances, where any implementation picks different equidistant neighbors), and fits 100k x 16 in 2.5 s against 27 s for sklearn with n_jobs=-1, on a laptop GPU (GTX 1650 Ti). No new C++ or CUDA involved. A cuml.accel proxy can follow, the neighbors overrides already cover NearestNeighbors, KNeighborsClassifier, KNeighborsRegressor and KernelDensity.
Additional context
I would be happy to implement it: fit and fit_predict with negative_outlier_factor_ first, the novelty mode (score_samples on new data, same post processing on a kneighbors query) as a follow up. For completeness, OneClassSVM would be the other classic sklearn outlier detector, but the SVM solver only knows C_SVC, NU_SVC, EPSILON_SVR and NU_SVR, so that one needs new C++ work, while LOF needs none. Is this something the team would welcome?