Managing credit risk and the cost of equity with machine learning techniques