mlverse/cuda.ml

formally check for CUDA and write a sensible error message

Closed this issue · 1 comments

Right now, a user without the proper external libraries would not get errors but would not get results either:

library(cuml4r)

# From ?cuml_Rand_forest

library(cuml4r)

# Classification

model <- cuml_rand_forest(
  iris,
  formula = Species ~ .,
  mode = "classification",
  trees = 100
)

predictions <- predict(model, iris)

str(model)
#> List of 5
#>  $ mode          : chr "classification"
#>  $ xptr          : list()
#>  $ formula       :Class 'formula'  language Species ~ .
#>   .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> 
#>  $ resp_var_cls  : chr "factor"
#>  $ resp_var_attrs:List of 2
#>   ..$ levels: chr [1:3] "setosa" "versicolor" "virginica"
#>   ..$ class : chr "factor"
#>  - attr(*, "class")= chr "cuml_rand_forest"
predictions
#> factor(0)
#> Levels: setosa versicolor virginica

Created on 2021-08-17 by the reprex package (v2.0.0)

They can't tell if this is a bug or anything else.

It looks like the package has a function for checking the installation.

Can you check on attaching the package if the proper frameworks are in order and, if they are not, write an error message that gives them directions on how to fix things?

Great suggestion!

This is addressed with the trivial change in #81.