APIs for Submit Ranking Jobs

Function

This API is used to submit ranking jobs.

URI

POST /v1/{project_id}/rank-job

Table 1 describes the URI parameters.

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For details about how to obtain the project ID, see Obtaining a Project ID.

Request

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Mandatory

Type

Description

workspace_id

No

String

Workspace ID. The default value is 0.

job_name

Yes

String

Ranking job name. The name can contain 1 to 20 characters. Only digits, letters, underscores (_), and hyphens (-) are allowed, for example, rank-demo.

job_description

No

String

Training job description. The value can contain a maximum of 256 characters.

spec_id

Yes

Int

Resource specification ID of a ranking job Before using ModelArts, query the access keys by referring to Querying the Access Keys of ModelArts and associate the access keys with ModelArts by referring to Associating the AK/SK with ModelArts. Then, obtain the value returned by the spec_id parameter by referring to Querying the Compute Node Specifications of ModelArts.

run_path

Yes

String

Root path for saving models and log files Folders that do not contain Chinese characters,

training_data_path

Yes

String

OBS path for storing training data,

test_data_path

Yes

String

OBS path for storing test data,

algorithm_type

Yes

String

Algorithm name, which is defined inside RES. The value must be one of LR, FM, FFM, DeepFM, or PIN.

algorithm_parameters

Yes

JSON

Each algorithm has its own parameter list, including initialization, optimization, and regularization items.

As a generalized linear regression analysis model, logistic regression is often used in data mining, automatic disease diagnosis, and economic prediction. The logistic regression algorithm uses a sigmoid activation function on the basis of linear regression to map the output value ranging from 0 to 1. It is a common binary algorithm in the machine learning field. For details about logistic regression, see Logistic Regression.

The FM algorithm is based on matrix factorization. It can automatically perform second-order feature crosses and learn the relationship between features without manual intervention, as well as solve the problem of sparse combination characteristics. For details about factorization machines, see Factorization Machine.

FFM is an improved version of FM. Each feature of FM can learn only one implicit vector from all fields while each feature of FFM can learn an implicit vector from each of the other fields. Therefore, FFM can provide higher precision, but it is more likely to incur overfitting. For details about field-aware factorization machines, see Field-aware Factorization Machine.

DeepFM is the combination of FM and deep neural network for learning feature expressions. It also learns high-order and low-order feature crosses to achieve accurate feature cross learning for precise recommendation. For details about deep network factorization machines, see Deep Network Factorization Machine.

Product-network in network for user response prediction over multi-field categorical data is an optimized version of DeepFM. DeepFM calculates the relationships between features by dot product, while the product-network in network for user response prediction over multi-field categorical data uses different kernels to build a model for feature interaction to calculate the relationships between the features in the two fields. The types of the kernels include dot product, cross product, matrix multiplication, and neural network. Kernel functions are used to build models for feature interaction, realizing parameter sharing and reducing model complexity. For details about the product-network in network, see Product-network In Network.

config

No

JSON

Other configurations. This field is preserved.

Response

Table 3 describes the response parameters.

Table 3 Response parameters

Parameter

Type

Description

is_success

Boolean

Whether the request is successful

error_msg

String

Error message that indicates a request has failed. This parameter is unavailable when a request is successful.

error_code

String

Error code that indicates a request has failed. This parameter is unavailable when a request is successful.

job_id

Long

Training job ID

job_name

String

Training job name

create_time

Long

Time when a training job is created

Example

  • Example request
    {
      "job_name": "hhx-1214-11",
      "spec_id": 2,
      "run_path": "<Root path for storing the training results>",
      "training_data_path": "<OBS path for storing the training data>",
      "test_data_path": "<OBS path for storing the test data>",
      "algorithm_type": "DEEPFM",
      "algorithm_parameters": {
        "fields_feature_size_path": "<Path for storing the feature data>",
    
        "max_iterations": 10,
        "early_stop_iterations": 5,
        "algorithm_specify_parameters": {
          "latent_vector_length": 10,
          "architecture": [
            400,
            400,
            400
          ],
          "value_keep_probability":0.8,
          "active_function": "relu"
        },
        "regular_parameters": {
          "l2_regularization": 0.001,
          "regular_loss_compute_mode": "full"
        },
        "initial_parameters": {
          "initial_method": "normal",
          "mean_value": -0.001,
          "standard_deviation": 0.001
        },
        "optimize_parameters": {
          "type": "grad",
          "learning_rate": 1
        }
      }
    }
  • Example of a successful response
    {
        "is_success": true,
        "job_id": "27fa7f0a7b584eddbbcbb01be26de825",
        "job_name": "rank-12-03-012",
        "create_time": 1543978313378
     }
  • Example of a failed response
    {
        "is_success": false,
        "error_code": "res.4103",
        "error_msg": "Duplicate name."
    }

Status Code

For details about status codes, see Status Codes.