Alibaba Cloud Machine Learning Platform for AI: Using Regression Algorithm to Predict Agriculture Loan Issuing

By Garvin Li

Note: The data in this article is fictitious and is only used for experimental purposes.

Issuing agriculture loans is a typical data mining case. Lenders use an experience model built based on statistics of past years (including a borrower’s yearly income, types of planted crops, loan history, and other factors) to predict that borrower’s repayment ability.

This document is based on agriculture loan scenarios and shows you how to use a linear regression algorithm to handle loan issuing business.

Linear regression is a widely applicable statistics analysis method used in statistics to determine the quantitative relation that two or more variables depend on. This article predicts whether to issue requested loan amounts to users in the prediction set by analyzing the issuing history information of agriculture loans. We will be performing all our data analysis on the Alibaba Cloud Machine Learning platform.

Dataset Introduction

The specific fields are as follows:

Image for post

The following is a screenshot of the data.

Image for post

Data Exploration Procedure

The following diagram shows the experiment process.

Image for post

1. Data Source Preparation

Input data is divided into two parts:

  1. Loan training set: Over 200 pieces of loan data are used to train the regression model. This training set includes features such as “farmsize” and “rainfall”. “claimvalue” is the recovered loan amount.
  2. Loan prediction set: This prediction set includes a total of 71 loan applicants this year. “claimvalue” is a farmer’s requested loan amount.

Predicate whom of the 71 applicants will receive loans based on the existing 200+ pieces of history data.

2. Data Pre-Processing

Map data of string type to numbers according to data meanings. For example, for the “region” field, map “north”, “middle”, and “south”in order to 0, 1, and 2 respectively, then convert the field to the double type by using the type conversion component, as shown in the following diagram. You can perform model training after data is pre-processed.

Image for post

3. Model Training and Prediction

Use linear regression components to train history data and generate a regression model, which is used in the prediction component to predict data in the prediction set. Use the column merge component to merge user ID, prediction score and claim value, as shown in the following screenshot.

The prediction score indicates a user’s loan repayment ability (expected loan repayment amount).

Image for post

4. Regression Model Evaluation

Use the regression model evaluation component to evaluate the model. The following table describes evaluation results.

Image for post

5. Loan Issuance

Use filtering and mapping components to determine applicants that can receive loans. The principle of the experiment is that, if an applicant’s repayment ability is predicated to be greater than the requested loan amount, that applicant will receive a loan. This principle applies to each potential customer.

Image for post

To learn more about Alibaba Cloud Machine Learning Platform for Artificial Intelligence (PAI), visit


Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store