bluecast.evaluation.error_analysis_regression¶
Module Contents¶
Classes¶
- class bluecast.evaluation.error_analysis_regression.OutOfFoldDataReaderRegression(bluecast_instance: bluecast.blueprints.cast_regression.BlueCastRegression)¶
Bases:
bluecast.evaluation.base_classes.DataReader- read_data_from_bluecast_instance() polars.DataFrame¶
Read out of fold datasetsfrom defined storage location.
- Returns:
Out of fold dataset.
- read_data_from_bluecast_cv_instance() polars.DataFrame¶
Function to fail when called.
Please use read_data_from_bluecast_instance instead. :return: Will raise an error.
- class bluecast.evaluation.error_analysis_regression.OutOfFoldDataReaderRegressionCV(bluecast_instance: bluecast.blueprints.cast_cv_regression.BlueCastCVRegression)¶
Bases:
bluecast.evaluation.base_classes.DataReader- read_data_from_bluecast_instance() polars.DataFrame¶
Function to fail when called.
Please use read_data_from_bluecast_cv_instance instead. :return: Will raise an error.
- read_data_from_bluecast_cv_instance() polars.DataFrame¶
Read out of fold datasets from defined storage location.
- Returns:
Concatenated out of fold dataset.
- class bluecast.evaluation.error_analysis_regression.ErrorAnalyserRegressionMixin¶
Bases:
bluecast.evaluation.base_classes.ErrorAnalyser- analyse_errors(df: pandas.DataFrame | polars.DataFrame, descending: bool = True) polars.DataFrame¶
Find mean absolute errors for all subsegments :param df: Preprocessed out of fold DataFrame. :param descending: Bool indicating if errors shall be ordered descending in final DataFrame. :return: Polars DataFrame with all subsegments and mean absolute error in each of them.
- class bluecast.evaluation.error_analysis_regression.ErrorDistributionRegressionPlotterMixin(ignore_columns_during_visualization: List[str])¶
Bases:
bluecast.evaluation.base_classes.ErrorDistributionPlotter- plot_error_distributions(df: polars.DataFrame, target_column: str = 'target_quantiles')¶
- class bluecast.evaluation.error_analysis_regression.ErrorAnalyserRegression(bluecast_instance: bluecast.blueprints.cast_regression.BlueCastRegression, ignore_columns_during_visualization=None)¶
Bases:
OutOfFoldDataReaderRegression,bluecast.evaluation.base_classes.ErrorPreprocessor,ErrorAnalyserRegressionMixin,ErrorDistributionRegressionPlotterMixin- stack_predictions_by_class(df: polars.DataFrame) polars.DataFrame¶
Add additional column with binned target.
- Parameters:
df – Polars DataFrame with original targets.
- Returns:
Polars DataFrame with additional binned targets column.
- calculate_errors(df: pandas.DataFrame | polars.DataFrame) polars.DataFrame¶
Analyse errors of predictions on out of fold data.
- Parameters:
df – DataFrame holding out of fold data and predictions.
- Returns:
Polars DataFrame with additional ‘prediction_error’ column.
- analyse_segment_errors() polars.DataFrame¶
Pipeline for error analysis.
Reads the out of fold datasets from the output location defined in the training config inside the provided BlueCast instance, preprocess the data and calculate errors for all subsegments of the data. Numerical columns will be split into quantiles to get subsegments. :return: Polars DataFrame with subsegments and errors.
- class bluecast.evaluation.error_analysis_regression.ErrorAnalyserRegressionCV(bluecast_instance: bluecast.blueprints.cast_cv_regression.BlueCastCVRegression, ignore_columns_during_visualization=None)¶
Bases:
OutOfFoldDataReaderRegressionCV,bluecast.evaluation.base_classes.ErrorPreprocessor,ErrorAnalyserRegressionMixin,ErrorDistributionRegressionPlotterMixin- stack_predictions_by_class(df: polars.DataFrame) polars.DataFrame¶
Add additional column with binned target.
- Parameters:
df – Polars DataFrame with original targets.
- Returns:
Polars DataFrame with additional binned targets column.
- calculate_errors(df: pandas.DataFrame | polars.DataFrame)¶
Analyse errors of predictions on out of fold data.
- Parameters:
df – DataFrame holding out of fold data and predictions.
loss_func – Function that takes (y_true, y_pred) and returns a score. Will be used to evaluate prediction errors.
- Returns:
None
- analyse_segment_errors() polars.DataFrame¶
Pipeline for error analysis.
Reads the out of fold datasets from the output location defined in the training config inside the provided BlueCast instance, preprocess the data and calculate errors for all subsegments of the data. Numerical columns will be split into quantiles to get subsegments. :return: Polars DataFrame with subsegments and errors.