---
icon: seal-exclamation
description: >-
Chapter 7 and Chapter 11 bankruptcy predictions made easy for over 13,000 US
publicly traded stocks.
---
# Bankruptcy Predictions
> **Data Notice**: This dataset provides academic research access with a 6-month data lag.
> For real-time data access, please visit [sov.ai](https://sov.ai) to subscribe.
> For market insights and additional subscription options, check out our newsletter at [blog.sov.ai](https://blog.sov.ai).
```python
from datasets import load_dataset
df_bankrupt = load_dataset("sovai/bankruptcy", split="train").to_pandas().set_index(["ticker","date"])
```
Monthly corporate bankruptcy predictions arrive the **2nd of every month**_._
`Tutorials` are the best documentation — [`Corporate Bankruptcy Tutorial`](https://colab.research.google.com/github/sovai-research/sovai-public/blob/main/notebooks/datasets/Bankruptcy%20Prediction.ipynb)
## Description
The model predicts the likelihood of bankruptcies in the next 6-months for US publicly listed companies using advanced machine learning models.
With an accuracy of around 89% and ROC-AUC of 85%, these models represent a large improvement over traditional methods of bankruptcy prediction for equity selection.
Advanced modeling techniques used in this dataset:
* **The Boosting Model**: Utilizes LightGBM technology, integrating both fundamental and market data for accurate predictions.
* **The Convolutional Model**: Employs a Convolutional Neural Network (CNN) for efficient pattern recognition in market trends.
* **The Rocket Model**: Specializes in time series data, using random convolutional kernels for effective classification and forecasting.
* **The Encoder Model**: Combines LightGBM with CNN autoencoders, enhancing feature engineering for more precise predictions.
* **The Fundamental Model**: Focuses solely on fundamental data via LightGBM, without extra architectural layers, for straightforward financial analysis.
## Data Access
### **Monthly Probabilities**
**Specific Tickers**
```python
import sovai as sov
df_bankrupt = sov.data('bankruptcy', tickers=["MSFT","TSLA","META"])
```
**Specific Dates**
```python
import sovai as sov
df_bankrupt = sov.data('bankruptcy', start_date="2017-01-03", tickers=["MSFT"])
```
**Latest Data**
```python
import sovai as sov
df_bankrupt = sov.data('bankruptcy')
```
**All Data**
```python
import sovai as sov
df_bankrupt = sov.data('bankruptcy', full_history=True)
```
### Daily Probabilities
```python
import sovai as sov
df_bankrupt = sov.data('bankruptcy/daily', tickers=["MSFT","TSLA","META"])
```
The daily probabilities are experimental, and have a very short history of just a couple of months.
### Feature Importance (Shapleys)
```python
import sovai as sov
df_importance = sov.data('bankruptcy/shapleys', tickers=["MSFT","TSLA","META"])
```
Feature Importance (Shapley Values) calculates the contribution of each input variable (features) such as Debt, Assets, and Revenue to predict bankruptcy risk.
## Reports
### Sorting and Filtering
```python
import sovai as sov
sov.report("bankruptcy", report_type="ranking")
```
Filter the outputs based on the top by **Sector**, **Marketcap**, and **Revenue** and bankruptcy risk. You can also change `ranking` to `change` to investigate the month on month change.
```python
sov.report("bankruptcy", report_type="sector-change")
```
## Plots
### Bankruptcy Comparison
```python
import sovai as sov
sov.plot('bankruptcy', chart_type='compare')
```
### Timed Feature Importance
```python
import sovai as sov
df = sov.plot("bankruptcy", chart_type="shapley", tickers=["TSLA"])
```
### Total Feature Importance
```python
import sovai as sov
sov.plot("bankruptcy", chart_type="stack", tickers=["DDD"])
```
### Bankruptcy and Returns
```python
import sovai as sov
df= sov.plot("bankruptcy", chart_type="line", tickers=["DDD"])
```
### **PCA Statistical Similarity**
```python
import sovai as sov
df= sov.plot("bankruptcy", chart_type="line", tickers=["DDD"])
```
### Correlation Similarity
```python
import sovai as sov
sov.plot("bankruptcy", chart_type="similar", tickers=["DDD"])
```
### Trend Similarity
```python
import sovai as sov
sov.plot("bankruptcy", chart_type="facet", tickers=["DDD"])
```
## Model Performance
### **Confusion Matrix**
```python
import sovai as sov
sov.plot("bankruptcy", chart_type="confusion_global")
```
### **Threshold Plots**
```python
import sovai as sov
sov.plot("bankruptcy", chart_type="classification_global")
```
### **Lift Curve**
```python
import sovai as sov
sov.plot("bankruptcy", chart_type="lift_global")
```
### Global Explainability
```python
import sovai as sov
sov.plot("bankruptcy", chart_type="time_global")
```
## Computations
Leverage advanced computational tools for deeper analysis:
* **Distance Matrix:**
```python
sov.compute('distance-matrix', on="attribute", df=dataframe)
```
Assess the similarity between entities based on selected attributes.
* **Percentile Calculation:**
```python
sov.compute('percentile', on="attribute", df=dataframe)
```
Calculate the relative standing of values within a dataset.
* **Feature Mapping:**
```python
sov.compute('map-accounting-features', df=dataframe)
```
Map accounting features to standardized metrics.
* **PCA Calculation:**
```python
sov.compute('pca', df=dataframe)
```
Perform principal component analysis for dimensionality reduction.
**For more advanced applications, see the tutotrial.**
## Data Dictionary
Name
Description
Type
Example
ticker
Stock ticker symbol.
TEXT
"TSLA"
date
Record date.
DATE
2023-09-30
probability_light
LightGBM Boosting Model prediction.
FLOAT
1.46636
probability_convolution
CNN Model prediction for bankruptcies
FLOAT
0.135975
probability_rocket
Rocket Model prediction for time series classification
FLOAT
0.02514
probability_encoder
LightGBM and CNN autoencoders Model prediction.
FLOAT
0.587817
probability_fundamental
Prediction using accounting data only.
FLOAT
1.26148
probability
Average probability across models.
FLOAT
0.553823
sans_market
Fundamental prediction adjusted for market predictions.
FLOAT
-0.20488
volatility
Variability of model predictions.
FLOAT
0.62934
multiplier
Coefficient for model prediction calibration.
FLOAT
1.951868
version
Model/data record version.
INT
20240201
When `sans_market` is positive, it means that the fundamentals show a larger predicted bankruptcy than what the market predicts **(stock might go down in medium term)** , when `sans_market` is negative, the market might have overreacted, and predict a larger probability of bankruptcy than what the fundamentals suggest **(stock might go up in medium term)**.
## Use Cases
1. **Bankruptcy Prediction Analysis**: Offer insights into predicted corporate bankruptcies and identify key factors, clarifying main drivers across different cycles.
2. **Variable Impact Breakdown**: Analyze how each individual variable affects bankruptcy predictions, providing in-depth feature contribution insights.
3. **Temporal Feature Distribution Analysis**: Reveal how variables contribute to predictions over time, emphasizing key features in forecasting models.
4. **Correlation Discovery**: Identify stocks with similar bankruptcy probability trends, revealing correlated market behaviors.
5. **Probability Shift Overview**: Showcase changes in bankruptcy probabilities among correlated stocks, providing a comprehensive market perspective.
6. **Sentiment Inversion Analysis**: Convert bankruptcy predictions into positive sentiment indicators to gauge potential impacts on stock returns.
7. **Behavioral Similarity Mapping**: Locate stocks with similar behaviors to a selected reference, based on bankruptcy trends and PCA feature analysis.