Exemplo n.º 1
0
    def _m_step(
        self,
        x,
        quadratic_form,
        affiliation,
        saliency,
        hermitize,
        covariance_norm,
        eigenvalue_floor,
        weight_constant_axis,
    ):
        weight = estimate_mixture_weight(
            affiliation=affiliation,
            saliency=saliency,
            weight_constant_axis=weight_constant_axis,
        )

        if saliency is None:
            masked_affiliation = affiliation
        else:
            masked_affiliation = affiliation * saliency[..., None, :]

        cacg = ComplexAngularCentralGaussianTrainer()._fit(
            y=x[..., None, :, :],
            saliency=masked_affiliation,
            quadratic_form=quadratic_form,
            hermitize=hermitize,
            covariance_norm=covariance_norm,
            eigenvalue_floor=eigenvalue_floor,
        )
        return CACGMM(weight=weight, cacg=cacg)
Exemplo n.º 2
0
    def _m_step(
        self,
        x,
        affiliation,
        saliency,
        weight_constant_axis,
        covariance_type,
        fixed_covariance,
    ):
        weight = estimate_mixture_weight(
            affiliation=affiliation,
            saliency=saliency,
            weight_constant_axis=weight_constant_axis,
        )

        gaussian = GaussianTrainer()._fit(y=x[..., None, :, :],
                                          saliency=affiliation *
                                          saliency[..., None, :],
                                          covariance_type=covariance_type)

        if fixed_covariance is not None:
            assert fixed_covariance.shape == gaussian.covariance.shape, (
                f'{fixed_covariance.shape} != {gaussian.covariance.shape}')
            gaussian = gaussian.__class__(mean=gaussian.mean,
                                          covariance=fixed_covariance)

        return GMM(weight=weight, gaussian=gaussian)
Exemplo n.º 3
0
    def _m_step(
        self,
        y,
        affiliation,
        saliency,
        weight_constant_axis,
        min_concentration,
        max_concentration,
    ):
        weight = estimate_mixture_weight(
            affiliation=affiliation,
            saliency=saliency,
            weight_constant_axis=weight_constant_axis,
        )

        vmf = VonMisesFisherTrainer()._fit(
            y=y[..., None, :, :],
            saliency=affiliation * saliency[..., None, :],
            min_concentration=min_concentration,
            max_concentration=max_concentration,
        )
        return VMFMM(weight=weight, vmf=vmf)
Exemplo n.º 4
0
    def _m_step(
        self,
        y,
        affiliation,
        saliency,
        weight_constant_axis,
    ):
        weight = estimate_mixture_weight(
            affiliation=affiliation,
            saliency=saliency,
            weight_constant_axis=weight_constant_axis,
        )

        if saliency is None:
            masked_affiliation = affiliation
        else:
            masked_affiliation = affiliation * saliency[..., None, :]

        complex_bingham = self.complex_bingham_trainer._fit(
            y=y[..., None, :, :],
            saliency=masked_affiliation,
        )
        return CBMM(weight=weight, complex_bingham=complex_bingham)
Exemplo n.º 5
0
    def _m_step(
        self,
        y,
        affiliation,
        saliency,
        weight_constant_axis,
    ):
        weight = estimate_mixture_weight(
            affiliation=affiliation,
            saliency=saliency,
            weight_constant_axis=weight_constant_axis,
            # dirichlet_prior_concentration=dirichlet_prior_concentration,
        )

        if saliency is None:
            masked_affiliation = affiliation
        else:
            masked_affiliation = affiliation * saliency[..., None, :]

        complex_watson = self.complex_watson_trainer._fit(
            y=y[..., None, :, :],
            saliency=masked_affiliation,
        )
        return CWMM(weight=weight, complex_watson=complex_watson)