Neptune ML predicates used in Gremlin inference queries - Amazon Neptune
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Neptune ML predicates used in Gremlin inference queries

Neptune#ml.endpoint

The Neptune#ml.endpoint predicate is used in a with() step to specify the inference endpoint, if necessary:

.with("Neptune#ml.endpoint", "the model's SageMaker inference endpoint")

You can identify the endpoint either by its id or its URL. For example:

.with( "Neptune#ml.endpoint", "node-classification-movie-lens-endpoint" )

Or:

.with( "Neptune#ml.endpoint", "https://runtime.sagemaker.us-east-1.amazonaws.com/endpoints/node-classification-movie-lens-endpoint/invocations" )
Note

If you set the neptune_ml_endpoint parameter in your Neptune DB cluster parameter group to the endpoint id or URL, you don't need to include the Neptune#ml.endpoint predicate in each query.

Neptune#ml.iamRoleArn

Neptune#ml.iamRoleArn is used in a with() step to specify the ARN of the SageMaker execution IAM role, if necessary:

.with("Neptune#ml.iamRoleArn", "the ARN for the SageMaker execution IAM role")

For information about how to create the SageMaker execution IAM role, see Create a custom NeptuneSageMakerIAMRole role.

Note

If you set the neptune_ml_iam_role parameter in your Neptune DB cluster parameter group to the ARN of your SageMaker execution IAM role, you don't need to include the Neptune#ml.iamRoleArn predicate in each query.

Neptune#ml.limit

The Neptune#ml.limit predicate optionally limits the number of results returned per entity:

.with( "Neptune#ml.limit", 2 )

By default, the limit is 1, and the maximum number that can be set is 100.

Neptune#ml.threshold

The Neptune#ml.threshold predicate optionally establishes a cutoff threshold for result scores:

.with( "Neptune#ml.threshold", 0.5D )

This lets you discard all results with scores below the specified threshold.

Neptune#ml.classification

The Neptune#ml.classification predicate is attached to the properties() step to establish that the properties need to be fetched from the SageMaker endpoint of the node classification model:

.properties( "property key of the node classification model" ).with( "Neptune#ml.classification" )

Neptune#ml.regression

The Neptune#ml.regression predicate is attached to the properties() step to establish that the properties need to be fetched from the SageMaker endpoint of the node regression model:

.properties( "property key of the node regression model" ).with( "Neptune#ml.regression" )

Neptune#ml.prediction

The Neptune#ml.prediction predicate is attached to in() and out() steps to establish that this a link-prediction query:

.in("edge label of the link prediction model").with("Neptune#ml.prediction").hasLabel("target node label")

Neptune#ml.score

The Neptune#ml.score predicate is used in Gremlin node or edge classification queries to fetch a machine-learning confidence Score. The Neptune#ml.score predicate should be passed together with the query predicate in the properties() step to obtain an ML confidence score for node or edge classification queries.

You can find a node classification example with other node classification examples, and an edge classification example in the edge classification section.