sklearnToJson {PatientLevelPrediction} | R Documentation |
Saves sklearn python model object to json in path
Description
Saves sklearn python model object to json in path
Usage
sklearnToJson(model, path)
Arguments
model |
a fitted sklearn python model object |
path |
path to the saved model file |
Value
nothing, saves the model to the path as json
Examples
## Not run:
sklearn <- reticulate::import("sklearn", convert = FALSE)
model <- sklearn$tree$DecisionTreeClassifier()
model$fit(sklearn$datasets$load_iris()$data, sklearn$datasets$load_iris()$target)
saveLoc <- file.path(tempdir(), "model.json")
sklearnToJson(model, saveLoc)
# the model.json is saved in the tempdir
dir(tempdir())
# clean up
unlink(saveLoc)
## End(Not run)
[Package PatientLevelPrediction version 6.4.1 Index]