def METHOD_NAME(
    metrics_directory: str,
    output_directory: str,
    relative_threshold: float,
    absolute_threshold: float,
):
    root = Path(metrics_directory)
    metrics: dict[str, dict[str, dict[datetime, float]]] = defaultdict(
        lambda: defaultdict(dict)
    )
    clean = True
    # First process the metrics JSON files
    for metric_file_path in root.glob("metric*.json"):
        date, model_name, metric = parse_metric_file(metric_file_path)
        # Then process the report
        is_binary = len(metric["report"]["targets"]) == 2
        if is_binary:
            for target, target_metrics in metric["report"]["targets"].items():
                for key, value in target_metrics.items():
                    if key not in REPORT_METRICS:
                        continue
                    metrics[model_name][f"{key}_class_{target}"][date] = value
        for key, value in metric["report"]["average"].items():
            if key not in REPORT_METRICS:
                continue
            metrics[model_name][key][date] = value
        # Also process the test_* metrics
        for key, value in metric.items():
            if not key.startswith("test_"):
                continue
            metrics[model_name][f"{key}_mean"][date] = value["mean"]
            metrics[model_name][f"{key}_std"][date] = value["std"]
    # Then analyze them
    for model_name in metrics:
        for metric_name, values in metrics[model_name].items():
            if metric_name.endswith("_std"):
                LOGGER.info(
                    "Skipping analysis of %r, analysis is not efficient on standard deviation",
                    metric_name,
                )
                continue
            df = DataFrame.from_dict(values, orient="index", columns=["value"])
            df = df.sort_index()
            # Compute the absolute threshold for the metric
            max_value = max(df["value"])
            metric_threshold = max_value - absolute_threshold
            threshold_crossed = df.value[-1] < metric_threshold
            if threshold_crossed:
                LOGGER.warning(
                    "Last metric %r for model %s is at least %f less than the max",
                    metric_name,
                    model_name,
                    ABSOLUTE_THRESHOLD,
                )
                clean = False
            # Compute the relative threshold for the metric
            if len(df["value"]) >= 2:
                before_last_value = df["value"][-2]
            else:
                before_last_value = df["value"][-1]
            relative_metric_threshold = before_last_value * relative_threshold
            relative_threshold_crossed = df.value[-1] < relative_metric_threshold
            if relative_threshold_crossed:
                diff = (1 - relative_threshold) * 100
                LOGGER.warning(
                    "Last metric %r for model %s is %f%% worse than the previous one",
                    metric_name,
                    model_name,
                    diff,
                )
                clean = False
            # Plot the non-smoothed graph
            title = f"{model_name} {metric_name}"
            file_path = f"{model_name}_{metric_name}.svg"
            plot_graph(
                model_name,
                metric_name,
                df,
                title,
                Path(output_directory),
                file_path,
                metric_threshold,
            )
    if not clean:
        sys.exit(1)