Investing Wisely: An Explainable AI Approach to Identifying Profitable Companies
The application of advanced machine learning (ML) techniques has transformed investment strategies in public companies, offering superior computational power and accuracy.
The application of advanced machine learning (ML) techniques has transformed investment strategies in public companies, offering superior computational power and accuracy. However, the inherent complexity of these models often creates challenges for informed decision-making. This article presents an innovative explainable AI (XAI) model designed to analyze corporate financials and predict expected returns by assessing credit risk and profitability. By utilizing Shapley values, the model enhances transparency by providing interpretable explanations of AI-generated predictions. An empirical analysis of 1,700 public companies demonstrates the ability to reliably forecast expected returns using a combination of financial indicators, thereby helping investors make informed decisions.
Introduction
Artificial intelligence (AI) has become a driving force across various industries, with finance benefiting significantly from its capabilities. AI excels in processing vast amounts of data to generate actionable insights, powering innovations in algorithmic trading, risk management, and more. However, many AI models are perceived as "black boxes," which poses a significant barrier to trust and usability for financial analysts and investors. To address this, explainable AI (XAI) has emerged as a solution that seeks to balance the high accuracy of complex models with the need for transparency and interpretability.
While complex ML models have demonstrated excellent performance in areas such as credit scoring, portfolio optimization, and profit prediction, their lack of interpretability limits their practical use in finance, where understanding the rationale behind decisions is crucial. To mitigate this challenge, model-agnostic techniques such as Shapley values have been developed. These methods offer insights into the predictions of any machine learning model, explaining the contribution of each input feature through principles rooted in cooperative game theory.
This article focuses on the application of XAI in investment decisions for publicly traded companies on the NYSE, AMEX, and NASDAQ. We propose a framework where machine learning models predict expected returns with high accuracy, and Shapley values are employed to enhance model interpretability. The methodology includes five key steps: estimating the probability of default (PD) using the XGBoost algorithm, identifying significant risk factors, selecting non-default companies, estimating their profitability, and interpreting the results through Shapley values.
Methodology
Estimating Credit Risk
Credit risk estimation is crucial in finance, as it assesses the likelihood that a company will default on its financial obligations. Traditional methods, such as logistic regression, are transparent but often fall short in terms of accuracy when compared to more complex ML models. Logistic regression models the probability of default (PD) as a logistic function of the input features:
Where βββ represents model coefficients, and XXX represents input features. Despite its interpretability, logistic regression is limited by its linear nature.
In contrast, the Extreme Gradient Boosting (XGBoost) algorithm, a powerful machine learning technique, constructs an ensemble of decision trees to improve predictive performance. XGBoost optimizes the model iteratively, with each tree correcting errors made by its predecessors. The objective function of XGBoost combines a loss function, which measures predictive accuracy, with a regularization term to prevent overfitting:
Where:
L is the loss function,
Ω is the regularization term,
yi are the true labels,
y^i are the predicted labels,
fj represents the individual trees.
Although XGBoost excels in accuracy, its complexity renders it a "black box." To address this, we use Shapley values, a model-agnostic method to explain the output of any machine learning model by distributing the prediction among the input features based on their marginal contributions.
Estimating Expected Return
An effective investment strategy balances risk reduction with return maximization. For companies, estimating expected returns is essential for evaluating their financial resilience and sustainability. Expected returns are calculated by combining credit risk assessments with profitability measures. The formula used is:
Where:
ERi is the expected return for the iii-th enterprise,
PDi is the probability of default,
Pi is the profit after tax.
This approach integrates the likelihood of default with profitability, offering a comprehensive view of investment potential. Profitability is often measured through financial metrics like EBITDA (Earnings Before Interest, Taxes, Depreciation, and Amortization) and net income on total assets, both of which provide a clear picture of operational efficiency and overall profitability.
Model Comparison
To evaluate the performance of our models for credit risk estimation, we use binary classification metrics such as the area under the receiver operating characteristic (ROC) curve (AUC). The ROC curve illustrates the trade-off between the true positive rate (TPR) and the false positive rate (FPR).
An AUC value closer to 1 indicates excellent model performance. For expected return estimation, we employ regression models and evaluate their performance using the mean squared error (MSE), which measures the average squared difference between predicted and actual values:
Model Code
Our Python-based implementation follows a structured approach to predict the financial health of public companies and interpret the results using explainable AI techniques.
Data Preprocessing and Balancing:
Data preprocessing involves tasks such as handling missing values, encoding categorical variables, and normalizing numerical features. To balance the dataset, we use the Synthetic Minority Over-sampling Technique (SMOTE), generating synthetic samples for the minority class.
Model Training:
We train an XGBoost model to estimate the probability of default for each company. XGBoost is chosen for its high accuracy and robustness. The model is trained using various financial indicators, and hyperparameters are tuned for optimal performance. The output is the probability of default for each company.
Explainability with Shapley Values:
Despite the high accuracy of the XGBoost model, its "black-box" nature necessitates interpretability. To address this, we compute Shapley values, which provide insights into how each feature contributes to the model’s prediction. Shapley values enhance transparency, enabling better decision-making.
Expected Return Calculation:
Once the probability of default is estimated, we calculate the expected return for each company by multiplying the probability of non-default (1 - PD) with the profit after tax. This step provides a quantitative measure of potential investment returns.
Results
Our empirical analysis involved 1,700 companies from 2019, with their default status assessed one year later. Significant feature variables were identified through F-test statistics, and multicollinearity was addressed using the Variance Inflation Factor (VIF). The selected features included Current Assets, Revenue, EBITDA, Debt to Equity, Total Assets, Debt, and Net Income on Total Assets.
Correlation Matrix
The table below displays the correlation coefficients for various financial indicators of the companies, helping us understand the relationships between them. For example, companies with higher total assets tend to show higher net income on total assets, and companies with higher revenue tend to rely less on debt.
Investing Wisely: An Explainable AI Approach to Identifying Worthwhile Companies - Correlation Matrix
Current_assets:
Shows a weak negative correlation with Revenue (-0.034) and EBITDA (-0.038).
Has a moderate negative correlation with Debt_to_equity (-0.212).
Displays a weak positive correlation with Total_Assets (0.120) and Debt (0.069).
Has a weak positive correlation with Net_income_on_Total_Assets (0.048).
Revenue:
Exhibits a weak negative correlation with EBITDA (-0.146).
Shows a very weak negative correlation with Debt_to_equity (-0.012).
Has a weak negative correlation with Total_Assets (-0.082).
Shows a moderate negative correlation with Debt (-0.229).
Displays a weak negative correlation with Net_income_on_Total_Assets (-0.116).
EBITDA:
Displays a moderate negative correlation with Debt_to_equity (-0.215).
Shows a very weak negative correlation with Total_Assets (-0.035).
Exhibits a very weak negative correlation with Debt (-0.022).
Has a weak positive correlation with Net_income_on_Total_Assets (0.082).
Debt_to_equity:
Shows a moderate positive correlation with Total_Assets (0.188).
Displays a moderate negative correlation with Debt (-0.218).
Has a very weak negative correlation with Net_income_on_Total_Assets (-0.016).
Total_Assets:
Shows a moderate negative correlation with Debt (-0.133).
Displays a moderate positive correlation with Net_income_on_Total_Assets (0.250).
Debt:
Exhibits a very weak negative correlation with Net_income_on_Total_Assets (-0.026).
Net_income_on_Total_Assets:
Displays the highest positive correlation with Total_Assets (0.250), indicating that as the total assets of a company increase, the net income on total assets also tends to increase.
Applying the XGBoost model to balanced training data yielded an AUC of 0.91, indicating strong performance. However, to enhance interpretability, we calculated Shapley values, revealing Revenue as the most significant predictor of default probability. This insight is illustrated in Figure below.
Mean Shapley Value Contribution of Independent Variables
The bar chart below compares the Shapley value contributions of "Revenue" and "Leverage" for two defaulted and two non-defaulted companies, showcasing the influence of these variable on the predicted outcomes for individual enterprises.
Local interpretations using Shapley values for individual enterprises highlighted that insufficient turnover was the primary cause of default for defaulted companies, while good turnover and low leverage explained the success of non-defaulted companies.
Conclusion
The complexity of machine learning models in financial analysis calls for the use of explainable AI techniques to ensure interpretability. By integrating Shapley values into our approach, we provide clear insights into the contributions of various financial indicators to the probability of default and expected return for each company. This approach not only enhances model transparency but also supports better-informed investment decisions. Future research could explore additional XAI techniques and apply this model to other case studies to further validate its applicability.