save_new_model: Save a model to the package

Description Usage Arguments Value Examples

View source: R/tree.R

Description

Save a model to the package

Usage

1
save_new_model(new_model, include.default = TRUE, path.to.models = ".")

Arguments

new_model

new model to be added into the classification tree

include.default

whether include the default models of the package in the list of new trained models or not. If users further want to classify cells, they can only use default pretrained model list or their new model list. Including default models in new trained models helps users using both of them once. In addition, default pretrained models of the package cannot be changed or removed. This can be done with the new trained model list.

path.to.models

path to the folder containing the list of new models.

Value

no return value, but the model is now saved to database

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# load small example dataset
data("tirosh_mel80_example")

# train classifier
selected_features_T = c("CD4", "CD8A", "CD8B")
set.seed(123)
clf_t <- train_classifier(train_obj = tirosh_mel80_example, 
features = selected_features_T, cell_type = "t cells")

# save the trained classifier to system 
# (test classifier can be used before this step)
save_new_model(new_model = clf_t, path.to.models = ".")

# verify if new model has been saved
print(names(load("./new_models.rda")))
delete_model("t cells")

grisslab/scClassifR documentation built on Oct. 27, 2021, 12:13 p.m.