All Products
Search
Document Center

Platform For AI:Air quality prediction

Last Updated:Aug 25, 2026

Build a model to predict air quality by analyzing a year's worth of real data from Beijing, and identify the pollutants that have the greatest impact on PM 2.5 levels.

Dataset

This experiment uses hourly air quality data from Beijing for 2016. The following table describes the fields in the dataset.

Field name

Type

Description

time

STRING

The date of data collection.

hour

STRING

The hour when the data was collected.

pm2

STRING

The PM 2.5 index.

pm10

STRING

The PM 10 index.

so2

STRING

The sulfur dioxide (SO2) index.

co

STRING

The carbon monoxide (CO) index.

no2

STRING

The nitrogen dioxide (NO2) index.

Predicting air quality

  1. Go to the Machine Learning Designer page.

    1. Log on to the PAI console.

    2. In the left-side navigation pane, click Workspaces. On the Workspaces page, click the name of the workspace that you want to manage.

    3. In the left-side navigation pane, choose Model Training > Visualized Modeling (Designer).

  2. Build a pipeline.

    1. On the Designer page, click the Preset Templates tab.

    2. In the Air Quality Prediction section, click Create.

    3. In the Create Pipeline dialog box, configure the parameters. You can use the default settings for all parameters.

      The Data Storage parameter specifies an OSS Bucket path to store temporary data and models generated during the pipeline run.

    4. Click Confirm.

      It takes about 10 seconds to create the pipeline.

    5. In the pipeline list, double-click the Air Quality Prediction pipeline to open it.

    6. The system automatically builds the pipeline from the preset template.

      雾霾预测实验

      Region

      Description

      ①

      Data import and preprocessing:

      1. The Read Data Table component imports the dataset.

      2. The Type Transform component converts data from STRING to DOUBLE.

      3. The SQL Script component converts the label column to a binary type of 0 or 1. In this experiment, the pm2 column is the label column. Values greater than 200, which indicate heavy air pollution, are marked as 1. Other values are marked as 0. The following SQL statement is used:

        select time,hour,(case when pm2>200 then 1 else 0 end),pm10,so2,co,no2 from ${t1};
      4. The Normalization component standardizes pollutant indicator data to remove dimensionality.

      ②

      Statistical analysis:

      1. The Histogram component visualizes the distribution of each pollutant.

        For example, for PM2.5, the most frequent value range is 11.74 to 15.61, which occurs 430 times, as shown in the following figure.pm2.5分布

      2. The Data View component visualizes how value ranges for each pollutant affect the outcome.

        For example, for the no2 feature, the range 112.33 to 113.9 contains 7 instances of the target label 0 and 9 instances of the target label 1, as shown in the following figure. This indicates a higher probability of heavy air pollution when the no2 value is in this range. Entropy and Gini measure the information gain, or impact, of this feature range on the target value. A larger value indicates a greater impact.image.png

      ③

      Model training and prediction: The Random Forest and Binary Logistic Regression components train the model.

      ④

      Model evaluation.

  3. Run the pipeline and view the model results.

    1. Click the Run icon image at the top of the canvas.

    2. After the pipeline finishes, right-click the Binary Classification Evaluation component downstream of the Random Forest component on the canvas and select Visual Analysis from the shortcut menu.

    3. In the Binary Classification Evaluation dialog box, click the Evaluation Charts tab to view the prediction results of the Random Forest model.

      image.pngThe Area Under the Curve (AUC) is over 99%, indicating high prediction accuracy for the Random Forest model.

    4. Right-click the Binary Classification Evaluation component downstream of the Binary Logistic Regression component on the canvas and select Visual Analysis from the shortcut menu.

    5. In the Binary Classification Evaluation dialog box, click the Evaluation Charts tab to view the prediction results of the Binary Logistic Regression model.

      image.pngThe AUC is over 98%, indicating high prediction accuracy for the Binary Logistic Regression model.