本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
Neptune ML 中的 Gremlin 边缘回归查询
边缘回归与边缘分类类似,只是从 ML 模型推断出的值是数字。对于边缘回归,Neptune ML 支持与分类相同的查询。
要注意的要点是:
你需要使用 ML 谓词
"Neptune#ml.regression"
要配置properties()
这个用例的步骤。这些区域有:
"Neptune#ml.limit"
和"Neptune#ml.threshold"
谓词在此用例中不适用。要对该值进行筛选,您需要将该值指定为数字。
Gremlin 边缘回归查询的语法
对于简单的图表User
是头节点,Movie
是尾节点,而且Rated
是连接它们的边缘,这里是一个示例边缘回归查询,它查找边缘的数字评级值(此处称为分数)Rated
:
g.with("Neptune#ml.endpoint","edge-regression-movie-lens-endpoint") .with("Neptune#ml.iamRoleArn","arn:aws:iam::0123456789:role/sagemaker-role") .E("rating_1","rating_2","rating_3") .properties("score").with("Neptune#ml.regression")
您还可以筛选从 ML 回归模型推断出的值。对于现有的Rated
边缘(来自User
到Movie
) 标识者"rating_1"
、"rating_2"
, 和"rating_3"
,其中 edge 属性Score
这些评级不存在,你可以使用下面的查询来推断Score
对于大于或等于 9 的边缘:
g.with("Neptune#ml.endpoint","edge-regression-movie-lens-endpoint") .with("Neptune#ml.iamRoleArn","arn:aws:iam::0123456789:role/sagemaker-role") .E("rating_1","rating_2","rating_3") .properties("score").with("Neptune#ml.regression") .value().is(P.gte(9))