classifierpromax.ResultHandler ============================== .. py:module:: classifierpromax.ResultHandler Functions --------- .. autoapisummary:: classifierpromax.ResultHandler.ResultHandler Module Contents --------------- .. py:function:: ResultHandler(scoring_dict_trainer, scoring_dict_optimizer=None, std=False) Processes and combines scoring results from model training and optimization. Parameters: ----------- scoring_dict_trainer : dict A dictionary where keys are model names and values are DataFrames containing scoring metrics (e.g., mean and standard deviation) for the baseline (non-optimized) models. scoring_dict_optimizer : dict, optional A dictionary where keys are model names and values are DataFrames containing scoring metrics (e.g., mean and standard deviation) for the optimized models. Default is None. std : bool, optional If `True`, returns both the mean and standard deviation of the scores. If `False`, filters the results to only include the mean scores. Default is `False`. Returns: -------- pandas.DataFrame A DataFrame containing the combined scoring metrics: - If `scoring_dict_optimizer` is provided, the result includes both baseline and optimized scores, with column names indicating the source (e.g., `model_baseline` and `model_optimized`). - If `std` is `False`, the result includes only the mean scores. Otherwise, both mean and standard deviation scores are included. - If `scoring_dict_optimizer` is not provided, only the baseline scores are returned. Raises: ------- ValueError If `scoring_dict_trainer` is not a dictionary. If `scoring_dict_optimizer` is provided but not a dictionary. If any value in `scoring_dict_trainer` or `scoring_dict_optimizer` is not a pandas DataFrame. If `std` is not a boolean value. Example: -------- >>> scoring_dict_trainer = { >>> "model1": pd.DataFrame({"mean": [0.85], "std": [0.03]}), >>> "model2": pd.DataFrame({"mean": [0.80], "std": [0.04]}) >>> } >>> scoring_dict_optimizer = { >>> "model1": pd.DataFrame({"mean": [0.88], "std": [0.02]}), >>> "model2": pd.DataFrame({"mean": [0.83], "std": [0.03]}) >>> } >>> ResultHandler(scoring_dict_trainer, scoring_dict_optimizer, std=False)