在 Scala 中使用 REST API 从 Google Cloud ML Engine 请求数据
Requesting data from Google Cloud ML Engine using the REST API in Scala
我想使用 Scala 代码从已部署的 ML 引擎模型中检索信息。
例如,为了实现此 link 中陈述的 "getConfig" 方法的 REST 请求,代码看起来如何:https://cloud.google.com/ml-engine/reference/rest/。
谢谢!
您需要从 Scala 调用 Java 库。 This page has a code example of how to make a prediction request in Java (source code direct link)。只需稍作修改即可使用其他方法。例如,要调用 getConfig
,您将进行以下更改:
RestMethod method = api.getResources().get("projects").getMethods().get("getConfig");
希望这可以轻松转换为 Scala。
我想使用 Scala 代码从已部署的 ML 引擎模型中检索信息。
例如,为了实现此 link 中陈述的 "getConfig" 方法的 REST 请求,代码看起来如何:https://cloud.google.com/ml-engine/reference/rest/。
谢谢!
您需要从 Scala 调用 Java 库。 This page has a code example of how to make a prediction request in Java (source code direct link)。只需稍作修改即可使用其他方法。例如,要调用 getConfig
,您将进行以下更改:
RestMethod method = api.getResources().get("projects").getMethods().get("getConfig");
希望这可以轻松转换为 Scala。