src.driver.prediction¶
Prediction and assessment logic for MMM V2 workflow.
This module handles model predictions, performance metrics calculation, and model assessment operations.
Module Contents¶
- class src.driver.prediction.Predictor(driver)¶
Handles prediction and assessment operations for V2 architecture.
This class manages prediction generation, R² calculation, and posterior predictive plotting for model assessment.
- predict_on_test() numpy.ndarray | Any¶
Generates posterior predictive samples using the test dataset.
- Returns:
Posterior predictive samples array.
- Raises:
ValueError – If model not available or test set is empty.
- calculate_train_r_squared() float¶
Calculates the R-squared value of the model on the training set.
- Returns:
R-squared value for training set predictions.
- Raises:
ValueError – If model not available.
KeyError – If target variable not found in predictions.
- plot_posterior_predictive() matplotlib.figure.Figure¶
Generates and plots posterior predictive samples.
- Returns:
Matplotlib figure with posterior predictive check.
- Raises:
ValueError – If model not available.