All Products
Search
Document Center

Platform For AI:Haze prediction

Last Updated:Apr 21, 2026

This article shows how to build a haze prediction model by analyzing a year's worth of real air quality data from Beijing. This model helps identify the pollutants that have the greatest impact on PM 2.5 levels, the primary indicator of haze.

Dataset

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

Parameter

Type

Description

time

STRING

The date, accurate to the day.

hour

STRING

The hour the data was recorded.

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.

Procedure

  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 the pipeline.

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

    2. In the Haze Prediction section, click Create.

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

      The Data Storage parameter specifies the OSS Bucket path for storing temporary data and models generated during the pipeline run.

    4. Click Confirm.

      Creating the pipeline takes about 10 seconds.

    5. In the pipeline list, double-click the Haze Prediction pipeline to open it on the canvas.

    6. The system automatically builds the pipeline based on the preset template, as shown in the following figure.

      雾霾预测实验

      Section

      Description

      Data import and preprocessing:

      1. The Read Data Table component imports the data source.

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

      3. The SQL Script component converts the label column into binary values of 0 and 1. In this experiment, the pm2 column is the label column. A value greater than 200 indicates heavy haze and is set to 1; otherwise, the value is set to 0. The SQL statement is as follows:

        select time,hour,(case when pm2>200 then 1 else 0 end),pm10,so2,co,no2 from ${t1};
      4. The Normalization component removes the units of measurement to standardize the scale of different pollutant indicators.

      Statistical analysis:

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

        For example, the most frequent interval for PM 2.5 is 11.74 to 15.61, which occurred 430 times, as shown in the following figure.pm2.5分布

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

        For example, for no2, the interval from 112.33 to 113.9 contains 7 records with a label value of 0 and 9 records with a label value of 1, as shown in the following figure. This indicates that heavy haze is more likely when no2 falls within this range. Entropy and Gini measure the information gain from this feature interval. A larger value indicates a greater impact on the label.image.png

      Model training and prediction. This pipeline uses the Random Forest and Logistic Regression components to train models.

      Model evaluation.

  3. Run the pipeline and view the model performance.

    1. Click the Run button image above the canvas.

    2. When the pipeline finishes, right-click the Evaluation for Binary Classification component downstream of the Random Forest component on the canvas, and then select Visual Analysis.

    3. In the Evaluation for Binary Classification dialog box, click the Evaluation Charts tab to view the prediction performance of the model trained by the Random Forest component.

      image.pngThe Area Under the Curve (AUC) value indicates that the haze prediction model trained by the Random Forest component achieves an accuracy of over 99%.

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

    5. In the Evaluation for Binary Classification dialog box, click the Evaluation Charts tab to view the prediction performance of the model trained by the Logistic Regression component.

      image.pngThe AUC value shows that the haze prediction model trained by the Logistic Regression component has an accuracy of over 98%.