Introduction

Machine Learning (ML) offers powerful tools for prediction, classification, and pattern recognition, complementing traditional econometric methods. In economics, these techniques are increasingly used for tasks ranging from forecasting macroeconomic variables and financial market movements to analyzing causal effects (e.g., causal forests), classifying consumer behavior, and informing policy decisions.

This page provides an overview of some common ML concepts and their relevance in the economic field, reflecting areas of my interest and application. Also, check out relevant posts on my Blog.

Supervised Learning

Supervised learning involves training a model on labeled data, where both input features ($X$) and the corresponding output target ($Y$) are known. The goal is to learn a mapping function $f(X)$ that accurately predicts $Y$ for new, unseen data.

Regression Problems

Here, the target variable $Y$ is continuous. The goal is to predict a numerical value.

  • Examples in Economics: Forecasting GDP growth, inflation rates, asset prices, house prices; estimating demand elasticity.
  • Common Algorithms: Linear Regression (often with regularization like Ridge or Lasso), Support Vector Regression (SVR), Regression Trees, Random Forests, Gradient Boosting Machines (GBM), Neural Networks.
  • Loss Function Example (Mean Squared Error - MSE): A common objective is to minimize the average squared difference between predicted ($\hat{y}_i$) and actual ($y_i$) values: $$ MSE = \frac{1}{N} \sum_{i=1}^{N} (y_i - \hat{y}_i)^2 $$

Visualization Example: Simple Regression

Conceptual plot showing a simple linear regression fit. JavaScript libraries like Chart.js or Plotly.js can create interactive versions.

Classification Problems

Here, the target variable $Y$ is categorical. The goal is to predict a class label.

  • Examples in Economics: Predicting loan default risk (default/no default), identifying fraudulent transactions (fraud/not fraud), classifying firms based on performance (high/medium/low), predicting recession probability (recession/no recession).
  • Common Algorithms: Logistic Regression, Support Vector Machines (SVM), k-Nearest Neighbors (k-NN), Decision Trees, Random Forests, Naive Bayes, Neural Networks.
  • Loss Function Example (Cross-Entropy): Often used for probabilistic classifiers, measuring the difference between predicted probabilities ($\hat{p}_i$) and actual labels ($y_i$, typically 0 or 1): $$ \text{Cross-Entropy} = -\frac{1}{N} \sum_{i=1}^{N} [y_i \log(\hat{p}_i) + (1-y_i) \log(1-\hat{p}_i)] $$

Visualization Example: Decision Tree Structure

Example Decision Tree Visualization (generated via D3.js).

Unsupervised Learning

Unsupervised learning deals with unlabeled data ($X$ only). The goal is to find inherent structures, patterns, or groupings within the data without predefined targets.

  • Clustering: Grouping similar data points together.
    • Economic Applications: Customer segmentation for marketing, identifying groups of countries with similar economic characteristics, grouping assets with similar risk profiles.
    • Algorithms: K-Means, Hierarchical Clustering, DBSCAN.
  • Dimensionality Reduction: Reducing the number of input features while preserving important information.
    • Economic Applications: Simplifying complex datasets for visualization or further modeling, feature extraction for forecasting models, constructing economic indices.
    • Algorithms: Principal Component Analysis (PCA), t-Distributed Stochastic Neighbor Embedding (t-SNE), Autoencoders (using neural networks).

Model Evaluation & Selection

Choosing the right model and assessing its performance is crucial.

  • Train/Validation/Test Split: Data is typically split to train the model, tune hyperparameters (validation set), and finally evaluate performance on unseen data (test set). Cross-validation is often used for more robust estimates, especially with smaller datasets.
  • Regression Metrics: Mean Squared Error (MSE), Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), R-squared ($R^2$).
  • Classification Metrics: Accuracy, Precision, Recall (Sensitivity), F1-Score, Area Under the ROC Curve (AUC-ROC), Confusion Matrix.
  • Bias-Variance Tradeoff: A central concept. Simple models may have high bias (underfitting), while complex models may have high variance (overfitting to training data). Regularization techniques (like Lasso/Ridge) help manage this tradeoff.

Visualization Example: ROC Curve

Conceptual ROC curve plotting True Positive Rate vs. False Positive Rate for a classifier. The area under the curve (AUC) measures overall performance.