Help Center> ModelArts> Best Practices> ExeML> Bank Deposit Prediction (Using ExeML for Predictive Analytics)

Bank Deposit Prediction (Using ExeML for Predictive Analytics)

Banks often predict whether customers would be interested in a time deposit based on their characteristics, including the age, work type, marital status, education background, housing loan, and personal loan.

Now, you can use the ExeML function on ModelArts to predict whether a customer would be interested in the time deposit. The process of using ExeML is as follows:

  1. Preparing Data: Download a dataset and upload it to Object Storage Service (OBS) on HUAWEI CLOUD.
  2. Creating a Predictive Analytics Project: Create a predictive analytics project based on the existing dataset.
  3. Training a Model: Preview the data and select the training objective, and then start the model training.
  4. Deploying the Model: Deploy the trained model as a real-time service and test the prediction result.

Preparing Data

In this example, the dataset is from the Machine Learning Repository of UCI. For details about the dataset, see Bank Marketing Data Set. Table 1 and Table 2 describe the parameters and sample data of the dataset. You can obtain the dataset from GitHub and upload it to OBS.

Table 1 Parameters and meanings of data sources

Parameter

Meaning

Type

Description

attr_1

Age

Int

Age of the customer

attr_2

Occupation

String

Occupation of the customer

attr_3

Marital status

String

Marital status of the customer

attr_4

Education status

String

Education status of the customer

attr_5

Real estate

String

Real estate of the customer

attr_6

Loan

String

Loan of the customer

attr_7

Deposit

String

Deposit of the customer

Table 2 Sample data of the dataset

attr_1

attr_2

attr_3

attr_4

attr_5

attr_6

attr_7

31

blue-collar

married

secondary

yes

no

no

41

management

married

tertiary

yes

yes

no

38

technician

single

secondary

yes

no

no

39

technician

single

secondary

yes

no

yes

39

blue-collar

married

secondary

yes

no

no

39

services

single

unknown

yes

no

no

  1. Download the ModelArts-Lab project from Gitee and obtain the train.csv training data file from the \ModelArts-Lab-master\official_examples\Using_ModelArts_to_Create_a_Bank_Marketing_Application\data directory of the project.
  2. Upload the train.csv file to OBS, for example, to the test-modelarts/bank-marketing directory. For details about how to upload files to OBS, see Uploading a File.

Creating a Predictive Analytics Project

  1. On the ModelArts management console, click ExeML in the left navigation pane.
  2. On the ExeML page, click Create Project in the Predictive Analytics area.
  3. On the Create Predictive Analytics Project page, set the project name and select the OBS path where the training data is stored. In this example, the dataset path is test-modelarts/bank-marketing/train.csv. Click Create Project. The data labeling page is displayed, as shown in Figure 1.
    Figure 1 Creating a predictive analytics project

Training a Model

  1. On the ExeML > Label Data page, preview the data and select the training objective. The training objective here is to determine whether the customer will apply for a deposit (that is, attr_7). Set Label Column Data Type to Discrete Value. After the training objective is specified, click Training.
    Figure 2 Selecting the training objective
  2. In the displayed Training Configuration dialog box, select an instance flavor used for training and click Yes to start model training.

    The training takes a certain period of time. If you close or exit the page, the system continues training until it is completed.

    Figure 3 Training configuration
  3. In the upper left corner of the model training page, if the status of the training job changes to Completed, the training job is completed. The Training Details area on the right shows the details about the training job.
    Figure 4 Training job completed

Deploying the Model

  1. On the Train Model page, click Deploy in the Version Manager area. The system starts to deploy the service and automatically switches to the Deployment Online tab page.
  2. In the Version Manager area, when the status changes to Running, the service has been deployed. You can test the service in the prediction area.

    The following shows the test code. As shown in Figure 5, the prediction result is "predictioncol": "yes", indicating that the customer will apply for a deposit.

    {
      "data": 
      {
        "count": 1,
        "req_data": 
    	[
          {
            "attr_1": "58",
            "attr_2": "management",
            "attr_3": "married",
            "attr_4": "tertiary",
            "attr_5": "yes",
            "attr_6": "no",
            "attr_7": ""
          }
        ]
      }
    }
    Figure 5 Testing the model