

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

# SPARQL 物件迴歸範例
<a name="machine-learning-sparql-inference-object-regression"></a>

物件迴歸類似於物件分類，不同之處在於從每個節點的迴歸模型推斷出一個數值述詞值。如同物件分類一般，您可以將相同的 SPARQL 查詢用於物件迴歸，但 `the Neptune#ml.limit` 與 `Neptune#ml.threshold` 述詞不適用。

下列查詢試圖為類型 `foaf:Person` 的所有輸入預測 <http://www.example.org/accountbalance> 述詞值：

```
SELECT * WHERE { ?input a foaf:Person .
  SERVICE neptune-ml:inference {
    neptune-ml:config neptune-ml:modelType 'OBJECT_REGRESSION' ;
                      neptune-ml:input ?input ;
                      neptune-ml:predicate <http://www.example.org/accountbalance> ;
                      neptune-ml:output ?output .
  }
}
```

此查詢可以自訂如下：

```
SELECT * WHERE { ?input a foaf:Person .
  SERVICE neptune-ml:inference {
    neptune-ml:config neptune-ml:endpoint 'node-prediction-account-balance-endpoint' ;
                      neptune-ml:iamRoleArn 'arn:aws:iam::0123456789:role/sagemaker-role' ;

                      neptune-ml:batchSize "40"^^xsd:integer ;
                      neptune-ml:timeout "1000"^^xsd:integer ;

                      neptune-ml:modelType 'OBJECT_REGRESSION' ;
                      neptune-ml:input ?input ;
                      neptune-ml:predicate <http://www.example.org/accountbalance> ;
                      neptune-ml:output ?output .
  }
}
```