datanalysis-credit-risk

Cleans credit risk data and screens variables for pre-loan modeling pipelines.

38.5k|4.9k|Updated Jun 11, 2025
One-click install
npx skills add https://github.com/github/awesome-copilot --skill datanalysis-credit-risk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: datanalysis-credit-risk
Source: https://github.com/github/awesome-copilot/tree/main/skills/datanalysis-credit-risk
Command: npx skills add https://github.com/github/awesome-copilot --skill datanalysis-credit-risk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pandas, numpy, toad, openpyxl, lightgbm, scikit-learn, joblib, tqdm, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Raw credit data often contains abnormal periods, high missing rates, low-information variables, unstable distributions, noise features, and high correlations that degrade loan default models. This Skill automates the full data cleaning and variable screening pipeline so analysts can prepare modeling-ready datasets without manual filtering.

Core Features & Use Cases

  • 11-Step Cleaning Pipeline: Covers data loading, organization sample analysis, OOS separation, abnormal month filtering, missing rate calculation, IV/PSI-based variable removal, Null Importance denoising, and high-correlation elimination.
  • Organization-Level Analysis: Computes IV, PSI, and missing rates per organization with multi-process acceleration, distinguishing modeling samples from out-of-sample (OOS) organizations.
  • Excel Report Generation: Exports a complete cleaning report with 15 sheets covering details, statistics, and distributions for every step.
  • Use Case: A risk analyst receives raw multi-organization loan application data and needs to select stable, predictive features before training a scorecard model. Run the pipeline to automatically drop low-IV, high-PSI, and noise variables and receive a full audit report.

Quick Start

Run the example script with python scripts/example.py and follow the interactive prompts to enter your data path, column names, and thresholds.

Frequently Asked Questions about datanalysis-credit-risk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I screen variables for a credit risk model in Python?

Run the example.py script, which executes an 11-step pipeline covering missing rate filtering, IV-based selection via toad binning, PSI stability checks, Null Importance denoising with LightGBM, and high-correlation removal. Each step accepts interactive threshold parameters with defaults.

What is Null Importance and how does it remove noise features?

Null Importance trains LightGBM models on both real and label-permuted data, then compares feature gain values. Features whose real gain is not sufficiently larger than their permuted gain (difference below the gain threshold, default 50) are flagged as noise and dropped.

What data formats does the credit risk pipeline support?

The get_dataset function attempts to read parquet, csv, xlsx, and pkl formats in order. Parquet is recommended for best performance. The data must contain a date column, a binary label column (0/1), an organization column, and primary key columns for deduplication.

How does PSI-based feature filtering work by organization?

PSI is calculated per organization across consecutive months using 10-bin quantile binning with NaN as a separate bin. A feature is dropped when the number of unstable organizations (those exceeding the PSI threshold in too many months) reaches the max_orgs limit, default 6.

Why is my IV calculation returning empty results?

IV calculation uses toad.transform.Combiner with decision-tree binning (5 bins, empty_separate=True). It can fail when features have too few unique values, insufficient samples, or constant values after cleaning. Check that features remain after earlier steps and that the label column contains both 0 and 1.

What are the limitations of this variable screening pipeline?

The pipeline assumes features are prefixed with 'i_' and requires at least 1000 rows for Null Importance. It is designed for binary classification with monthly organization-level data, so it does not handle regression targets, non-tabular data, or real-time scoring scenarios.