cuML - RAPIDS ML Algorithms

repository·main·Indexed 26 days ago

https://github.com/rapidsai/cuml

A suite of GPU-accelerated machine learning libraries providing high-performance implementations of traditional ML algorithms with APIs compatible with scikit-learn and RAPIDS projects. Includes the libcuml C++ library, Python bindings, and support for multi-node multi-GPU (MNMG) configurations. Features include ARIMA, KMeans, Linear Regression, Nearest Neighbors, and Random Forest, along with acceleration tests for upstream projects like scikit-learn, UMAP, and HDBSCAN.

Tokens
44.2K
Snippets
85
Records
261
Agent score
90%

What's inside cuML

  1. Overview of cuML GPU Machine Learning

    main
    cuML is a suite of libraries that implements machine learning algorithms and mathematical primitive functions on GPUs. It provides a Python API that is largely compatible with scikit-learn, allowing users to run traditional tabular ML tasks on GPUs without writing CUDA code. For large datasets, cuML can be 10-50x faster than CPU-based implementations. It also supports multi-GPU and multi-node-multi-GPU operations via Dask.
  2. Overview of cuML features

    main

    cuML is a suite of GPU-accelerated machine learning algorithms that mirrors the scikit-learn API.

    Key Capabilities:

    • Scikit-learn Compatibility: Provides a drop-in replacement for most sklearn algorithms using the fit-predict-transform paradigm.
    • Zero Code Change Acceleration: Use cuml.accel to automatically accelerate existing code.
    • Flexible Input Support: Works with NumPy, cuDF, cuPy, and PyTorch tensors.
    • Scalability: Supports multi-GPU and multi-node scaling via Dask.
    • Algorithm Coverage: Over 50 algorithms across clustering, regression, classification, dimensionality reduction, and time series analysis.
  3. Use clustering algorithms in cuml.cluster

    main

    The cuml.cluster module provides GPU-accelerated implementations of various clustering algorithms. You can use these to group data points based on similarity. Supported algorithms include:

    • KMeans: Standard K-means clustering.
    • DBSCAN: Density-Based Spatial Clustering of Applications with Noise.
    • AgglomerativeClustering: Hierarchical clustering using agglomerative methods.
    • SpectralClustering: Clustering based on the eigenvalues of the similarity matrix.
    • HDBSCAN: Hierarchical Density-Based Spatial Clustering of Applications with Noise (available via hdbscan.HDBSCAN).
  4. Use cuml.compose for feature transformations

    main

    The cuml.compose module provides tools for composing transformations on different subsets of columns in a dataset, similar to scikit-learn's composition utilities. It allows you to apply specific transformers to specific columns (or groups of columns) within a single pipeline step.

    Key components include:

    • ColumnTransformer: A class to apply different transformers to different columns.
    • make_column_transformer: A convenience function to create a ColumnTransformer.
    • make_column_selector: A utility to select columns based on data type or name patterns.
  5. Use cuML neighbors module for GPU-accelerated proximity tasks

    main

    The cuml.neighbors module provides GPU-accelerated implementations of common neighbor-based algorithms. It is designed to be compatible with the Scikit-learn API, allowing for efficient nearest neighbor searches, classification, and regression on CUDA devices.

    Key algorithms available in this module include:

    • NearestNeighbors: Unsupervised nearest neighbor search.
    • KNeighborsClassifier: K-Nearest Neighbors classification.
    • KNeighborsRegressor: K-Nearest Neighbors regression.
    • KernelDensity: Kernel Density Estimation (KDE).
  6. Use dimensionality reduction algorithms in cuml.decomposition

    main

    The cuml.decomposition module provides GPU-accelerated implementations of dimensionality reduction algorithms. These algorithms are designed to work with RAPIDS cudf DataFrames or NumPy arrays, providing significant speedups over CPU-based implementations for large datasets.

    Supported algorithms include:

    • PCA: Principal Component Analysis.
    • IncrementalPCA: Incremental Principal Component Analysis, useful for datasets that do not fit into GPU memory.
    • TruncatedSVD: Truncated Singular Value Decomposition, often used for sparse matrix decomposition.
  7. Access Time Series datasets for cuML models

    main

    The notebooks/data/time_series/ directory contains curated datasets specifically filtered and organized for demonstrating and testing cuML time series models.

    Note: These datasets are optimized for time series testing. For production or general-purpose use, it is recommended to source the data directly from the original providers.

  8. Use Naive Bayes algorithms in cuML

    main

    The cuml.naive_bayes module provides GPU-accelerated implementations of various Naive Bayes classifiers. These algorithms are designed to work with GPU-accelerated data structures and follow the Scikit-learn API pattern.

    Supported classifiers include:

    • BernoulliNB: Gaussian Naive Bayes for multivariate Bernoulli distributions.
    • CategoricalNB: Naive Bayes for categorical features.
    • ComplementNB: An adaptation of MultinomialNB for imbalanced datasets.
    • GaussianNB: Naive Bayes for continuous features assuming a Gaussian distribution.
    • MultinomialNB: Naive Bayes for discrete counts (e.g., word counts in text classification).
  9. Use manifold learning algorithms in cuML

    main

    The cuml.manifold module provides GPU-accelerated implementations of manifold learning algorithms, which are used for dimensionality reduction and uncovering the underlying structure of high-dimensional data.

    Supported algorithms include:

    • UMAP (Uniform Manifold Approximation and Projection)
    • TSNE (t-Distributed Stochastic Neighbor Embedding)
    • SpectralEmbedding
    • spectral_embedding (functional interface)
    • umap.fuzzy_simplicial_set
    • umap.simplicial_set_embedding
    • umap.find_ab_params
  10. Run upstream tests with bounded parallelism (CI-like)

    main

    When running GPU-backed tests, avoid using -n auto on large machines to prevent GPU memory exhaustion. Instead, use bounded xdist parallelism with a fixed number of workers and the worksteal distribution.

    scikit-learn tests example:

    ./scikit-learn/run-tests.sh \
        --numprocesses=8 \
        --dist=worksteal \
        --junitxml=report-sklearn.xml

    scikit-learn examples example:

    ./scikit-learn/run-examples.sh \
        -vv --durations=0 --durations-min=0 \
        -n 4 --dist worksteal \
        --junitxml=report-sklearn-examples.xml