Billing

Updated at:

This topic describes how to estimate the cost of a MaxCompute SQLML job.

Background

A typical algorithm component consists of multiple subtasks. To calculate the total cost, you must sum the costs of all subtasks for each algorithm component. Because a MaxCompute SQLML job uses both MaxCompute and Platform for AI, the total cost includes charges from both services.

Billing rules

Alibaba Cloud Platform for AI provides the machine learning capabilities for MaxCompute SQLML, which are billed separately. The total cost of a MaxCompute SQLML job consists of the following two parts:

  • SQL job: The compute and storage resources are billed according to the billing rules of MaxCompute SQL. For more information, see Billable items and billing methods.

  • Machine learning model: The model is billed according to the rules of Machine Learning Designer. For more information about Platform for AI billing, see Machine Learning Designer billing:

    Machine learning model

    Unit price (CNY/billable hour)

    MaxCompute regions

    Logistic regression for binary classification

    1.3

    • China (Beijing)

    • China (Shanghai)

    • China (Hangzhou)

    • China (Shenzhen)

    • China (Hong Kong)

    Logistic regression for multiclass classification

    Linear regression

    Note

    One billable hour is equivalent to the consumption of one CPU core and 4 GB of memory for one hour. Use the following formula to calculate the number of billable hours:

    Number of billable hours = max(Number of CPU cores × Runtime in hours, Memory usage in GB × Runtime in hours / 4)

    For example, if a job consumes 2 CPU cores and 5 GB of memory for 1 hour, the number of billable hours is calculated as follows:

    Number of billable hours = max(2 × 1, 5 × 1 / 4) = 2

    The total cost is calculated as follows:

    Total cost = Number of billable hours × Unit price
    In this example, the total cost is:
    2 billable hours × CNY 1.30/billable hour = CNY 2.60

Billing example

To estimate costs for a MaxCompute SQLML job, you must first obtain its CPU core and memory usage.

This example shows how to estimate the cost by using the prediction data view from the Quick Start.

  1. Use the ad hoc query feature in DataWorks to create a logistic regression for binary classification model named lr_test_model_1 based on the mushroom_predict data view. After the job runs, obtain the Logview link.

    Sample command:

    create model lr_test_model_1 
    with properties('model_type'='logisticregression_binary', 'goodValue'='p','maxIter'='1000') 
    as select * from mushroom_predict;

    The following result is returned:创建模型

  2. Use the Logview link to retrieve the instance ID of the AlgoTask job.

    In MaxCompute, a machine learning job is an AlgoTask. The job name uses the format Projectname_<InstanceID>_AlgoTask_x_x. Find the instance ID in the job name.InstanceID

  3. Use the ad hoc query feature in DataWorks to retrieve the Logview of the machine learning job based on the instance ID.

    Sample command:

    wait 20210209031144617gcjpt62m_1dbea3a8_17de_40d5_80bf_ce19e11d****;

    The following result is returned:logview

  4. In the Logview of the machine learning job, open the SourceXML tab to find the CPU core and memory usage information in the TaskPlan section.

    获取CPU和内存The following list describes the parameters:

    • To calculate the number of CPU cores used, divide the CPU value by 100. For this subtask, the value is 100, which means 1 CPU core was used.

    • The Memory value is in megabytes (MB). For this subtask, 3.2 GB of memory was used.

    Important

    These CPU core and memory values are for a single subtask. A job can have multiple subtasks. Find the total number of tasks in the next step.

  5. In the Logview of the machine learning job, open the Job Details tab to find the number of tasks and the runtime.

    As shown in the figure, the job has 2 tasks and a runtime of 48 minutes.Job Detail

    In summary, this job used a total of 2 CPU cores (2 tasks × 1 core/task) and 6.4 GB of memory (2 tasks × 3.2 GB/task), and it ran for 48 minutes.

  6. Estimate the total cost.

    1. Calculate the number of billable hours.

      Number of billable hours = max(Total CPU cores × Runtime in hours, Total memory in GB × Runtime in hours / 4) = max(2 × 0.8, 6.4 × 0.8 / 4) = max(1.6, 1.28) = 1.6
    2. Calculate the cost of the machine learning job.

      Total cost for machine learning = Number of billable hours × Unit price ≈ 1.6 × 1.30 = CNY 2.08

      The cost of the machine learning job is CNY 2.08.

    3. Calculate the SQL job cost. For more information, see Compute pricing (subscription) or Compute pricing (pay-as-you-go).

    4. The total cost for the MaxCompute SQLML job is the sum of the machine learning and SQL job costs.

Billing information

In your bill, the total cost for a MaxCompute SQLML job is listed as the sum of charges for two services: MaxCompute and Machine Learning Platform for AI (PAI).