sovai commited on
Commit
16ca54a
·
1 Parent(s): 3689f5d

Add bankruptcy.parquet and README.md

Browse files
Files changed (2) hide show
  1. README.md +258 -0
  2. bankruptcy.parquet +3 -0
README.md ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ icon: seal-exclamation
3
+ description: >-
4
+ Chapter 7 and Chapter 11 bankruptcy predictions made easy for over 13,000 US
5
+ publicly traded stocks.
6
+ ---
7
+
8
+ # Bankruptcy Predictions
9
+
10
+
11
+ Monthly corporate bankruptcy predictions arrive the **2nd of every month**_._
12
+
13
+
14
+ `Tutorials` are the best documentation — [<mark style="color:blue;">`Corporate Bankruptcy Tutorial`</mark>](https://colab.research.google.com/github/sovai-research/sovai-public/blob/main/notebooks/datasets/Bankruptcy%20Prediction.ipynb)
15
+
16
+ <table data-view="cards" data-full-width="false"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>Input Datasets</strong></td><td>SEC Bankruptcies, Delistings, Market Data, Financial Statements</td></tr><tr><td><strong>Models Used</strong></td><td>CNN, LightGBM, RocketModel, AutoEncoder</td></tr><tr><td><strong>Model Outputs</strong></td><td>Calibrated Probabilities, Shapley Values</td></tr></tbody></table>
17
+
18
+ ## Description
19
+
20
+ The model predicts the likelihood of bankruptcies in the next 6-months for US publicly listed companies using advanced machine learning models.
21
+
22
+ 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.
23
+
24
+ Advanced modeling techniques used in this dataset:
25
+
26
+ * **The Boosting Model**: Utilizes LightGBM technology, integrating both fundamental and market data for accurate predictions.
27
+ * **The Convolutional Model**: Employs a Convolutional Neural Network (CNN) for efficient pattern recognition in market trends.
28
+ * **The Rocket Model**: Specializes in time series data, using random convolutional kernels for effective classification and forecasting.
29
+ * **The Encoder Model**: Combines LightGBM with CNN autoencoders, enhancing feature engineering for more precise predictions.
30
+ * **The Fundamental Model**: Focuses solely on fundamental data via LightGBM, without extra architectural layers, for straightforward financial analysis.
31
+
32
+ ## Data Access
33
+
34
+ ### **Monthly Probabilities**
35
+
36
+ **Specific Tickers**
37
+
38
+ ```python
39
+ import sovai as sov
40
+ df_bankrupt = sov.data('bankruptcy', tickers=["MSFT","TSLA","META"])
41
+ ```
42
+
43
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_1.png" alt=""><figcaption></figcaption></figure>
44
+
45
+ **Specific Dates**
46
+
47
+ ```python
48
+ import sovai as sov
49
+ df_bankrupt = sov.data('bankruptcy', start_date="2017-01-03", tickers=["MSFT"])
50
+ ```
51
+
52
+ **Latest Data**
53
+
54
+ ```python
55
+ import sovai as sov
56
+ df_bankrupt = sov.data('bankruptcy')
57
+ ```
58
+
59
+ **All Data**
60
+
61
+ ```python
62
+ import sovai as sov
63
+ df_bankrupt = sov.data('bankruptcy', full_history=True)
64
+ ```
65
+
66
+ ### Daily Probabilities
67
+
68
+ ```python
69
+ import sovai as sov
70
+ df_bankrupt = sov.data('bankruptcy/daily', tickers=["MSFT","TSLA","META"])
71
+ ```
72
+
73
+ The daily probabilities are experimental, and have a very short history of just a couple of months.
74
+
75
+ ### Feature Importance (Shapleys)
76
+
77
+ ```python
78
+ import sovai as sov
79
+ df_importance = sov.data('bankruptcy/shapleys', tickers=["MSFT","TSLA","META"])
80
+ ```
81
+
82
+ Feature Importance (Shapley Values) calculates the contribution of each input variable (features) such as Debt, Assets, and Revenue to predict bankruptcy risk.
83
+
84
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_2.png" alt=""><figcaption></figcaption></figure>
85
+
86
+ ## Reports
87
+
88
+ ### Sorting and Filtering
89
+
90
+ ```python
91
+ import sovai as sov
92
+ sov.report("bankruptcy", report_type="ranking")
93
+ ```
94
+
95
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_3.png" alt=""><figcaption></figcaption></figure>
96
+
97
+ Filter the outputs based on the top by **Sector**, **Marketcap**, and **Revenue** and bankruptcy risk. You can also change <mark style="color:blue;">`ranking`</mark> to <mark style="color:blue;">`change`</mark> to investigate the month on month change.
98
+
99
+ ```python
100
+ sov.report("bankruptcy", report_type="sector-change")
101
+ ```
102
+
103
+ ## Plots
104
+
105
+ ### Bankruptcy Comparison
106
+
107
+ ```python
108
+ import sovai as sov
109
+ sov.plot('bankruptcy', chart_type='compare')
110
+ ```
111
+
112
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_4.png" alt=""><figcaption></figcaption></figure>
113
+
114
+ ### Timed Feature Importance
115
+
116
+ ```python
117
+ import sovai as sov
118
+ df = sov.plot("bankruptcy", chart_type="shapley", tickers=["TSLA"])
119
+ ```
120
+
121
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_5.png" alt=""><figcaption></figcaption></figure>
122
+
123
+ ### Total Feature Importance
124
+
125
+ ```python
126
+ import sovai as sov
127
+ sov.plot("bankruptcy", chart_type="stack", tickers=["DDD"])
128
+ ```
129
+
130
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_6.png" alt=""><figcaption></figcaption></figure>
131
+
132
+ ### Bankruptcy and Returns
133
+
134
+ ```python
135
+ import sovai as sov
136
+ df= sov.plot("bankruptcy", chart_type="line", tickers=["DDD"])
137
+ ```
138
+
139
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_7.png" alt=""><figcaption></figcaption></figure>
140
+
141
+ ### **PCA Statistical Similarity**
142
+
143
+ ```python
144
+ import sovai as sov
145
+ df= sov.plot("bankruptcy", chart_type="line", tickers=["DDD"])
146
+ ```
147
+
148
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_8.png" alt=""><figcaption></figcaption></figure>
149
+
150
+ ### Correlation Similarity
151
+
152
+ ```python
153
+ import sovai as sov
154
+ sov.plot("bankruptcy", chart_type="similar", tickers=["DDD"])
155
+ ```
156
+
157
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_9.png" alt=""><figcaption></figcaption></figure>
158
+
159
+ ### Trend Similarity
160
+
161
+ ```python
162
+ import sovai as sov
163
+ sov.plot("bankruptcy", chart_type="facet", tickers=["DDD"])
164
+ ```
165
+
166
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_10.png" alt=""><figcaption></figcaption></figure>
167
+
168
+ ## Model Performance
169
+
170
+ ### **Confusion Matrix**
171
+
172
+ ```python
173
+ import sovai as sov
174
+ sov.plot("bankruptcy", chart_type="confusion_global")
175
+ ```
176
+
177
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_11.png" alt=""><figcaption></figcaption></figure>
178
+
179
+ ### **Threshold Plots**
180
+
181
+ ```python
182
+ import sovai as sov
183
+ sov.plot("bankruptcy", chart_type="classification_global")
184
+ ```
185
+
186
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_12.png" alt=""><figcaption></figcaption></figure>
187
+
188
+ ### **Lift Curve**
189
+
190
+ ```python
191
+ import sovai as sov
192
+ sov.plot("bankruptcy", chart_type="lift_global")
193
+ ```
194
+
195
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_13.png" alt=""><figcaption></figcaption></figure>
196
+
197
+ ### Global Explainability
198
+
199
+ ```python
200
+ import sovai as sov
201
+ sov.plot("bankruptcy", chart_type="time_global")
202
+ ```
203
+
204
+ <figure><img src="https://raw.githubusercontent.com/sovai-research/sovai-documentation/main/.gitbook/assets/bankruptcy_predictions_14.png" alt=""><figcaption></figcaption></figure>
205
+
206
+ ## Computations
207
+
208
+ Leverage advanced computational tools for deeper analysis:
209
+
210
+ * **Distance Matrix:**
211
+
212
+ ```python
213
+ sov.compute('distance-matrix', on="attribute", df=dataframe)
214
+ ```
215
+
216
+ Assess the similarity between entities based on selected attributes.
217
+ * **Percentile Calculation:**
218
+
219
+ ```python
220
+ sov.compute('percentile', on="attribute", df=dataframe)
221
+ ```
222
+
223
+ Calculate the relative standing of values within a dataset.
224
+ * **Feature Mapping:**
225
+
226
+ ```python
227
+ sov.compute('map-accounting-features', df=dataframe)
228
+ ```
229
+
230
+ Map accounting features to standardized metrics.
231
+ * **PCA Calculation:**
232
+
233
+ ```python
234
+ sov.compute('pca', df=dataframe)
235
+ ```
236
+
237
+ Perform principal component analysis for dimensionality reduction.
238
+
239
+ **For more advanced applications, see the tutotrial.**
240
+
241
+ ## Data Dictionary
242
+
243
+ <table><thead><tr><th width="293">Name</th><th width="246">Description</th><th width="89">Type</th><th>Example</th></tr></thead><tbody><tr><td><code>ticker</code></td><td>Stock ticker symbol.</td><td>TEXT</td><td>"TSLA"</td></tr><tr><td><code>date</code></td><td>Record date.</td><td>DATE</td><td>2023-09-30</td></tr><tr><td><code>probability_light</code></td><td>LightGBM Boosting Model prediction.</td><td>FLOAT</td><td>1.46636</td></tr><tr><td><code>probability_convolution</code></td><td>CNN Model prediction for bankruptcies</td><td>FLOAT</td><td>0.135975</td></tr><tr><td><code>probability_rocket</code></td><td>Rocket Model prediction for time series classification</td><td>FLOAT</td><td>0.02514</td></tr><tr><td><code>probability_encoder</code></td><td>LightGBM and CNN autoencoders Model prediction.</td><td>FLOAT</td><td>0.587817</td></tr><tr><td><code>probability_fundamental</code></td><td>Prediction using accounting data only.</td><td>FLOAT</td><td>1.26148</td></tr><tr><td><code>probability</code></td><td>Average probability across models.</td><td>FLOAT</td><td>0.553823</td></tr><tr><td><code>sans_market</code></td><td>Fundamental prediction adjusted for market predictions.</td><td>FLOAT</td><td>-0.20488</td></tr><tr><td><code>volatility</code></td><td>Variability of model predictions.</td><td>FLOAT</td><td>0.62934</td></tr><tr><td><code>multiplier</code></td><td>Coefficient for model prediction calibration.</td><td>FLOAT</td><td>1.951868</td></tr><tr><td><code>version</code></td><td>Model/data record version.</td><td>INT</td><td>20240201</td></tr></tbody></table>
244
+
245
+
246
+ When `sans_market` is <mark style="color:green;">positive</mark>, 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 <mark style="color:red;">negative</mark>, the market might have overreacted, and predict a larger probability of bankruptcy than what the fundamentals suggest **(stock might go up in medium term)**.
247
+
248
+
249
+ ## Use Cases
250
+
251
+ 1. **Bankruptcy Prediction Analysis**: Offer insights into predicted corporate bankruptcies and identify key factors, clarifying main drivers across different cycles.
252
+ 2. **Variable Impact Breakdown**: Analyze how each individual variable affects bankruptcy predictions, providing in-depth feature contribution insights.
253
+ 3. **Temporal Feature Distribution Analysis**: Reveal how variables contribute to predictions over time, emphasizing key features in forecasting models.
254
+ 4. **Correlation Discovery**: Identify stocks with similar bankruptcy probability trends, revealing correlated market behaviors.
255
+ 5. **Probability Shift Overview**: Showcase changes in bankruptcy probabilities among correlated stocks, providing a comprehensive market perspective.
256
+ 6. **Sentiment Inversion Analysis**: Convert bankruptcy predictions into positive sentiment indicators to gauge potential impacts on stock returns.
257
+ 7. **Behavioral Similarity Mapping**: Locate stocks with similar behaviors to a selected reference, based on bankruptcy trends and PCA feature analysis.
258
+
bankruptcy.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37731877ff8002c0cd7c50bdaa96dba1d611541731d7abd8a996afd5574fafd4
3
+ size 88169927