Machine Learning Forecast

“预测类”机器学习算法模型部署成功后,根据部署的预测模型,获取机器学习预测结果。


有关部署机器学习算法模型的详细信息,参考 算法模型托管

请求格式

POST https://{apigw-address}/ml-service/v1.0/forecasts?action=run

请求参数(URI)

名称

位置(Path/Query)

必需/可选

数据类型

描述

orgId

Query

必需

String

用户所属的组织ID。如何获取orgId信息>>

serviceId

Query

必需

String

部署算法模型时生成的服务 ID。

请求参数(Body)

名称

必需/可选

数据类型

描述

parameters

必需

String

以JSON格式传入算法模型的参数,参数个数需满足模型需要。

响应参数

名称

数据类型

描述

data

Object(String)

以JSON格式返回的机器学习预测结果。数据类型包括:基本数据类型、复杂类型、和数组。

示例

请求示例

url: https://{apigw-address}/ml-service/v1.0/forecasts?action=run&orgId=yourOrgId&serviceId=f40fbb09-ce20-463f-bb18

method: POST

requestBody:
{
    "parameters":{
"ColumnNames": [
        "age",
        "workclass",
        "fnlwgt",
        "education",
        "education-num",
        "marital-status",
        "occupation",
        "relationship",
        "race",
        "sex",
        "capital-gain",
        "capital-loss",
        "hours-per-week",
        "native-country"
      ],
      "Values": [
        [
          "0",
          "value",
          "0",
          "value",
          "0",
          "value",
          "value",
          "value",
          "value",
          "value",
          "0",
          "0",
          "0",
          "value"
        ],
        [
          "0",
          "value",
          "0",
          "value",
          "0",
          "value",
          "value",
          "value",
          "value",
          "value",
          "0",
          "0",
          "0",
          "value"
        ]
      ]
 }
}

返回示例

{
  "status": 0,
  "msg": "Success",
  "data": {
        "ColumnNames": [
          "Scored Labels",
          "Scored Probabilities"
        ],
        "ColumnTypes": [
          "String",
          "Numeric"
        ],
        "Values": [
          [
            "value",
            "0"
          ],
          [
            "value",
            "0"
          ]
        ]
  }
}