# A Multi-Head LSTM Architecture for Bankruptcy Prediction with Time Series Accounting Data
## 6 Metrics  
We implemented the bankruptcy prediction as a binary prediction task where the positive class (1) indicated bankruptcy in the next year and the negative class (0) meant that a company was classified as healthy in the next year. In order to compare our models and prove their effectiveness, we used different metrics that took into account the imbalanced condition of the validation and test sets. Consider the following quantities for the default prediction:  
* True Positive (TP): The number of actually defaulted companies that were correctly predicted as bankrupted.
* False Negative (FN): The number of actually defaulted companies that were wrongly predicted as healthy firms.
* True Negative (TN): The number of actually healthy companies that were correctly predicted as healthy.
* False Positive (FP): The number of actually healthy companies that were wrongly predicted as bankrupted by the model.  
Since the validation and test sets were both imbalanced with a prevalence of healthy companies, we did not compare the models in terms of model accuracy. Indeed, the proportion of correct matches would be ineffective in assessing the model performance. Instead, we computed each class's precision, recall, and \(F_{1}\) scores. This is highlighted because, in predicting bankruptcy, an error has a different cost depending on the class that has been incorrectly predicted. The consequences of erroneously classifying a financially distressed company as healthy incur a significantly higher cost than misclassifying a healthy company as financially distressed. In light of this, the precision achieved for a class is the accuracy of that class' predictions. The recall (sensitivity) is the ratio of the class instances that were correctly detected as such by the classifier. The \(F_{1}\) score is the harmonic mean of precision and recall: whereas the regular mean treats all values equally, the harmonic mean gives more weight to low values. Consequently, we obtained a high \(F_{1}\) score for a certain class only if its precision and recall were high. Equations (3)-(5) report how these quantities are computed for the positive class. The definitions for the negative class are the same but with positives exchanged for negatives.  
\[Precision=\frac{TP}{(TP+FP)} \tag{3}\]  
\[Recall=\frac{TP}{(TP+FN)} \tag{4}\]  
\[F_{1}score=\frac{2}{\frac{1}{Precision}+\frac{1}{Recall}} \tag{5}\]  
Moreover, we report three global metrics for the classifier that were selected because they enabled an overall evaluation of the classifier for both classes without being influenced by the dataset imbalance:  
* The Area Under the Curve (AUC) measures the ability of a classifier to distinguish between classes and is used as a summary of the Receiver Operating Characteristic (ROC) curve. The ROC curve is created by plotting the true-positive rate (TPR) against the false-positive rate (FPR) at various threshold settings.
* The macro \(F_{1}\) score is computed as the arithmetic mean of the \(F_{1}\) score of all the classes.
* The micro \(F_{1}\) score is used to assess the quality of multi-label binary problems. It measures the \(F_{1}\) score of the aggregated contributions of all classes, giving the same importance to each sample.  
Finally, we used two other metrics that are often evaluated in bankruptcy prediction models. Because bankruptcy is a rare event, using the classification accuracy to measure a model's performance can be misleading since it assumes that type I errors (Equation (6)) and type II errors (Equation (7)) are equally costly. The cost of false negatives is muchgreater than the cost of false positives for a financial institution. In light of this, we explicitly computed and reported type I and type II errors and compared the models focusing in particular on type II errors and the recall of the positive class.  
\[\mathit{Type}\quad I\quad error=\frac{\mathit{FP}}{\mathit{TN}+\mathit{FP}} \tag{6}\]  
\[\mathit{Type}\quad I\quad error=\frac{\mathit{FN}}{\mathit{TP}+\mathit{FN}} \tag{7}\]