def _compute_overlaps_conflicts(
        self,
        has_weak_label: np.ndarray,
        has_overlaps_or_conflicts: np.ndarray,
        coverage: np.ndarray,
        normalize_by_coverage: bool,
    ) -> np.ndarray:
        """Helper method to compute the overlaps/conflicts and optionally normalize them by the respective coverage

        Args:
            has_weak_label: 2D boolean matrix (i, j) that indicates if the record i has a weak label from rule j.
            has_overlaps_or_conflicts: Array that indicates if the record has overlapping/conflicting weak labels.
            coverage: Array of coverages for each rule
            normalize_by_coverage: Normalize the overlaps/conflicts by the respective coverage.

        Returns:
            Array of fractions of overlaps/conflicts for each rule, optionally normalized by their coverages.
        """
        overlaps_or_conflicts = (
            has_weak_label * np.repeat(has_overlaps_or_conflicts, len(self._rules)).reshape(has_weak_label.shape)
        ).sum(axis=0) / len(self._records)
        # total
        overlaps_or_conflicts = np.append(overlaps_or_conflicts, has_overlaps_or_conflicts.sum() / len(self._records))

        if normalize_by_coverage:
            # ignore division by 0 warnings, as we convert the nan back to 0.0 afterwards
            with np.errstate(divide="ignore", invalid="ignore"):
                overlaps_or_conflicts /= coverage
            return np.nan_to_num(overlaps_or_conflicts)

        return overlaps_or_conflicts
Helper method to compute the overlaps/conflicts and optionally normalize them by the respective coverage

        Args:
            has_weak_label: 2D boolean matrix (i, j) that indicates if the record i has a weak label from rule j.
            has_overlaps_or_conflicts: Array that indicates if the record has overlapping/conflicting weak labels.
            coverage: Array of coverages for each rule
            normalize_by_coverage: Normalize the overlaps/conflicts by the respective coverage.

        Returns:
            Array of fractions of overlaps/conflicts for each rule, optionally normalized by their coverages.
        
argilla-v1/src/argilla_v1/labeling/text_classification/weak_labels.py