1. Home
  2. Sample Projects
  3. Determine Loan Interest Rate

Determine Loan Interest Rate

◷ Reading Time: 5 minutes

This sample determines the interest rate of an application using the applicant’s personal and account data. We will also be using a built-in, machine-learning algorithm to predict the payment delays and determine the final interest rate based on the predicted delays.

Running the Sample

Create the database using the given database script (database_script.sql) and change the database ConnectionString in the document, Main.xml.

1. Open Main.xml in FlexRule Designer.

2. Click on Logic Run Template.

3. Select a template from the list

4. Click on Debug.

5. Click on Next Step continuously, until the project is executed successfully. You will be able to see the project run, step-by-step.

6. After the project executes successfully, the  Parameters Window will display the recommendation

Project Description

Main model

The main model is the high-level model that connects different components of the project. It connects the validation, input, and decision-making components of the complete solution sequentially.

  1. Validate Applicant Input:  The first step validates the user id, by retrieving the applicant’s input data.
  2. Retrieve Personal and Account Data: Based on the user ID inputted, the user’s personal and account data are retrieved.
  3. Determine Interest Rate: Using a built-in machine learning algorithm, the interest rate is determined.

Decision model

The decision graph automatically resolves the dependencies between logic implementations. That means this Decision Requirement Diagram knows that to determine repayment risk score, and interest rate, it requires predicting repayment delay. Therefore, it goes through each node according to its decision hierarchy.

Predictive Model

We will be using a dataset of previous customers to predict the delay of a given applicant. We use the C45 algorithm which is a built-in algorithm in Analytics Extension to create the predictive model.

The model predicts whether a customer will delay payments and by how many months, by using previous customer data as well as the borrowing amount.


This is a snippet of the dataset used. We have only used the following attributes from the original dataset.

Decision Tables

Decision tables were used to define the business rules.

Once the payment delay is predicted from the predictive model, a repayment risk score is assigned to the applicant
According to the repayment risk score, years of membership, and the applicant’s account balance, the interest rate is determined

Applicant Concept

Attributes of the applicant are modeled as a Fact Concept. You can also define the validation rules such as User ID cannot be null or empty.

Business glossary

We will define the business terms in a business glossary in order to make the concepts easy to understand and we map our fact concept in a way that is easily human-readable.

Business Formulas

Define the expressions we use in the project which can later be easily reused across multiple documents.

Download the project

Use the attachment at the end of the page to download the sample project.

Updated on December 7, 2023

Article Attachments

Was this article helpful?

Related Articles