Credit risk data cleaning and variable screening pipeline for pre-loan modeling. Use when working with raw credit data that needs quality assessment, missing value analysis, or variable selection before modeling. it covers data loading and formatting, abnormal period filtering, missing rate calculation, high-missing variable removal,low-IV variable filtering, high-PSI variable removal, Null Importance denoising, high-correlation variable removal, and cleaning report generation. Applicable scenarios arecredit risk data cleaning, variable screening, pre-loan modeling preprocessing.
Start a fresh conversation. Replace the highlighted placeholders.
Use datanalysis-credit-risk to clean and screen [raw credit-risk dataset] for pre-loan modeling, then produce the Excel report covering missingness, IV, PSI, null importance, and correlation removals.
Required inputs
[raw credit-risk dataset]
User-approved starter prompt based on a pinned source version; check current skill requirements before running. Task evidence ↗
SKILL.md
name: datanalysis-credit-riskdescription: Credit risk data cleaning and variable screening pipeline for pre-loan modeling. Use when working with raw credit data that needs quality assessment, missing value analysis, or variable selection before modeling. it covers data loading and formatting, abnormal period filtering, missing rate calculation, high-missing variable removal,low-IV variable filtering, high-PSI variable removal, Null Importance denoising, high-correlation variable removal, and cleaning report generation. Applicable scenarios arecredit risk data cleaning, variable screening, pre-loan modeling preprocessing.
Data Cleaning and Variable Screening
Quick Start
# Run the complete data cleaning pipeline
python ".github/skills/datanalysis-credit-risk/scripts/example.py"
Complete Process Description
The data cleaning pipeline consists of the following 11 steps, each executed independently without deleting the original data:
Get Data - Load and format raw data
Organization Sample Analysis - Statistics of sample count and bad sample rate for each organization
Separate OOS Data - Separate out-of-sample (OOS) samples from modeling samples
Filter Abnormal Months - Remove months with insufficient bad sample count or total sample count
Calculate Missing Rate - Calculate overall and organization-level missing rates for each feature
Drop High Missing Rate Features - Remove features with overall missing rate exceeding threshold
Drop Low IV Features - Remove features with overall IV too low or IV too low in too many organizations
Drop High PSI Features - Remove features with unstable PSI
Null Importance Denoising - Remove noise features using label permutation method
Drop High Correlation Features - Remove high correlation features based on original gain
Export Report - Generate Excel report containing details and statistics of all steps
Core Functions
Function
Purpose
Module
get_dataset()
Load and format data
references.func
org_analysis()
Organization sample analysis
references.func
missing_check()
Calculate missing rate
references.func
drop_abnormal_ym()
Filter abnormal months
references.analysis
drop_highmiss_features()
Drop high missing rate features
references.analysis
drop_lowiv_features()
Drop low IV features
references.analysis
drop_highpsi_features()
Drop high PSI features
references.analysis
drop_highnoise_features()
Null Importance denoising
references.analysis
drop_highcorr_features()
Drop high correlation features
references.analysis
iv_distribution_by_org()
IV distribution statistics
references.analysis
psi_distribution_by_org()
PSI distribution statistics
references.analysis
value_ratio_distribution_by_org()
Value ratio distribution statistics
references.analysis
export_cleaning_report()
Export cleaning report
references.analysis
Parameter Description
Data Loading Parameters
DATA_PATH: Data file path (best are parquet format)
DATE_COL: Date column name
Y_COL: Label column name
ORG_COL: Organization column name
KEY_COLS: Primary key column name list
OOS Organization Configuration
OOS_ORGS: Out-of-sample organization list
Abnormal Month Filtering Parameters
min_ym_bad_sample: Minimum bad sample count per month (default 10)
min_ym_sample: Minimum total sample count per month (default 500)