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 (ϵ\epsilon):

ϵ=Actual Value−Predicted Value\epsilon = \text{Actual Value} - \text{Predicted Value}

  • 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 (NN):

Average Error=∑ϵN\text{Average Error} = \frac{\sum \epsilon}{N}

  • 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 00, 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 (NN):

MAE=∑∣ϵ∣N\text{MAE} = \frac{\sum |\epsilon|}{N}

  • 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 (NN) 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 00 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 (SST\text{SST}) represents total target variation relative to the simple average benchmark.

    • SST\text{SST} decomposes mathematically into explained and unexplained error portions:

SST=SSR+SSE\text{SST} = \text{SSR} + \text{SSE}

  • Explained Portion (SSR\text{SSR} - Sum of Squares due to Regression): Measures the squared difference between model predictions and the naive average baseline prediction.

  • Unexplained Portion (SSE\text{SSE} - Sum of Squares due to Error): Measures the squared difference between actual target values and model predictions.

Coefficient of Determination (R2R^2) and Adjusted R2R^2

  • Coefficient of Determination (R2R^2):

    • Calculated as the ratio of explained variation (SSR\text{SSR}) to total variation (SST\text{SST}):

R2=SSRSSTR^2 = \frac{\text{SSR}}{\text{SST}}

  • Represents the proportion of total target error variance explained by the predictive model.

    • Structural Limitation of R2R^2:

  • 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 R2R^2 even when the added variables provide no genuine predictive value.

    • Adjusted R2R^2:

  • 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 00: Uninteresting / Default Negative Class (e.g., Non-Fraudulent transaction).

    • Class 11: Target / Positive Class of Interest (e.g., Fraudulent transaction).

  • Four Quadrants of the Confusion Matrix:

    • True Negative (TN): Actual Class = 00, Predicted Class = 00 (Correctly classified negative).

    • False Positive (FP): Actual Class = 00, Predicted Class = 11 (Incorrectly classified positive).

    • False Negative (FN): Actual Class = 11, Predicted Class = 00 (Incorrectly classified negative).

    • True Positive (TP): Actual Class = 11, Predicted Class = 11 (Correctly classified positive).

  • Mathematical Formulations for Classification Metrics:

    • Misclassification Rate:

Misclassification Rate=FP+FNTotal Observations\text{Misclassification Rate} = \frac{\text{FP} + \text{FN}}{\text{Total Observations}}

  • Accuracy:

Accuracy=TP+TNTotal Observations\text{Accuracy} = \frac{\text{TP} + \text{TN}}{\text{Total Observations}}

  • Sensitivity (True Positive Rate / Recall):

Sensitivity=TPTP+FN\text{Sensitivity} = \frac{\text{TP}}{\text{TP} + \text{FN}}

- Measures the percentage of actual positive instances successfully captured by the model.
  • Specificity (True Negative Rate):

Specificity=TNTN+FP\text{Specificity} = \frac{\text{TN}}{\text{TN} + \text{FP}}

- Measures the percentage of actual negative instances successfully identified by the model.

Detailed Numerical Example of Classification Metrics

  • Sample Dataset Metrics (4444 total observations):

    • Actual Class 00 predicted as Class 11 (False Positives, FP): 44

    • Actual Class 11 predicted as Class 00 (False Negatives, FN): 2020

    • Actual Class 00 predicted as Class 00 (True Negatives, TN): 1212

    • Actual Class 11 predicted as Class 11 (True Positives, TP): 88

    • Total Actual Class 00 instances: 12+4=1612 + 4 = 16

    • Total Actual Class 11 instances: 20+8=2820 + 8 = 28

  • Misclassification Rate Calculation:

Misclassification Rate=4+2044=2444=0.5455\text{Misclassification Rate} = \frac{4 + 20}{44} = \frac{24}{44} = 0.5455

  • Accuracy Calculation:

Accuracy=12+844=2044=0.4545\text{Accuracy} = \frac{12 + 8}{44} = \frac{20}{44} = 0.4545

  • Complement Relationship: Accuracy=1−Misclassification Rate=1−0.5455=0.4545\text{Accuracy} = 1 - \text{Misclassification Rate} = 1 - 0.5455 = 0.4545

    • Sensitivity Calculation:

Sensitivity=88+20=828=0.2857\text{Sensitivity} = \frac{8}{8 + 20} = \frac{8}{28} = 0.2857

  • Specificity Calculation:

Specificity=1212+4=1216=0.75\text{Specificity} = \frac{12}{12 + 4} = \frac{12}{16} = 0.75

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 100,000,000100,000,000 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 (50%50\% 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 18%18\% (0.180.18) (misclassifying 18%18\% of non-fraudulent cases as fraudulent), the model captures approximately 83%83\% (0.830.83) of True Positives (actual fraudulent returns).

    • Demonstrates a practical return: capturing 83%83\% of critical rare target events while maintaining an acceptable false positive audit rate of 18%18\%.

  • 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 00 and 11.

  • Numerical AUC Comparison Example:

    • Logistic Regression (Blue Line): AUC=0.92\text{AUC} = 0.92 (92%92\%

    • Alternative Model 1 (Orange Line): AUC=0.91\text{AUC} = 0.91 (91%91\%

    • Alternative Model 2 (Green Line): AUC=0.92\text{AUC} = 0.92 (92%92\%

  • Decision Rule: Analysts select the optimal predictive model based on higher quantitative AUC values rather than subjective visual inspection of ROC plots.