Removing models

This feature is in the beta tier. For more information on feature tiers, see API Tiers.

If we no longer need a trained model and want to free up memory, we can remove the model from the catalog.

1. Syntax

Remove a model from the catalog:
CALL gds.beta.model.drop(modelName: String, failIfMissing: Boolean)
YIELD
    modelInfo: Map,
    trainConfig: Map,
    graphSchema: Map,
    loaded: Boolean,
    stored: Boolean,
    creationTime: DateTime,
    shared: Boolean
Table 1. Parameters
Name Type Default Optional Description

modelName

String

n/a

no

The name of a model stored in the catalog.

failIfMissing

Boolean

true

yes

By default, the library will raise an error when trying to remove a non-existing model. When set to false, the procedure returns an empty result.

Table 2. Results
Name Type Description

modelInfo

Map

Detailed information about the trained model. Always includes the modelName and modelType, e.g., GraphSAGE. Dependent on the model type, there are additional fields.

trainConfig

Map

The configuration used for training the model.

graphSchema

Map

The schema of the graph on which the model was trained.

loaded

Boolean

True, if the model is loaded in the in-memory model catalog.

stored

Boolean

True, if the model is stored on disk.

creationTime

Datetime

Time when the model was created.

shared

Boolean

True, if the model is shared between users.

2. Example

In this section we are going to demonstrate the usage of gds.beta.model.drop. Assume we trained a model by running train on one of our Machine learning algorithms.

Remove a model from the catalog:
CALL gds.beta.model.drop('my-model')
YIELD modelInfo, loaded, shared, stored
RETURN modelInfo.modelName AS modelName, loaded, shared, stored
Table 3. Results
modelName loaded shared stored

"my-model"

true

false

false

In this example, the removed my-model was of the imaginary type some-model-type. The model was loaded in-memory, but neither stored on disk nor published.

If the model name does not exist, an error will be raised.