save_new_model {scClassifR} | R Documentation

## Save a model to the package

### Description

Save a model to the package

### Usage

    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

    # 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")

[Package scClassifR version 1.2.0 Index]