Finance and economics
Machine learning for finance
Machine learning in finance scores credit and default risk, extracts facts and sentiment from company filings, and forecasts market and economic series. Each task pairs a clear target with data dated to when it was known, and is tested against a simple baseline.
How machine learning is used in finance
Scoring credit and default risk
Lenders predict the chance that a borrower misses payments from repayment history, balances, income and account activity. Logistic regression remains common because it is easy to explain, and gradient-boosted trees are used where their extra accuracy can still be validated and documented.
Real exampleKhandani, Kim and Lo, consumer credit-risk models (MIT)Combined customer transaction and credit bureau data from a major commercial bank to build machine learning forecasts of credit card delinquency and default, tested out of sample.
Detecting payment fraud
Payment firms score each transaction for fraud in milliseconds from card, device, merchant and network signals. Fraud is rare, so models are tuned to balance missed fraud against good payments that are wrongly blocked.
Real exampleHow we built it: Stripe RadarStripe describes how Radar's fraud models moved from logistic regression to an ensemble of XGBoost and a deep neural network, and in mid-2022 to a deep neural network alone.
Monitoring for money laundering
Anti-money laundering teams look for suspicious patterns across accounts and payments, where a single bank sees only part of the picture. Network analysis and machine learning help rank alerts so investigators review the riskiest cases first.
Real exampleProject Aurora (BIS Innovation Hub)A BIS Innovation Hub proof of concept that applied machine learning, privacy-enhancing technologies and network analysis to explore detecting money laundering across institutions and borders.
Reading filings, news and reports
Language models classify sentiment, extract figures and tag events in company filings, earnings calls and news. Financial wording differs from everyday language, so models adapted to financial text usually do better than general ones.
Real exampleFinBERT: financial sentiment analysis with pre-trained language modelsIntroduced a BERT language model further trained on financial text, which improved on the previous best results for two financial sentiment analysis datasets.
Governing models across the firm
Banks, insurers and investment firms run many models at once, so validation, monitoring and documentation are part of the work. Supervisors survey firms on where AI is used and how much decision-making it automates.
Real exampleArtificial intelligence in UK financial services, 2024 (Bank of England and FCA)The third joint survey reported that 75% of responding firms already use AI and that 55% of reported use cases involve some degree of automated decision-making.
Can you learn machine learning for finance?
Yes. Finance is one of the most practical places to learn machine learning, because much of the data is tabular, labelled and well documented. Most people start with Python and pandas, add statistics, learn supervised models on credit data, then move to time-ordered market data and text.
- Python and pandas for financial tablesLoad loan, transaction and price tables, join them on dates and identifiers, and handle missing values without leaking future information.Learn it in Python
- Probability and statisticsDefault rates, calibration, regression and hypothesis tests are the language risk teams already use to judge a model.Learn it in Statistics
- Supervised learning on tabular dataLogistic regression, gradient-boosted trees, class imbalance, ROC AUC and the Brier score, practised on a credit default dataset.Learn it in Machine Learning
- Time-ordered validation and finance basicsChronological splits and walk-forward tests, alongside the basics of credit, accounting and markets from a finance textbook or professional qualification.
- Language models for documentsUse pretrained models to classify and extract facts from filings and reports, and check every output against the source text.Learn it in Generative AI
Moving into machine learning for finance
If you already work in the field
Analysts, risk managers and accountants already know the data, the products and the questions auditors and regulators ask. Add Python, statistics and scikit-learn, then rebuild a model you know, such as a scorecard or a loss forecast, and compare it with the method your team uses today.
If you come from data science or ML
Data scientists should learn how credit, payments and markets work, why data must be dated to when it was known, and how model risk rules shape what can be deployed. The Federal Reserve's SR 11-7 and the PRA's SS1/23 on model risk management are useful reading.
Roles that do this workCredit risk modellerQuantitative analystFraud data scientistModel validation analystMachine learning engineer, financial services
Tools you will use
| Tool | What you use it for |
|---|---|
| pandas | Load, clean and join dated financial tables before any modelling. |
| scikit-learn | Fit logistic regression and tree models for credit scoring with proper cross-validation. |
| XGBoost | Train gradient-boosted trees on tabular risk and fraud features. |
| statsmodels | Run regressions and time-series models with standard errors for financial series. |
| Hugging Face Transformers | Apply pretrained language models to classify or extract facts from filings and reports. |
| EdgarTools | Download SEC EDGAR filings and XBRL financial statements from Python. |
Public data to practise on
- Default of Credit Card Clients (UCI): Payment history, bill amounts and demographics of credit card holders, labelled with whether each defaulted the next month.
- EDGAR-CORPUS: Annual reports (10-K filings) of US public companies split into sections, for text classification and disclosure analysis.
- FRED (Federal Reserve Economic Data): Free US and international economic and market series, such as interest rates and credit spreads, for forecasting and risk features.
Your first project
Download the UCI Default of Credit Card Clients dataset, predict next-month default with logistic regression and gradient boosting, and compare both with a majority-class baseline using ROC AUC and the Brier score.
Common questions
Is machine learning used in banking?
Yes. Banks use it for fraud detection, credit decisions, anti-money laundering monitoring and customer service, alongside traditional statistical models. Supervisors expect each model to be validated, monitored and explainable to the people it affects.
Do I need a finance degree to work in machine learning for finance?
No. Many people come from computer science, statistics, physics or engineering and learn the domain on the job. What matters is understanding the products and data you model, which you can learn from textbooks and the documentation of public datasets.
Which programming language is used for machine learning in finance?
Python is the most common for research and modelling, with pandas, scikit-learn and XGBoost, and SQL is used almost everywhere for data access. Some production trading and risk systems are written in C++ or Java.
Why do banks still use logistic regression?
It is transparent, stable and easy to explain to customers, auditors and regulators, and on well-prepared credit data the gap to more complex models can be small. Many teams keep it as the benchmark a new model must beat.
Can machine learning predict the stock market?
Not reliably. Returns are noisy, and published research finds small, unstable effects that often shrink after costs. Learn market prediction as research practice; this page is educational and is not investment advice.
Courses for these skills
- Statistics and Probability for Machine LearningUnderstand distributions, dependence and uncertain estimates.41 published lessons · all planned lessons open
- Practical Machine Learning in PythonBuild baselines and time-aware comparisons.51 published lessons · more lessons in production
- Generative AI: LLMs, RAG and AgentsStudy retrieval, structured outputs and evaluating factual answers.Syllabus available · lessons open as produced
- Data Tools: NumPy, pandas, Matplotlib and scikit-learnAlign reported values, units and document metadata.23 published lessons · all planned lessons open
- Deep Learning with PyTorchStudy sequence representations and neural model training.Syllabus available · lessons open as produced
New to programming or maths? Start with Python, or follow the machine learning path in order. Published lessons are free to read; compare Free and Pro.