SlideShare a Scribd company logo
Creating a Contemporary
Risk Management System
Using Python
Piero Ferrante
C2FO, Director of Data Science
@the_real_pdf
What is C2FO?
● Collaborative Cash Flow Optimization
● World’s first global market for working capital
○ C2FO receives daily invoices from a massive network of buyers and suppliers
○ Buyers with excess cash set a desired rate of return
○ Suppliers can name their rate in terms of discount or APR
○ Payment is accelerated through C2FO markets and both parties win
■ Buyers achieve their desired rate of return
■ Suppliers are awarded at their desired cost of capital
■ C2FO markets finance over $1B invoices/month
What is WFC?
● Water For Commerce
● An investment fund and short-term lending platform for SMBs
● Fund supplier invoices from buyers outside the C2FO network
● Using C2FO’s unique data to prospect and underwrite
○ Over 5 years of daily invoices and adjustments
○ ≈ 200k suppliers from top tier buyers
○ C2FO market bidding data
● Offers favorable yields vs. investments of comparable risk
○ ≈ 40 day duration → 6.25%
B3
B1
B2
Bi
S1
S2
S3
Si
20%
30%
25%
25%
How does WFC compliment C2FO?
“We are a search engine for liquidity”
- Sandy Kemper
SMB lending is hard and crowded, so why bother?
● C2FO is the champion of the supplier
○ We want to help our suppliers succeed financially
● All risk is not created equal
● We believe we can do it better :)
○ Without rate gauging borrowers
○ Without misleading investors
● We have great data
● We have great tools
Great tools make great things possible
Prospecting & Underwriting Onboarding Portfolio Mgmt
Concentration Risk Default Risk Fraud Risk
Unsystem-
atic Risk
Buyer
Diversity
Score
Buyer
Junk
Score
Backtest &
Forecast
Score(s)
45 / 90 / 180d
AR
Score(s)
Bankruptcy
Score
Congruency
Score
NLP Red
Flag
Score
Rate &
Limit
Calculator
Portfolio
Diversifi-
cation
Exposure
Risk
Adjustment
Volatility
Score
Risk Management Overview
Stage Risk Method
Concentration Risk - Measuring diversity
● With a little pandas fu...
● A worse; B better; C best
● More diversity of accounts
receivable is better
● Less concentration with “junk”
buyers (below BBB) is better
A B
C
Prospecting & Underwriting Onboarding Portfolio Mgmt
Concentration Risk Default Risk Fraud Risk
Unsystem-
atic Risk
Buyer
Diversity
Score
Buyer
Junk
Score
Backtest &
Forecast
Score(s)
45 / 90 / 180d
AR
Score(s)
Bankruptcy
Score
Congruency
Score
NLP Red
Flag
Score
Rate &
Limit
Calculator
Portfolio
Diversifi-
cation
Exposure
Risk
Adjustment
Volatility
Score
Risk Management Overview
Stage Risk Method
Default Risk - Forecasting accounts receivable
Problem: I want to build a bunch of forecasts using R, but the rest of my pipeline
is in Python
Solution: Use rpy2 and get the best of both worlds
● Model types
○ ARMA / ARIMA / SARIMA - forecast package
○ Exponential smoothing (e.g. Holt-Winters) - forecast package
○ Bayesian Structural Time Series - bsts package
○ Regression (e.g. OLS, polynomial) - lm function
*Currently evaluating too!
Default Risk - Forecasting accounts receivable
Best model strategy: At least 5 quarters worth of history are required to make a
90 day forecast, which is the maximum loan duration.
Default Risk - Forecasting accounts receivable
Best model strategy: Dozens of models are fit using different time series
transformations and model parameter combinations; the “best model” seeks to
minimize the mean absolute percentage error (MAPE) and root mean squared
error (RMSE) for the last 90 days.
Of course matplotlib and seaborn make even the most customized plots possible.
Default Risk - Forecasting accounts receivable
Default Risk - Understanding seasonal trends
Thanks to statsmodels... seasonal decomposition is a breeze!
Knowing where a supplier is in terms of season is critical. It’s helpful to visually decouple
seasonality from trend to help put the residual in perspective.
Default Risk - Predicting AR discontinuation
Discontinuation is defined by supplier AR dropping to zero with all C2FO buyers.
Challenges:
● Data leakage
○ Do not observe that which would not have been observable at the time of prediction
■ Establish criteria for prediction labels (e.g. supplier’s AR goes to 0 and stays there)
■ Define prediction cutoff (e.g. 45 days in advance of going to 0)
■ Remove all history after the cutoff date
● Engineering features
○ Variables used to model the probability of discontinuation
■ All history (except after the prediction cutoff date)
■ Various historical windows (e.g. 13 weeks leading up to prediction cutoff date)
■ Values observed on the cutoff date
Default Risk - Predicting AR discontinuation
How is this model trained?
● Using scikit-learn for:
○ Feature engineering
■ Encoding categoricals
■ Creating polynomial features
■ Scaling features
■ Dimensionality reduction / feature selection
○ Model evaluation
● Using xgboost for:
○ Training gradient boosted trees (a very performant machine learning classifier)
■ Since GBT are iterative learners, speed is important
○ Used in conjunction with hyperopt for optimizing hyperparameters
■ Currently evaluating spearmint
Default Risk - Predicting AR discontinuation
How is this model evaluated?
● Primarily concerned with model recall
● And not overfitting!
Default Risk - Predicting bankruptcy
Predicting bankruptcy is very different than predicting AR discontinuation:
● Prediction labels are derived differently
● Bankruptcies may not exhibit the same AR signals/patterns
TODO:
● Receive and process daily feeds from the national bankruptcy database
● Undergo a rigorous matching process
● Perform data truncation and feature engineering
● Enrich with macroeconomic data from the right point in time
● Address severe class imbalances
● Train awesome models
Default Risk - Predicting bankruptcy
How to perform efficient company matching on a daily basis?
● Clean your data
○ Convert to lowercase, remove special characters, ...
● Match on *unique* values first
○ Tax IDs & phone numbers
● Use string matching on company names after using soundex to limit the space
○ Levenshtein distance, jaro-winkler distance, jaccard distance, …
○ Use soundexes to reduce the search space
● Calculate geographical distance between known addresses
○ Haversine distance
● Tinker with a weighting strategy that delivers satisfactory results
Pro tip: Cython-ize code (your library might already be doing this for you) or use Numba for
JIT compilation where applicable; it pays off in the long run.
Default Risk - Predicting bankruptcy
Default Risk - Predicting bankruptcy
Default Risk - Predicting bankruptcy
Prospecting & Underwriting Onboarding Portfolio Mgmt
Concentration Risk Default Risk Fraud Risk
Unsystem-
atic Risk
Buyer
Diversity
Score
Buyer
Junk
Score
Backtest &
Forecast
Score(s)
45 / 90 / 180d
AR
Score(s)
Bankruptcy
Score
Congruency
Score
NLP Red
Flag
Score
Rate &
Limit
Calculator
Portfolio
Diversifi-
cation
Exposure
Risk
Adjustment
Volatility
Score
Risk Management Overview
Stage Risk Method
● Use NLP to transcribe and mine calls
● Post transcription, spacy makes
tokenization, lemmatization, etc. fast
● Identify conversations with red flags like:
○ Debt, leverage, bankruptcy, lien, payroll,
extend, broke, divorce, alcohol, rollover, audit,
layoff, credit, Cayman Islands, ...
● This is needed for 10x growth
○ Average WFC audio/day ~90 minutes
Fraud Risk - Screening calls
Fraud Risk - Analyzing invoice congruency
For each Buyer-Supplier relationship, we calculate the following scores:
● Joined Invoice Amount Score:
○ In this equation, Wi
is the invoice amount in WFC, and Ci
is the invoice amount in C2FO
● Unjoined Score:
○ Here Wi
and Ci
reflect the dollar amounts at the invoice due date aggregation level. We also
set (Wi
- Ci
) to be 0 if it is negative. This emphasizes suppliers who have more AP in WFC
than C2FO.
Fraud Risk - Analyzing invoice congruency
Once we have the Buyer-Supplier Scores, we calculate a Supplier level score,
which is a weighted average of their respective Buyer-Supplier Scores.
Finally, we weight each individual score by the amount of AP in WFC, to get to our
final Congruency Score.
Prospecting & Underwriting Onboarding Portfolio Mgmt
Concentration Risk Default Risk Fraud Risk
Unsystem-
atic Risk
Buyer
Diversity
Score
Buyer
Junk
Score
Backtest &
Forecast
Score(s)
45 / 90 / 180d
AR
Score(s)
Bankruptcy
Score
Congruency
Score
NLP Red
Flag
Score
Rate &
Limit
Calculator
Portfolio
Diversifi-
cation
Exposure
Risk
Adjustment
Volatility
Score
Risk Management Overview
Stage Risk Method
Who should we be lending to?
For suppliers that don’t meet some of the forecasting criteria, we can train models to predict
their WFC scores so that we have total score coverage across the supplier pool.
Exposure Risk - Calculating limits and rates
Limits are calculated:
● Based on WFC score decile
● Using loan duration
● So, higher decile → greater % of n day forecast cumulative sum
Rates are calculated:
● By observing suppliers’ rates in C2FO markets
● Adjusting for additional risk when applicable
Who should we continue lending to?
Triggers to monitor:
● Level shifts in AR patterns
○ Losing or gaining a buyer, rapid business growth, unprecedented invoices...
● C2FO bid changes
○ Significant jumps in supplier bidding strategies
● WFC Score changes
○ Seasonal fluctuations in WFC Scores
● Adjustments
○ Unprecedented adjustment counts or amounts relative to invoices
● Buyer reserves
○ Buyers may know something that the rest of us don’t (e.g. bad product or inventory concerns)
Who should we continue lending to?
Monitoring scores over time is important from a fund active management standpoint.
Prospecting & Underwriting Onboarding Portfolio Mgmt
Concentration Risk Default Risk Fraud Risk
Unsystem-
atic Risk
Buyer
Diversity
Score
Buyer
Junk
Score
Backtest &
Forecast
Score(s)
45 / 90 / 180d
AR
Score(s)
Bankruptcy
Score
Congruency
Score
NLP Red
Flag
Score
Rate &
Limit
Calculator
Portfolio
Diversifi-
cation
Exposure
Risk
Adjustment
Volatility
Score
Risk Management Overview
Stage Risk Method
Behind the scenes allstars
● anaconda for managing our Python and R
environments
● luigi for pipeline task orchestration
● dask where doing math lends itself to out-of-core
parallelization
Luigi DAG
Demo time.
Creating a contemporary risk management system using python (dc)
Creating a contemporary risk management system using python (dc)
Creating a contemporary risk management system using python (dc)
Creating a contemporary risk management system using python (dc)
Creating a contemporary risk management system using python (dc)
So what?
● Objectivity gives way to innovation
● Better independent data beats more complex algorithms
● Tradeoffs must be evaluated with respect to constraints
● For many tasks, Python can perform nearly as fast lower level languages
● WFC is a win-win for borrowers and investors
● Creating great solutions with open source tools is part of OSS too
Questions?
@the_real_pdf

More Related Content

PPTX
Migration from Salesforce to Odoo
PPTX
Breaking Down Silos – e-Invoicing Success as Part of a Holistic P2P Process
PDF
Why Companies Need a Bookings Policy, and How to Create One
PDF
Revenue Recognition Policy Best Practices for Increasingly Complex Business M...
PPTX
5 Reasons Why Payables Makes Procurement Awesome
PDF
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
PPTX
AP Fiscal Year-End Close: A 10-Step Checklist
PDF
Procurement process outsourcing how it works
Migration from Salesforce to Odoo
Breaking Down Silos – e-Invoicing Success as Part of a Holistic P2P Process
Why Companies Need a Bookings Policy, and How to Create One
Revenue Recognition Policy Best Practices for Increasingly Complex Business M...
5 Reasons Why Payables Makes Procurement Awesome
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
AP Fiscal Year-End Close: A 10-Step Checklist
Procurement process outsourcing how it works

What's hot (19)

PDF
Supply chain finance
PPT
Revenue Assurance & Fraud Management
PPTX
Odoo Strategy for Mid-market & Corporate
PDF
Internet of Things: How Finance Should Embrace the Coming Flood to Drive Top-...
PPTX
Down Payments on Purchase Orders in Odoo
PPTX
Outgrowing Excel: Why Treasurers Transcend to a TMS
PDF
Telecom Revenue Assurance Workshop
PDF
Supply Chain Finance: Diving into the mechanisms, main benefits and enabling ...
PPTX
SignaPay Insights - Payment Initiatives
PDF
E invoicing
PDF
Sharpening revenue assurance_july 2015
PPTX
Klb group our approach to cost savings programs
PDF
KLB group: Supplier risk management - Gestion du risque fournisseur
PDF
Revenue Assurance in Teleocm
PPT
The future of r av3
PDF
C level revenue assurance
PDF
Aavenir webinar - making legal contracts work for everyone - 28 april 2020
PPTX
SignaPay Insights - Payment Initiatives
PPTX
Source-To-Settle: Why It's Time to Connect the Last Mile
Supply chain finance
Revenue Assurance & Fraud Management
Odoo Strategy for Mid-market & Corporate
Internet of Things: How Finance Should Embrace the Coming Flood to Drive Top-...
Down Payments on Purchase Orders in Odoo
Outgrowing Excel: Why Treasurers Transcend to a TMS
Telecom Revenue Assurance Workshop
Supply Chain Finance: Diving into the mechanisms, main benefits and enabling ...
SignaPay Insights - Payment Initiatives
E invoicing
Sharpening revenue assurance_july 2015
Klb group our approach to cost savings programs
KLB group: Supplier risk management - Gestion du risque fournisseur
Revenue Assurance in Teleocm
The future of r av3
C level revenue assurance
Aavenir webinar - making legal contracts work for everyone - 28 april 2020
SignaPay Insights - Payment Initiatives
Source-To-Settle: Why It's Time to Connect the Last Mile
Ad

Viewers also liked (20)

PPT
The Never-ending Brainstorm
PPT
Building a risk management system that works
PPTX
Fusion 2014: Lessons Learned from Advanced Discount Management
PDF
Stay Connected Calgary Recap | August 24th 2016
PDF
Etude fintech100-2015
PDF
Top global Fintech start-ups 2015-16
PDF
How to Maximize Discount Capture
PPTX
How to Simplify your AP Automation: Live Demo
PPTX
Fusion 2014: Real-Time Communication Between Your ERP System and Your Supplie...
PPTX
How Fortune 500s Generate Millions with ReadSoft and Dynamic Discounting
PDF
Did you know? | Procure-to-Pay Statistics You Should Know
PPTX
Boost your bottom line and supply chain health
PPTX
Wharton FinTech: Overview of FinTech Industry
PDF
The Periodic Table of Supply Chain Finance
PPTX
IoFM: Transform Your Payables into a Revenue Generator
PDF
Scaling up with Cisco Big Data: Data + Science = Data Science
PDF
Executive Forum: Driving the Digital Supply Chain Agenda
KEY
Indexing thousands of writes per second with redis
PPTX
Greenplum- an opensource
PDF
Open Source Framework for Deploying Data Science Models and Cloud Based Appli...
The Never-ending Brainstorm
Building a risk management system that works
Fusion 2014: Lessons Learned from Advanced Discount Management
Stay Connected Calgary Recap | August 24th 2016
Etude fintech100-2015
Top global Fintech start-ups 2015-16
How to Maximize Discount Capture
How to Simplify your AP Automation: Live Demo
Fusion 2014: Real-Time Communication Between Your ERP System and Your Supplie...
How Fortune 500s Generate Millions with ReadSoft and Dynamic Discounting
Did you know? | Procure-to-Pay Statistics You Should Know
Boost your bottom line and supply chain health
Wharton FinTech: Overview of FinTech Industry
The Periodic Table of Supply Chain Finance
IoFM: Transform Your Payables into a Revenue Generator
Scaling up with Cisco Big Data: Data + Science = Data Science
Executive Forum: Driving the Digital Supply Chain Agenda
Indexing thousands of writes per second with redis
Greenplum- an opensource
Open Source Framework for Deploying Data Science Models and Cloud Based Appli...
Ad

Similar to Creating a contemporary risk management system using python (dc) (20)

PPTX
capital management and stress test
PPTX
Case studies to engage
PDF
CRIF IFRS9 Solution- Not just for your CFO
PDF
Credit Risk Analytics
PPTX
The Power of Predictive Analytics in Reducing Bad Debt
PPT
SFR Bank Presentation
PPTX
Augusto carvalho gestión de riesgo de crédito en portafolio - final edition...
PPT
Credit risk with neural networks bankruptcy prediction machine learning
DOC
John_Lazcano_2016 (BHC)
PPTX
Gaming the Odds and Gaining Competitive Advantage with Automated Onboarding
PPTX
Transform Your Credit and Collections with Predictive Analytics
 
PPTX
Credit Risk Model Building Steps
PPTX
Bridging marke- credit risk-Modelling the Incremental Risk Charge.pptx
PPTX
ai it hw mst prac[1] - Read-Offnly.pptx
PPTX
Credit Risk Evaluation Model
PPTX
Using a Survival Regression to Evaluate.pptx
PPTX
CRM Training.pptx
PPTX
Moody's ---How Social Performance Impacts Financial Resilience and Default Pr...
PPT
200922440738781.ppt
PPTX
AI_in_Finance ppt about the importance of AI in finance
capital management and stress test
Case studies to engage
CRIF IFRS9 Solution- Not just for your CFO
Credit Risk Analytics
The Power of Predictive Analytics in Reducing Bad Debt
SFR Bank Presentation
Augusto carvalho gestión de riesgo de crédito en portafolio - final edition...
Credit risk with neural networks bankruptcy prediction machine learning
John_Lazcano_2016 (BHC)
Gaming the Odds and Gaining Competitive Advantage with Automated Onboarding
Transform Your Credit and Collections with Predictive Analytics
 
Credit Risk Model Building Steps
Bridging marke- credit risk-Modelling the Incremental Risk Charge.pptx
ai it hw mst prac[1] - Read-Offnly.pptx
Credit Risk Evaluation Model
Using a Survival Regression to Evaluate.pptx
CRM Training.pptx
Moody's ---How Social Performance Impacts Financial Resilience and Default Pr...
200922440738781.ppt
AI_in_Finance ppt about the importance of AI in finance

Recently uploaded (20)

PPT
Predictive modeling basics in data cleaning process
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PDF
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
Business Analytics and business intelligence.pdf
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PDF
.pdf is not working space design for the following data for the following dat...
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
STUDY DESIGN details- Lt Col Maksud (21).pptx
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PPTX
Introduction to Knowledge Engineering Part 1
PPTX
climate analysis of Dhaka ,Banglades.pptx
PDF
Clinical guidelines as a resource for EBP(1).pdf
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PDF
Mega Projects Data Mega Projects Data
PPT
Quality review (1)_presentation of this 21
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
Predictive modeling basics in data cleaning process
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Business Analytics and business intelligence.pdf
oil_refinery_comprehensive_20250804084928 (1).pptx
Miokarditis (Inflamasi pada Otot Jantung)
.pdf is not working space design for the following data for the following dat...
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
STUDY DESIGN details- Lt Col Maksud (21).pptx
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
Acceptance and paychological effects of mandatory extra coach I classes.pptx
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Introduction to Knowledge Engineering Part 1
climate analysis of Dhaka ,Banglades.pptx
Clinical guidelines as a resource for EBP(1).pdf
Galatica Smart Energy Infrastructure Startup Pitch Deck
Mega Projects Data Mega Projects Data
Quality review (1)_presentation of this 21
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx

Creating a contemporary risk management system using python (dc)

  • 1. Creating a Contemporary Risk Management System Using Python Piero Ferrante C2FO, Director of Data Science @the_real_pdf
  • 2. What is C2FO? ● Collaborative Cash Flow Optimization ● World’s first global market for working capital ○ C2FO receives daily invoices from a massive network of buyers and suppliers ○ Buyers with excess cash set a desired rate of return ○ Suppliers can name their rate in terms of discount or APR ○ Payment is accelerated through C2FO markets and both parties win ■ Buyers achieve their desired rate of return ■ Suppliers are awarded at their desired cost of capital ■ C2FO markets finance over $1B invoices/month
  • 3. What is WFC? ● Water For Commerce ● An investment fund and short-term lending platform for SMBs ● Fund supplier invoices from buyers outside the C2FO network ● Using C2FO’s unique data to prospect and underwrite ○ Over 5 years of daily invoices and adjustments ○ ≈ 200k suppliers from top tier buyers ○ C2FO market bidding data ● Offers favorable yields vs. investments of comparable risk ○ ≈ 40 day duration → 6.25%
  • 4. B3 B1 B2 Bi S1 S2 S3 Si 20% 30% 25% 25% How does WFC compliment C2FO? “We are a search engine for liquidity” - Sandy Kemper
  • 5. SMB lending is hard and crowded, so why bother? ● C2FO is the champion of the supplier ○ We want to help our suppliers succeed financially ● All risk is not created equal ● We believe we can do it better :) ○ Without rate gauging borrowers ○ Without misleading investors ● We have great data ● We have great tools
  • 6. Great tools make great things possible
  • 7. Prospecting & Underwriting Onboarding Portfolio Mgmt Concentration Risk Default Risk Fraud Risk Unsystem- atic Risk Buyer Diversity Score Buyer Junk Score Backtest & Forecast Score(s) 45 / 90 / 180d AR Score(s) Bankruptcy Score Congruency Score NLP Red Flag Score Rate & Limit Calculator Portfolio Diversifi- cation Exposure Risk Adjustment Volatility Score Risk Management Overview Stage Risk Method
  • 8. Concentration Risk - Measuring diversity ● With a little pandas fu... ● A worse; B better; C best ● More diversity of accounts receivable is better ● Less concentration with “junk” buyers (below BBB) is better A B C
  • 9. Prospecting & Underwriting Onboarding Portfolio Mgmt Concentration Risk Default Risk Fraud Risk Unsystem- atic Risk Buyer Diversity Score Buyer Junk Score Backtest & Forecast Score(s) 45 / 90 / 180d AR Score(s) Bankruptcy Score Congruency Score NLP Red Flag Score Rate & Limit Calculator Portfolio Diversifi- cation Exposure Risk Adjustment Volatility Score Risk Management Overview Stage Risk Method
  • 10. Default Risk - Forecasting accounts receivable Problem: I want to build a bunch of forecasts using R, but the rest of my pipeline is in Python Solution: Use rpy2 and get the best of both worlds ● Model types ○ ARMA / ARIMA / SARIMA - forecast package ○ Exponential smoothing (e.g. Holt-Winters) - forecast package ○ Bayesian Structural Time Series - bsts package ○ Regression (e.g. OLS, polynomial) - lm function *Currently evaluating too!
  • 11. Default Risk - Forecasting accounts receivable Best model strategy: At least 5 quarters worth of history are required to make a 90 day forecast, which is the maximum loan duration.
  • 12. Default Risk - Forecasting accounts receivable Best model strategy: Dozens of models are fit using different time series transformations and model parameter combinations; the “best model” seeks to minimize the mean absolute percentage error (MAPE) and root mean squared error (RMSE) for the last 90 days.
  • 13. Of course matplotlib and seaborn make even the most customized plots possible. Default Risk - Forecasting accounts receivable
  • 14. Default Risk - Understanding seasonal trends Thanks to statsmodels... seasonal decomposition is a breeze! Knowing where a supplier is in terms of season is critical. It’s helpful to visually decouple seasonality from trend to help put the residual in perspective.
  • 15. Default Risk - Predicting AR discontinuation Discontinuation is defined by supplier AR dropping to zero with all C2FO buyers. Challenges: ● Data leakage ○ Do not observe that which would not have been observable at the time of prediction ■ Establish criteria for prediction labels (e.g. supplier’s AR goes to 0 and stays there) ■ Define prediction cutoff (e.g. 45 days in advance of going to 0) ■ Remove all history after the cutoff date ● Engineering features ○ Variables used to model the probability of discontinuation ■ All history (except after the prediction cutoff date) ■ Various historical windows (e.g. 13 weeks leading up to prediction cutoff date) ■ Values observed on the cutoff date
  • 16. Default Risk - Predicting AR discontinuation How is this model trained? ● Using scikit-learn for: ○ Feature engineering ■ Encoding categoricals ■ Creating polynomial features ■ Scaling features ■ Dimensionality reduction / feature selection ○ Model evaluation ● Using xgboost for: ○ Training gradient boosted trees (a very performant machine learning classifier) ■ Since GBT are iterative learners, speed is important ○ Used in conjunction with hyperopt for optimizing hyperparameters ■ Currently evaluating spearmint
  • 17. Default Risk - Predicting AR discontinuation How is this model evaluated? ● Primarily concerned with model recall ● And not overfitting!
  • 18. Default Risk - Predicting bankruptcy Predicting bankruptcy is very different than predicting AR discontinuation: ● Prediction labels are derived differently ● Bankruptcies may not exhibit the same AR signals/patterns TODO: ● Receive and process daily feeds from the national bankruptcy database ● Undergo a rigorous matching process ● Perform data truncation and feature engineering ● Enrich with macroeconomic data from the right point in time ● Address severe class imbalances ● Train awesome models
  • 19. Default Risk - Predicting bankruptcy How to perform efficient company matching on a daily basis? ● Clean your data ○ Convert to lowercase, remove special characters, ... ● Match on *unique* values first ○ Tax IDs & phone numbers ● Use string matching on company names after using soundex to limit the space ○ Levenshtein distance, jaro-winkler distance, jaccard distance, … ○ Use soundexes to reduce the search space ● Calculate geographical distance between known addresses ○ Haversine distance ● Tinker with a weighting strategy that delivers satisfactory results Pro tip: Cython-ize code (your library might already be doing this for you) or use Numba for JIT compilation where applicable; it pays off in the long run.
  • 20. Default Risk - Predicting bankruptcy
  • 21. Default Risk - Predicting bankruptcy
  • 22. Default Risk - Predicting bankruptcy
  • 23. Prospecting & Underwriting Onboarding Portfolio Mgmt Concentration Risk Default Risk Fraud Risk Unsystem- atic Risk Buyer Diversity Score Buyer Junk Score Backtest & Forecast Score(s) 45 / 90 / 180d AR Score(s) Bankruptcy Score Congruency Score NLP Red Flag Score Rate & Limit Calculator Portfolio Diversifi- cation Exposure Risk Adjustment Volatility Score Risk Management Overview Stage Risk Method
  • 24. ● Use NLP to transcribe and mine calls ● Post transcription, spacy makes tokenization, lemmatization, etc. fast ● Identify conversations with red flags like: ○ Debt, leverage, bankruptcy, lien, payroll, extend, broke, divorce, alcohol, rollover, audit, layoff, credit, Cayman Islands, ... ● This is needed for 10x growth ○ Average WFC audio/day ~90 minutes Fraud Risk - Screening calls
  • 25. Fraud Risk - Analyzing invoice congruency For each Buyer-Supplier relationship, we calculate the following scores: ● Joined Invoice Amount Score: ○ In this equation, Wi is the invoice amount in WFC, and Ci is the invoice amount in C2FO ● Unjoined Score: ○ Here Wi and Ci reflect the dollar amounts at the invoice due date aggregation level. We also set (Wi - Ci ) to be 0 if it is negative. This emphasizes suppliers who have more AP in WFC than C2FO.
  • 26. Fraud Risk - Analyzing invoice congruency Once we have the Buyer-Supplier Scores, we calculate a Supplier level score, which is a weighted average of their respective Buyer-Supplier Scores. Finally, we weight each individual score by the amount of AP in WFC, to get to our final Congruency Score.
  • 27. Prospecting & Underwriting Onboarding Portfolio Mgmt Concentration Risk Default Risk Fraud Risk Unsystem- atic Risk Buyer Diversity Score Buyer Junk Score Backtest & Forecast Score(s) 45 / 90 / 180d AR Score(s) Bankruptcy Score Congruency Score NLP Red Flag Score Rate & Limit Calculator Portfolio Diversifi- cation Exposure Risk Adjustment Volatility Score Risk Management Overview Stage Risk Method
  • 28. Who should we be lending to? For suppliers that don’t meet some of the forecasting criteria, we can train models to predict their WFC scores so that we have total score coverage across the supplier pool.
  • 29. Exposure Risk - Calculating limits and rates Limits are calculated: ● Based on WFC score decile ● Using loan duration ● So, higher decile → greater % of n day forecast cumulative sum Rates are calculated: ● By observing suppliers’ rates in C2FO markets ● Adjusting for additional risk when applicable
  • 30. Who should we continue lending to? Triggers to monitor: ● Level shifts in AR patterns ○ Losing or gaining a buyer, rapid business growth, unprecedented invoices... ● C2FO bid changes ○ Significant jumps in supplier bidding strategies ● WFC Score changes ○ Seasonal fluctuations in WFC Scores ● Adjustments ○ Unprecedented adjustment counts or amounts relative to invoices ● Buyer reserves ○ Buyers may know something that the rest of us don’t (e.g. bad product or inventory concerns)
  • 31. Who should we continue lending to? Monitoring scores over time is important from a fund active management standpoint.
  • 32. Prospecting & Underwriting Onboarding Portfolio Mgmt Concentration Risk Default Risk Fraud Risk Unsystem- atic Risk Buyer Diversity Score Buyer Junk Score Backtest & Forecast Score(s) 45 / 90 / 180d AR Score(s) Bankruptcy Score Congruency Score NLP Red Flag Score Rate & Limit Calculator Portfolio Diversifi- cation Exposure Risk Adjustment Volatility Score Risk Management Overview Stage Risk Method
  • 33. Behind the scenes allstars ● anaconda for managing our Python and R environments ● luigi for pipeline task orchestration ● dask where doing math lends itself to out-of-core parallelization Luigi DAG
  • 40. So what? ● Objectivity gives way to innovation ● Better independent data beats more complex algorithms ● Tradeoffs must be evaluated with respect to constraints ● For many tasks, Python can perform nearly as fast lower level languages ● WFC is a win-win for borrowers and investors ● Creating great solutions with open source tools is part of OSS too