This project assesses the creditworthiness of 3,000 fictional customers of a lending institution using Naive Bayes and Random Forest. The two models are compared on the same test data through accuracy, precision, recall, the confusion matrix and the ROC curve.
Business Goal
Predict customers at risk of default and compare two models using the confusion matrix and ROC. Application area: Finance. Project level: intermediate.
RapidMiner Tools and Operators
The process is built with these operators:
- Read CSV
- Remap Binominals
- Split Data
- Multiply
- Naive Bayes
- Random Forest
- Apply Model
- Performance (Binominal Classification)
- Performance to Data
- Write CSV
What You Will Learn
- Compare two classification models fairly on the same test data
- Read the confusion matrix, precision and recall in terms of credit decision costs
- Understand AUC and the ROC curve for choosing a credit approval threshold
Working Steps
- Read the customer data — Read CSV loads data_nasabah.csv (3,000 customers, 11 attributes). Set id_nasabah as the id and status_kredit as the binominal label.
- Define the positive class — Remap Binominals makes "macet" (default) the positive class because default risk is what we want to detect.
- Split into training and test data — Split Data with stratified sampling makes a 70% training and 30% test split while keeping the share of defaults equal in both parts.
- Duplicate training and test parts — Two Multiply operators give both models a copy of the training data and both evaluations a copy of the test data so the comparison is fair.
- Train Naive Bayes and Random Forest — Naive Bayes with Laplace correction. Random Forest with 100 trees, gain ratio criterion and maximal depth 10.
- Apply the models to the test data — Apply Model produces a prediction and confidence for every test customer from both models.
- Compute performance — Performance (Binominal Classification) computes accuracy, kappa, AUC, precision, recall and F-measure for each model.



