Checking if a model exists
We can check if a model is available in the catalog by looking up its name.
Syntax
CALL gds.model.exists(modelName: String)
YIELD
modelName: String,
modelType: String,
exists: Boolean
Name | Type | Default | Optional | Description |
---|---|---|---|---|
modelName |
String |
|
no |
The name of a model. |
Name | Type | Description |
---|---|---|
modelName |
String |
The name of a model. |
modelType |
String |
The type of the model. |
exists |
Boolean |
True, if the model exists in the model catalog. |
Examples
In this section we are going to demonstrate the usage of gds.model.exists
.
For simplicity, we will assume that an example model named my-model1
has already been trained and exists in the model catalog.
Check an existing model
We can check if a model exists in the catalog by specifying its name.
CALL gds.model.exists('my-model1');
modelName | modelType | exists |
---|---|---|
"my-model1" |
"example-model-type" |
true |
As we can see, the model does exist in the model catalog.
Check a non-existing model
If we instead use a non-existing model name, we will get a false
value for the exists
field.
CALL gds.model.exists('does-not-exist');
modelName | modelType | exists |
---|---|---|
"does-not-exist" |
"n/a" |
false |
As we can see, this model does not exist in the model catalog.
Since this model does not exist, its type is n/a
.