def METHOD_NAME(self, X, sample_weight):
    """Private method to establish CapeCod Apriori"""
    if X.is_cumulative == False:
        X = X.sum("development").val_to_dev()
    latest = X.latest_diagonal
    len_orig = sample_weight.shape[-2]
    reported_exposure = sample_weight / self._align_cdf(X.copy(), sample_weight)
    reported_exposure = reported_exposure.set_backend(latest.array_backend)
    if self.groupby is not None:
        latest = latest.groupby(self.groupby).sum()
        reported_exposure = reported_exposure.groupby(self.groupby).sum()
    trend_array = self._trend(X.iloc[0] * 0 + 1)
    X_olf_array = self._onlevel(X)
    sw_olf_array = self._onlevel(sample_weight)
    xp = reported_exposure.get_array_module()
    decay_matrix = self.decay ** xp.abs(
        xp.arange(len_orig)[None].T - xp.arange(len_orig)[None]
    )
    weighted_exposure = xp.swapaxes(reported_exposure.values, -1, -2) * decay_matrix
    trended_ultimate = (latest.values * trend_array * X_olf_array) / (
        reported_exposure.values * sw_olf_array
    )
    trended_ultimate = xp.swapaxes(trended_ultimate, -1, -2)
    apriori = xp.nansum(weighted_exposure * trended_ultimate, -1) / xp.nansum(
        weighted_exposure, -1
    )
    apriori_ = reported_exposure.copy()
    apriori_.values = apriori[..., None]
    detrended_apriori_ = apriori_ / trend_array / X_olf_array * sw_olf_array
    return self._set_ult_attr(apriori_), self._set_ult_attr(detrended_apriori_)