選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

Neptune ML 中的 Gremlin 節點迴歸查詢

焦點模式
Neptune ML 中的 Gremlin 節點迴歸查詢 - Amazon Neptune

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

節點迴歸類似於節點分類,不同之處在於從每個節點的迴歸模型推斷出的值是數值。您可以使用與節點分類相同的 Gremlin 查詢進行節點迴歸,但以下差異除外:

  • 同樣,在 Neptune ML 中,節點指的是頂點。

  • properties() 步驟接受形式 properties().with("Neptune#ml.regression") 而不是 properties().with("Neptune#ml.classification")

  • "Neptune#ml.limit" 和 "Neptune#ml.threshold" 述詞不適用。

  • 根據值進行篩選時,您必須指定一個數值。

以下是範例頂點分類查詢:

g.with("Neptune#ml.endpoint","node-regression-movie-lens-endpoint") .with("Neptune#ml.iamRoleArn", "arn:aws:iam::0123456789:role/sagemaker-role") .V("movie_1","movie_2","movie_3") .properties("revenue").with("Neptune#ml.regression")

您可以根據使用迴歸模型推斷出的值進行篩選,如下列範例所示:

g.with("Neptune#ml.endpoint","node-regression-movie-lens-endpoint") .with("Neptune#ml.iamRoleArn","arn:aws:iam::0123456789:role/sagemaker-role") .V("movie_1","movie_2","movie_3") .properties("revenue").with("Neptune#ml.regression") .value().is(P.gte(1600000)) g.with("Neptune#ml.endpoint","node-regression-movie-lens-endpoint") .with("Neptune#ml.iamRoleArn","arn:aws:iam::0123456789:role/sagemaker-role") .V("movie_1","movie_2","movie_3") .properties("revenue").with("Neptune#ml.regression") .hasValue(P.lte(1600000D))

在節點迴歸查詢中使用歸納推論

假設您要在 Jupyter 筆記本中將新節點新增至現有圖形,如下所示:

%%gremlin g.addV('label1').property(id,'101').as('newV') .V('1').as('oldV1') .V('2').as('oldV2') .addE('eLabel1').from('newV').to('oldV1') .addE('eLabel2').from('oldV2').to('newV')

然後,您可以使用歸納推論查詢,來取得考慮到新節點的評分:

%%gremlin g.with("Neptune#ml.endpoint", "nr-ep") .with("Neptune#ml.iamRoleArn", "arn:aws:iam::123456789012:role/NeptuneMLRole") .V('101').properties("rating") .with("Neptune#ml.regression") .with("Neptune#ml.inductiveInference")

因為查詢不具確定性,所以如果根據鄰域多次執行該查詢,其可能會傳回有些不同的結果:

# First time ==>vp[rating->9.1] # Second time ==>vp[rating->8.9]

如果需要更一致的結果,您可以使查詢具有確定性:

%%gremlin g.with("Neptune#ml.endpoint", "nc-ep") .with("Neptune#ml.iamRoleArn", "arn:aws:iam::123456789012:role/NeptuneMLRole") .V('101').properties("rating") .with("Neptune#ml.regression") .with("Neptune#ml.inductiveInference") .with("Neptune#ml.deterministic")

現在每次結果都會大致相同:

# First time ==>vp[rating->9.1] # Second time ==>vp[rating->9.1]

下一個主題:

邊緣分類

上一個主題:

節點分類

在本頁面

隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。