Dropping models
If we no longer need a trained model and want to free up memory, we can drop the model from the catalog.
Syntax
CALL gds.model.drop(modelName: String, failIfMissing: Boolean)
YIELD
modelName: String,
modelType: String,
modelInfo: Map,
creationTime: DateTime,
trainConfig: Map,
graphSchema: Map,
loaded: Boolean,
stored: Boolean,
published: Boolean
Name | Type | Default | Optional | Description |
---|---|---|---|---|
modelName |
String |
|
no |
Name of a model stored in the catalog. |
failIfMissing |
Boolean |
|
yes |
Whether an error should be raised when the model does not exist. When set to |
Name | Type | Description |
---|---|---|
modelName |
String |
Name of the model. |
modelType |
String |
Type of the model. Indicates what training algorithm was used to train the model. |
modelInfo |
Map |
Detailed type-specific information about the trained model. |
creationTime |
Datetime |
Time when the model was created. |
trainConfig |
Map |
Train configuration used for training the model. |
graphSchema |
Map |
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. |
published |
Boolean |
True, if the model has been published. |
Examples
In this section we are going to demonstrate the usage of gds.model.drop
.
For simplicity, we will assume that an example model named my-model1
has already been trained and exists in the model catalog.
Dropping a model
To drop a model, we only need to specify its name.
CALL gds.model.drop('my-model1')
YIELD modelName, modelType, modelInfo, loaded, stored, published
modelName | modelType | modelInfo | loaded | stored | published |
---|---|---|---|---|---|
|
|
|
|
|
|
When dropping a model, we get a result that represents its state in the catalog just prior to being dropped.
The dropped model is now no longer available in the catalog, which we can verify by running gds.model.list
.
CALL gds.model.list('my-model1')
YIELD modelName, modelType, modelInfo, loaded, stored, published
modelName | modelType | modelInfo | loaded | stored | published |
---|
Dropping a model that does not exist
If we try to drop a model that does not exist, an error is raised by default.
To avoid this, we can set failIfMissing
to false
.
CALL gds.model.drop('my-model1', false)
modelName | modelType | modelInfo | creationTime | trainConfig | graphSchema | loaded | stored | published |
---|
As we can see, the procedure returns an empty result instead of raising an error.