plaid.post.metrics ================== .. py:module:: plaid.post.metrics .. autoapi-nested-parse:: Utility functions for computing and printing metrics for regression problems in PLAID. Functions --------- .. autoapisummary:: plaid.post.metrics.compute_rRMSE_RMSE plaid.post.metrics.compute_R2 plaid.post.metrics.prepare_metrics_for_split plaid.post.metrics.pretty_metrics plaid.post.metrics.compute_metrics Module Contents --------------- .. py:function:: compute_rRMSE_RMSE(metrics: dict, rel_SE_out_scalars: dict, abs_SE_out_scalars: dict, problem_split: dict, out_scalars_names: list[str]) -> None Compute and print the relative Root Mean Square Error (rRMSE) for scalar outputs. :param metrics: Dictionary to store the computed metrics. :type metrics: dict :param rel_SE_out_scalars: Dictionary containing relative squared errors for scalar outputs. :type rel_SE_out_scalars: dict :param abs_SE_out_scalars: Dictionary containing absolute squared errors for scalar outputs. :type abs_SE_out_scalars: dict :param problem_split: Dictionary specifying how the problem is split. :type problem_split: dict :param out_scalars_names: List of names of scalar outputs. :type out_scalars_names: list[str] .. py:function:: compute_R2(metrics: dict, r2_out_scalars: dict, problem_split: dict, out_scalars_names: list[str]) -> None Compute and print the R-squared (R2) score for scalar outputs. :param metrics: Dictionary to store the computed metrics. :type metrics: dict :param r2_out_scalars: Dictionary containing R2 scores for scalar outputs. :type r2_out_scalars: dict :param problem_split: Dictionary specifying how the problem is split. :type problem_split: dict :param out_scalars_names: List of names of scalar outputs. :type out_scalars_names: list[str] .. py:function:: prepare_metrics_for_split(ref_out_specific_scalars: numpy.ndarray, pred_out_specific_scalars: numpy.ndarray, split_indices: list[int], rel_SE_out_specific_scalars: numpy.ndarray, abs_SE_out_specific_scalars: numpy.ndarray) -> float Prepare metrics for a specific split and compute the R-squared (R2) score. :param ref_out_specific_scalars: Array of reference scalar outputs. :type ref_out_specific_scalars: np.ndarray :param pred_out_specific_scalars: Array of predicted scalar outputs. :type pred_out_specific_scalars: np.ndarray :param split_indices: List of indices specifying the split. :type split_indices: list[int] :param rel_SE_out_specific_scalars: Array to store relative squared errors for scalar outputs. :type rel_SE_out_specific_scalars: np.ndarray :param abs_SE_out_specific_scalars: Array to store absolute squared errors for scalar outputs. :type abs_SE_out_specific_scalars: np.ndarray :returns: R-squared (R2) score for the specific split. :rtype: float .. py:function:: pretty_metrics(metrics: dict) -> None Prints metrics information in a readable format (pretty print). :param metrics: The metrics dictionary to print. :type metrics: dict .. py:function:: compute_metrics(ref_dataset: Union[plaid.Dataset, str, pathlib.Path], pred_dataset: Union[plaid.Dataset, str, pathlib.Path], problem: Union[plaid.ProblemDefinition, str, pathlib.Path], save_file_name: str = 'test_metrics', verbose: bool = False) -> None Compute and save evaluation metrics for a given regression problem. :param ref_dataset: Reference dataset or path to a reference dataset. :type ref_dataset: Dataset | str | Path :param pred_dataset: Predicted dataset or path to a predicted dataset. :type pred_dataset: Dataset | str | Path :param problem: Problem definition or path to a problem definition. :type problem: ProblemDefinition | str | Path :param save_file_name: Name of the file to save the metrics. Defaults to "test_metrics". :type save_file_name: str, optional :param verbose: If True, print detailed information during computation. :type verbose: bool, optional