

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# SPARQL 对象回归示例
<a name="machine-learning-sparql-inference-object-regression"></a>

对象回归与对象分类类似，不同之处在于从回归模型中推理的每个节点的数值谓词值。除了 `the Neptune#ml.limit` 和 `Neptune#ml.threshold` 谓词不适用之外，您可以对于对象回归和对象分类使用相同的 SPARQL 查询。

下面的查询试图预测类型为 `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 .
  }
}
```