Performance evaluation Predictive Analytics Model Evaluation and Performance Metrics
Fundamentals of Predictive Analytics and Target Definitions
Predictive analytics utilizes historical data to forecast future events, patterns, and behaviors.
Targets explicitly define what predictive models aim to forecast or classify.
Continuous Numerical Targets:
Occur when the predictive task involves estimating continuous numerical values (e.g., forecasting sales amounts for a specific product in a specific store and region).
Historical sales and store data are used to accurately predict demand, ensuring stores maintain sufficient inventory to meet customer purchasing needs.
The term "predictive analytics" or "predictive modeling" is specifically applied when dealing with continuous numerical target variables.
Categorical Targets:
Occur when the predictive task involves assigning observations to discrete classes or categories (e.g., determining whether a credit card transaction is fraudulent or legal).
The term "classification" or "classification target" is specifically applied when dealing with discrete categorical target variables.
Rationale for Evaluating Predictive Models and Model Techniques
Evaluating predictive models is essential because numerous modeling methods, algorithms, and parameter configurations exist.
Common Machine Learning and Statistical Modeling Techniques:
Neural Networks
Artificial Intelligence (AI) algorithms
Random Forests
Classification and Regression Trees (CART)
Regression models
Crucial Objective: Performance evaluation methods provide a systematic framework to choose the single best-performing model from among all candidate models and configurations.
Measuring Continuous Predictive Error and Naive Benchmarks
Quantitative Definition of Error:
For models predicting continuous numerical targets, performance evaluation focuses on quantifying prediction error magnitude.
The error amount is represented by the symbol epsilon ():
Naive Benchmark Model:
Serves as the default baseline prediction when no context or predictor variables are available.
Predicts the continuous target variable using the simple average (mean) of historical target observations.
Geometrically, the simple average prediction line passes directly through the center of observed values.
Average Error Calculation and Its Flaw:
Calculated by taking the sum of individual error values across all observations and dividing by total observations ():
Fundamental Flaw: Because the average prediction line passes through the exact geometric center of the observed data, positive errors and negative errors perfectly offset each other.
The resulting total sum of simple errors is always equal to , regardless of individual prediction error magnitudes.
Conclusion: Simple average error is completely unsuitable for measuring predictive model accuracy.
Error Measurement Metrics: MAE, SSE, and SST Decomposition
Mean Absolute Error (MAE):
Prevents positive and negative errors from canceling out by converting all individual error terms to positive absolute values prior to summation.
Calculated by dividing the sum of absolute error values by total observations ():
Sum of Squared Errors (SSE) / Mean Squared Error:
Squares each individual prediction error term before taking the sum across all observations.
Dividing the sum of squared errors by total observations () yields the average sum of squared errors (Mean Squared Error).
Historical and Mathematical Justification for Using SSE:
Developed historically by mathematicians working throughout the 1700s, 1800s, and 1900s.
Mathematical Advantage: The squared error term allows taking derivatives of the error function and setting them equal to to find exact analytical minimum error values.
Limitation of MAE: Absolute value functions do not possess continuous derivatives, rendering derivative-based mathematical optimization impossible.
Decomposition of Total Variance (SST):
Total Sum of Squares () represents total target variation relative to the simple average benchmark.
decomposes mathematically into explained and unexplained error portions:
Explained Portion ( - Sum of Squares due to Regression): Measures the squared difference between model predictions and the naive average baseline prediction.
Unexplained Portion ( - Sum of Squares due to Error): Measures the squared difference between actual target values and model predictions.
Coefficient of Determination () and Adjusted
Coefficient of Determination ():
Calculated as the ratio of explained variation () to total variation ():
Represents the proportion of total target error variance explained by the predictive model.
Structural Limitation of :
Fails to adjust for the number of predictor variables (columns of data) included in the model.
Adding extra or superfluous predictor variables can artificially increase even when the added variables provide no genuine predictive value.
Adjusted :
Developed to penalize model complexity by explicitly factoring in the number of predictors (variables) used.
Computed automatically by analytical software tools such as Excel, JMP, and Minitab.
Classification Metrics and Confusion Matrix Framework
Misclassification Error Rate:
Calculated by counting total incorrect predictions (predicting positive when actual is negative, or negative when actual is positive) and dividing by total record count.
Confusion Matrix Framework:
Displays actual class labels against model-predicted class labels.
Standard Binary Coding:
Class : Uninteresting / Default Negative Class (e.g., Non-Fraudulent transaction).
Class : Target / Positive Class of Interest (e.g., Fraudulent transaction).
Four Quadrants of the Confusion Matrix:
True Negative (TN): Actual Class = , Predicted Class = (Correctly classified negative).
False Positive (FP): Actual Class = , Predicted Class = (Incorrectly classified positive).
False Negative (FN): Actual Class = , Predicted Class = (Incorrectly classified negative).
True Positive (TP): Actual Class = , Predicted Class = (Correctly classified positive).
Mathematical Formulations for Classification Metrics:
Misclassification Rate:
Accuracy:
Sensitivity (True Positive Rate / Recall):
- Measures the percentage of actual positive instances successfully captured by the model.
Specificity (True Negative Rate):
- Measures the percentage of actual negative instances successfully identified by the model.
Detailed Numerical Example of Classification Metrics
Sample Dataset Metrics ( total observations):
Actual Class predicted as Class (False Positives, FP):
Actual Class predicted as Class (False Negatives, FN):
Actual Class predicted as Class (True Negatives, TN):
Actual Class predicted as Class (True Positives, TP):
Total Actual Class instances:
Total Actual Class instances:
Misclassification Rate Calculation:
Accuracy Calculation:
Complement Relationship:
Sensitivity Calculation:
Specificity Calculation:
Asymmetric Class Importance and Rare Event Contexts
Asymmetric Class Dynamics:
In many real-world applications, identifying rare target events (minority class) is significantly more critical than correctly classifying common baseline events (majority class).
Examples of Asymmetric Class Domains:
Tax Fraud: Across approximately tax returns filed in the United States, only a tiny fraction are fraudulent. A naive model predicting "zero fraud" achieves high overall accuracy but captures no fraud. Authorities accept auditing non-fraudulent taxpayers (false positives) in exchange for catching actual tax fraud.
Credit Default: Most bank borrowers repay debts; identifying the small percentage of borrowers who default is critical.
Promotional Offers: Only a small fraction of recipients respond to marketing emails/mailers.
Network Intrusion: Standard network traffic accounts for almost all activity; catching rare unauthorized intrusions is paramount.
Flight Delays: Most flights operate on time; detecting minor delay occurrences is essential for management.
Strategic Trade-off:
Modelers intentionally accept higher overall error rates (more false positives) to maximize sensitivity in capturing rare events of interest.
Receiver Operating Characteristic (ROC) Curve and Area Under the Curve (AUC)
Receiver Operating Characteristic (ROC) Curve:
A graphical plot displaying the explicit trade-off between True Positive Rate (Sensitivity) and False Positive Rate.
Center Diagonal Dashed Line: Represents performance equivalent to random guessing ( performance baseline).
Zigzag Solid Line: Represents the actual predictive performance profile of the model across varying classification thresholds.
Interpretation Example:
At a False Positive Rate of approximately () (misclassifying of non-fraudulent cases as fraudulent), the model captures approximately () of True Positives (actual fraudulent returns).
Demonstrates a practical return: capturing of critical rare target events while maintaining an acceptable false positive audit rate of .
Comparing Models via Area Under the Curve (AUC):
Visual ROC curves often overlap when comparing multiple fine-tuned models or complex algorithms (e.g., Logistic Regression vs. other models), making graphical comparison unclear.
Area Under the Curve (AUC) summarizes the total area under an ROC curve into a single scalar value between and .
Numerical AUC Comparison Example:
Logistic Regression (Blue Line): (
Alternative Model 1 (Orange Line): (
Alternative Model 2 (Green Line): (
Decision Rule: Analysts select the optimal predictive model based on higher quantitative AUC values rather than subjective visual inspection of ROC plots.