tencent cloud

Feedback

Example: Deep Learning

Last updated: 2024-01-13 11:19:29

    Getting Started

    This document describes how to write a multilayer perceptron (MLP) BP algorithm based on a Scikit-learn machine learning library to predict the probability of winning and losing between two football teams by modeling historical international football matches, team rankings, physical and skill metrics of players, and the FIFA 2018 group match results. Below are the detailed directions.

    Step 1. Creating a custom image

    1. Create a custom image. For more information, see Creating a Custom Image.
    2. Install the dependency package. Take CentOS 7.2 64-bit as an example.
    yum -y install gcc
    yum -y install python-devel
    yum -y install tkinter
    yum -y install python-pip
    pip install --upgrade pip
    pip install pandas
    pip install numpy
    pip install matplotlib
    pip install seaborn
    pip install sklearn
    pip install --upgrade python-dateutil

    Step 2. Downloading the application package

    Click here to download the application package, and upload it to COS. After you specify the COS endpoint of the package, BatchCompute downloads the package to a CVM instance before a job starts, and automatically decompresses and executes the package.

    Step 3. Creating a task template named fifa-predict

    1. Log in to the BatchCompute console. In the left sidebar, click Task Template.
    2. Select a target region at the top of the Task Template page.
    3. Click Create. On the New task template page, create a template, as shown below:
    
    Name: Enter fifa-predict.
    Description: Enter Data training and prediction.
    Compute environment type: Select a compute environment as needed. Auto compute environment is selected in this example.
    Resource configuration: Select **S2.SMALL1 (1-core, 1 GB)**. Public network bandwidth is charged on a pay-as-you-go basis.
    Image:Select the custom image identifier from the image created in Step 1. The output content is in markdown format.
    Resource quantity: Enter the number of concurrent rendering instances. Example: 3, which means to train 3 neural network models concurrently.
    Timeout threshold and Number of retry attempts: Keep the default values.
    4. Click Next. Configure application information, as shown below:
    
    Execution method: Select Package.
    Package address: Example: cos://barrygz-1251783334.cosgz.myqcloud.com/fifa/fifa.2018.tar.gz.
    Stdout log: For more information about the format, see Entering COS & CFS Paths.
    Stderr log: The same as above.
    Command line: Enter python predict.py "Japan" "Senegal". Team list: 'Saudi Arabia', 'Egypt', 'Uruguay', 'Portugal', 'Spain', 'Morocco', 'Iran', 'France', 'Australia', 'Peru', 'Denmark', 'Argentina', 'Iceland', 'Croatia', 'Nigeria', 'Brazil', 'Switzerland', 'Costa Rica', 'Serbia', 'Germany', 'Mexico', 'Sweden', 'Korea Republic', 'Belgium', 'Panama', 'Tunisia', 'England', 'Poland', 'Senegal', 'Colombia', 'Japan'.
    5. Skip the storage mapping configuration step and click Next.
    6. Preview the JSON file of the task, and click Save after confirmation.

    Step 4. Creating a task template named fifa-merge

    1. Log in to the BatchCompute console. In the left sidebar, click Task Template.
    2. Select a target region at the top of the Task Template page.
    3. Click Create. On the "New task template" page, create a template, as shown below:
    
    Name: Enter fifa-merge.
    Description: Enter Aggregation of prediction data.
    Compute environment type: Select a compute environment as needed. Auto compute environment is selected in this example.
    Resource configuration: Select S2.SMALL1 (1-core, 1 GB). Public network bandwidth is charged on a pay-as-you-go basis.
    Image: Enter a custom image identifier. Use the image created in Step 1.
    Resource quantity: 1.
    Timeout threshold and Number of retry attempts: Keep the default values.
    4. Click Next. Configure application information, as shown below:
    
    Execution method: Select Package.
    Package address: Example: cos://barrygz-1251783334.cosgz.myqcloud.com/fifa/fifa.2018.tar.gz.
    Stdout log: For more information about the format, see Entering COS & CFS Paths.
    Stderr log: The same as above.
    Command line: Enter python merge.py /data.
    5. Click Next. Configure the storage mapping, as shown below:
    
    COS/CFS path under Input path mapping: Enter the Stdout log path of the fifa-predict template.
    Local path under Input path mapping: Enter /data.
    6. Preview the JSON file of the task, and click Save after confirmation.

    Step 5. Submitting a job

    1. In the left sidebar, click Jobs to go to the Jobs page.
    2. Select a target region at the top of the Jobs page and click Create.
    3. On the New job page, configure job information, as shown below:
    Job name: Enter fifa.
    Priority: Keep the default value.
    Description: Enter fifa 2018 model.
    4. On the left side of the Task flow page, find the fifa-predict and fifa-merge tasks and drag them to the canvas on the right. Click the fifa-predict task anchor and drag it to the fifa-merge task.
    
    5. Confirm the configurations in the task details area on the right side of the Task flow page and click Completed.
    6. For more information about how to query job running information, see Information Query.
    
    7. For more information about how to query rendering results, see Viewing Object Information.
    

    Subsequent Operations

    This document illustrates a simple machine learning job to demonstrate basic BatchCompute capabilities. You can continue to test the advanced capabilities of BatchCompute as instructed in the Console User Guide.
    Various CVM configurations: BatchCompute provides a variety of CVM configuration options. You can customize your own CVM configuration based on your business scenario.
    Remote storage mapping: BatchCompute optimizes storage access and simplifies access to remote storage services into operations in the local file system.
    Parallel training of multiple models: With BatchCompute, you can specify the number of concurrent instances and use environment variables to differentiate instances. Each instance reads different training data to achieve parallel modeling.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support