Publishing models

By default, a trained model is visible only to the user that created it. Making a model accessible to other users can be achieved by publishing it.

Syntax

Publish a model from the catalog:
CALL gds.model.publish(modelName: String)
YIELD
    modelName: String,
    modelType: String,
    modelInfo: Map,
    creationTime: DateTime,
    trainConfig: Map,
    graphSchema: Map,
    loaded: Boolean,
    stored: Boolean,
    published: Boolean
Table 1. Parameters
Name Type Default Optional Description

modelName

String

n/a

no

The name of a model stored in the catalog.

Table 2. Results
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 will illustrate how to publish a model. A pre-requisite for this operation is that a model has already been trained and registered in the model catalog. We will assume here that two models named my-model1 and my-model2 have already been trained and exist in the model catalog. Our initial state can be inspected by listing all models in the catalog:

Listing information about all models:
CALL gds.model.list()
YIELD modelName, modelType, modelInfo, loaded, stored, published
Table 3. Results
modelName modelType modelInfo loaded stored published

"my-model1"

"example-model-type"

{exampleModelInfo=exampleValue}

true

false

false

"my-model2"

"example-model-type"

{number=42}

true

false

false

Publishing a model

All we need to do is to run the procedure and specify the name of the model we want to publish.

Publishing a trained model:
CALL gds.model.publish('my-model1')
YIELD modelName, modelType, modelInfo, loaded, stored, published
Table 4. Results
modelName modelType modelInfo loaded stored published

"my-model1_public"

"example-model-type"

{exampleModelInfo=exampleValue}

true

false

true

We can see that the model name is modified with the _public suffix. When we now list the models in the catalog we can see that the published model has changed.

Listing all models, including the published model:
CALL gds.model.list()
YIELD modelName, modelType, modelInfo, loaded, stored, published
RETURN modelName, modelType, modelInfo, loaded, stored, published
  ORDER BY modelName
Table 5. Results
modelName modelType modelInfo loaded stored published

"my-model1_public"

"example-model-type"

{exampleModelInfo=exampleValue}

true

false

true

"my-model2"

"example-model-type"

{number=42}

true

false

false

The published model is now accessible to all users.