This directory contains the R package for H2O4GPU. H2O4GPU is a collection of GPU solvers by H2Oai with APIs in Python and R. The Python API builds upon the easy-to-use scikit-learn API and its well-tested CPU-based algorithms. It can be used as a drop-in replacement for scikit-learn (i.e. import h2o4gpu as sklearn
) with support for GPUs on selected (and ever-growing) algorithms. H2O4GPU inherits all the existing scikit-learn algorithms and falls back to CPU algorithms when the GPU algorithm does not support an important existing scikit-learn class option. The R package is a wrapper around the H2O4GPU Python package, and the interface follows standard R conventions for modeling.
First, please follow the instruction here to build the H2O4GPU Python package.
Then install h2o4gpu
R package via the following:
if (!require(devtools)) install.packages("devtools")
devtools::install_github("h2oai/h2o4gpu", subdir = "src/interface_r")
To test your installation, try the following example that builds a simple XGBoost random forest classifier:
library(h2o4gpu)
# Setup dataset
x <- iris[1:4]
y <- as.integer(iris$Species) - 1
# Initialize and train the classifier
model <- h2o4gpu.random_forest_classifier() %>% fit(x, y)
# Make predictions
predictions <- model %>% predict(x)
For more examples, please visit the package vignettes.