HealthCatalyst / healthcareai-r

R tools for healthcare machine learning
https://docs.healthcare.ai
Other
245 stars 106 forks source link

Models do not store .libPaths versions of healthcareai #1280

Closed glenrs closed 5 years ago

glenrs commented 5 years ago

healthcareai currently stores the version of healthcareai with each model, but we use installed.packages() which references the main R library. If an alternate library is used to make models with .libPaths(), the wrong version will be stored with the model.

glenrs commented 5 years ago
library(caret, lib = "~/Desktop/sandbox/test_library/")
#> Loading required package: lattice
#> Loading required package: ggplot2
library(recipes, lib = "~/Desktop/sandbox/test_library/")
#> Loading required package: dplyr
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
#> Loading required package: broom
#> 
#> Attaching package: 'recipes'
#> The following object is masked from 'package:stats':
#> 
#>     step
library(healthcareai, lib = "~/Desktop/sandbox/test_library/")
#> healthcareai version 2.2.0
#> Please visit https://docs.healthcare.ai for full documentation and vignettes. Join the community at https://healthcare-ai.slack.com
packageVersion("healthcareai")
#> [1] '2.2.0'

m <- machine_learn(pima_diabetes, patient_id, outcome = diabetes)
#> Training new data prep recipe...
#> Variable(s) ignored in prep_data won't be used to tune models: patient_id
#> 
#> diabetes looks categorical, so training classification algorithms.
#> 
#> After data processing, models are being trained on 12 features with 768 observations.
#> Based on n_folds = 5 and hyperparameter settings, the following number of models will be trained: 50 rf's, 50 xgb's, and 100 glm's
#> Training with cross validation: Random Forest
#> Training with cross validation: eXtreme Gradient Boosting
#> Training with cross validation: glmnet
#> 
#> *** Models successfully trained. The model object contains the training data minus ignored ID columns. ***
#> *** If there was PHI in training data, normal PHI protocols apply to the model object. ***
attr(m, "versions")$hcai_version
#> [1] "2.3.0"

Created on 2018-12-04 by the reprex package (v0.2.0).