All Products
Search
Document Center

Platform For AI:PMML processor

Last Updated:Aug 24, 2026

The PMML processor built into deploys models in PMML format as online services and provides real-time online inference.

Background information

You can use the PMML processor to deploy a PMML model exported from to . You can also convert a model trained with an open source framework such as Sklearn or Xgboost to PMML format and then deploy it to . For more information, see Export a general-purpose model.

For more information about PMML models, see Introduction to PMML models.

Missing value imputation strategies

The PMML processor provides default imputation strategies for missing values. If a feature field in the PMML model file does not specify an isMissing policy, the system uses the following default values.

Data type

Default value

BOOLEAN

false

DOUBLE

0.0

FLOAT

0.0

INT

0

STRING

""

Step 1: Deploy the service

When you deploy a PMML model service by using the eascmd client, set the processor type to pmml. The following example shows the service configuration file.

{
  "name": "eas_lr_example",
  "processor": "pmml",
  "model_path": "http://examplebucket.oss-cn-shanghai.aliyuncs.com/models/lr.pmml",
  "metadata": {
    "instance": 1,
    "cpu": 1
  }
}

For more information about how to deploy a service by using the eascmd client, see Deploy a service using EASCMD or DSW.

You can also deploy a PMML model service in the console. For more information, see Deploy a service from the console.

Step 2: Call the service

Perform the following steps to call the service.

  1. After the PMML service is deployed, go to the Elastic Algorithm Service (EAS) page. Find the service that you want to call and click Invocation Information in the Service Type column to view the endpoint used to access the service and the token used for service authentication.

    Construct the service request.

    A PMML service uses plain JSON files for input and output. A single request supports multiple samples, and each sample is feature data in key-value format. The following example shows the request body.

    [
        {
            "address": 12,
            "age": 22,
            "ed": 4,
            "marital": 3.0,
            "region": 2.0,
            "tenure": 4.0
        },
        {
            "address": 2,
            "age": 34,
            "ed": 6,
            "marital": 1.3,
            "region": 2.1,
            "tenure": 4.2
        }
    ]
    Note

    When you send the service request, you can remove the line breaks and spaces from the JSON file to reduce network traffic and improve service performance.

  2. Send the service request.

    The following two methods are supported:

    Important

    If you pass the token directly in the HTTP header, the token is transmitted over the network in plaintext. The SDKs provided by sign the request with the token before sending it, which is more secure.

    • Use the curl command to run a quick request test on the service.

      The service provides an HTTP endpoint. When you send a request, you can pass the authentication token directly in the HTTP header, as shown in the following example.

      // Send the request.
      curl -v 18284888792***.cn-shanghai.pai-eas.aliyuncs.com/api/predict/pmml_test \
            -H 'Authorization: YmE3NDkyMzdiMzNmMGM3ZmE4ZmNjZDk0M2NiMDA***' \
            -d '[{"region": 2.0, "marital":3.0,"tenure":4.0, "age":22,"address":12,"ed":4},{"region": 2.1, "marital":1.3,"tenure":4.2, "age":34,"address":2,"ed":6}]'

      In the preceding command:

      • 18284888792***.cn-shanghai.pai-eas.aliyuncs.com/api/predict/pmml_test: Replace with the endpoint that you obtained in step 1.

      • Authorization: Set to the authentication token that you obtained in step 1.

      The following example shows the returned result.

      [{"p_0":0.2856724025030001,"p_1":0.7143275974969999},{"p_0":0.18324957921381624,"p_1":0.8167504207861838}]
    • Use the Python SDK to send the request. For more information, see Python SDK usage guide.

      The following sample code is provided.

      #!/usr/bin/env python
      
      from eas_prediction import PredictClient
      from eas_prediction import StringRequest
      
      if __name__ == '__main__':
          # Replace with the endpoint and service name that you obtained in step 1.
          client = PredictClient('1828488879222***.cn-shanghai.pai-eas.aliyuncs.com', 'pmml_test')
          # Replace with the authentication token that you obtained in step 1.
          client.set_token('YmE3NDkyMzdiMzNmMGM3ZmE4ZmNjZDk0M2NiMDA***')
          client.init()
      
          req = StringRequest('[{"region": 2.0, "marital":3.0,"tenure":4.0, "age":22,"address":12,"ed":4},{"region": 2.1, "marital":1.3,"tenure":4.2, "age":34,"address":2,"ed":6}]')
          for x in range(100):
              resp = client.predict(req)
              print(resp)

    For more information about client SDKs in other languages, see Service invocation SDKs.

References