Skip to content

private-credit

Deep Generative Models for Private Credit SPV Analytics

View on GitHub


Information

Property Value
Language Python
Stars 0
Forks 0
Watchers 0
Open Issues 0
License MIT License
Created 2026-01-14
Last Updated 2026-03-25
Last Push 2026-01-15
Contributors 1
Default Branch main
Visibility private

Notebooks

This repository contains 8 notebook(s):

Notebook Language Type

| 01_data_exploration | PYTHON | jupyter |

| 02_macro_vae_training | PYTHON | jupyter |

| 03_transition_analysis | PYTHON | jupyter |

| 04_loan_trajectories | PYTHON | jupyter |

| 05_portfolio_simulation | PYTHON | jupyter |

| 06_stress_testing | PYTHON | jupyter |

| 07_calibration | PYTHON | jupyter |

| 08_model_comparison | PYTHON | jupyter |

Datasets

This repository includes 5 dataset(s):

Dataset Format Size

| feature_dictionary.csv | .csv | 5.16 KB |

| data | | 0.0 KB |

| init.py | .py | 0.49 KB |

| simulate_loans.py | .py | 26.43 KB |

| simulate_macro.py | .py | 17.65 KB |

Reproducibility

No specific reproducibility files found.

Status

  • Issues: Enabled
  • Wiki: Enabled
  • Pages: Enabled

README

Private Credit

Tests Documentation Python License: MIT

Deep Generative Models for Private Credit SPV Analytics

A hierarchical framework for loan-level trajectory simulation, portfolio loss estimation, and tranche-level cashflow projections.

Features

  • Macro VAE: Conditional variational autoencoder for macroeconomic scenario generation
  • Transition Transformer: Cohort-level transition probability prediction
  • Loan Trajectory Model: Autoregressive transformer with diffusion head for individual loan paths
  • Portfolio Aggregator: Differentiable waterfall simulation for tranche-level analytics

Installation

pip install privatecredit

Or install from source:

git clone https://github.com/Digital-AI-Finance/private-credit.git
cd private-credit
pip install -e .

Quick Start

from privatecredit.data import LoanTapeGenerator, MacroScenarioGenerator
from privatecredit.models import MacroVAE, PortfolioAggregator

# Generate synthetic loan portfolio
generator = LoanTapeGenerator(n_loans=10000, n_months=60)
loans_df, panel_df = generator.generate()

# Generate macro scenarios
macro_gen = MacroScenarioGenerator(n_months=60)
baseline = macro_gen.generate_scenario('baseline')
adverse = macro_gen.generate_scenario('adverse')

# Run portfolio simulation
aggregator = PortfolioAggregator(waterfall_config)
results = aggregator.monte_carlo_simulate(
    loans_df=loans_df,
    n_simulations=10000
)

print(f"Expected Loss: {results.expected_loss:.2%}")
print(f"VaR 99%: {results.var_99:.2%}")

Architecture

Level 1: MACRO SCENARIO GENERATOR (Conditional VAE)
    |
    v
Level 2: TRANSITION TRANSFORMER (Cross-attention on macro)
    |
    v
Level 3: LOAN TRAJECTORY MODEL (AR Transformer + Diffusion)
    |
    v
Level 4: PORTFOLIO AGGREGATOR (Differentiable Waterfall)

Documentation

Full documentation: https://digital-ai-finance.github.io/private-credit/

Asset Classes

The framework supports four asset classes:

Asset Class Examples
Corporate Term loans, revolvers, leveraged loans
Consumer Auto loans, personal loans, credit cards
Real Estate Commercial mortgages, residential loans
Receivables Trade receivables, invoice financing

Citation

@software{privatecredit2026,
  title = {Private Credit: Deep Generative Models for SPV Analytics},
  author = {Digital Finance Research},
  year = {2026},
  url = {https://github.com/Digital-AI-Finance/private-credit}
}

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.