Skip navigation

Loan Credit Risk with SQL Server

By using SQL Server 2016 with R Services, a lending institution can make use of predictive analytics to reduce the number of loans they offer to those borrowers most likely to default, thereby increasing the profitability of their loan portfolio.

Description

Note: If you have already deployed this solution, click here to view your deployment.

Estimated provisioning time: 20 minutes

STOP before you proceed You need to accept the Terms of Use of the Data Science Virtual Machine on your Azure Subscription before you deploy this VM for the first time by clicking here.

Overview

If we had a crystal ball, we would only lend money to someone who we knew would pay us back. A lending institution can make use of predictive analytics to reduce the number of loans they offer to those borrowers most likely to default, thereby increasing the profitability of their loan portfolio. This solution uses simulated data for a small personal loan financial institution, building a model to help predict whether a borrower will default on a loan.

Business Perspective

The business user uses the predicted scores to help determine whether or not to grant a loan. They fine-tune their prediction by using the PowerBI Dashboard to see the number of loans and the total cost saved under different scenarios. The dashboard includes a filter based on percentiles of the predicted scores. When all the values are selected, they view all the loans in the testing sample, and can inspect information about how many of them defaulted. Then, by checking just the top percentile (100), they drill down to information about loans with a predicted score in the top 1%. Checking multiple continuous boxes allows them to find a cut-off point they are comfortable with to use as a future loan acceptance criterion.

Use the “Try It Now” button below to view the PowerBI Dashboard.

Data Scientist Perspective

SQL Server R Services brings the compute to the data by running R on the computer that hosts the database. It includes a database service that runs outside the SQL Server process and communicates securely with the R runtime.

This solution walks through the steps to create and refine data, train R models and perform scoring on the SQL Server machine. The final scored database table in SQL Server gives a predicted score for each potential borrower. This data is then visualised in PowerBI.

Data scientists who are testing and developing solutions can work from the convenience of their R IDE on their client machine, while pushing the compute to the SQL Server machine. The completed solutions are deployed to SQL Server 2016 by embedding calls to R in stored procedures. These solutions can then be further automated with SQL Server Integration Services and SQL Server agent.

Use the “Deploy” button below to create a Virtual Machine that includes the data, R code, SQL code and an SQL Server 2016 database (Loans) containing the full solution.

Pricing

Your Azure subscription used for the deployment will incur consumption charges on the services used in this solution, approximately $1.15/hour for the default VM.

Please ensure that you stop your VM instance when not actively using the solution. Running the VM will incur higher costs.

Please delete the solution if you are not using it.

Disclaimer

©2017 Microsoft Corporation. All rights reserved. This information is provided “as is” and may change without notice. Microsoft makes no warranties, express or implied, with respect to the information provided here. Third-party data was used to generate the solution. You are responsible for respecting the rights of others, including procuring and complying with relevant licences in order to create similar datasets.

Related solution architectures

Loan ChargeOff Prediction with SQL Servercha

This solution demonstrates how to build and deploy a machine learning model with SQL Server 2016 with R Services to predict whether a bank loan will need to be charged off within the next three months