def initialize_from_data(self, pi_lim=None, initialize_to_mle=True):
        for data in self.data_list:
            # Compute the empirical probability
            X = data["X"]
            M = data["M"]
            assert X.ndim == 2 and X.shape[1] == self.K

            # Get the empirical probabilities (offset by 1 to ensure nonzero)
            alpha = 1
            pi_emp = (alpha+X).astype(np.float) / \
                           (alpha + X).sum(axis=1)[:,None]
            pi_emp_mean = pi_emp.mean(axis=0)


            # Set mu equal to the empirical mean value of pi
            psi_emp_mean = pi_to_psi(pi_emp_mean)
            self.mu = psi_emp_mean
            # self.mu = np.zeros(self.K-1)

            if initialize_to_mle:
                # Convert empirical values to psi
                psi_emp = np.array([pi_to_psi(p) for p in pi_emp])
                psi_emp -= self.mu
                assert psi_emp.shape == (M, self.K-1)

                # Set the deviations from the mean to zero
                data["psi"] = psi_emp
            else:
                data["psi"] = np.zeros((M, self.K-1))

        # Resample the omegas
        self.resample_omega()
Create a Tdiscarded message for 'tag'
dataset/ETHPy150Open HIPS/pgmult/pgmult/gp.py/_MultinomialGPGibbsSampling.initialize_from_data--crossover with--dataset/ETHPy150Open steveniemitz/scales/scales/thriftmux/sink.py/SocketTransportSink._CreateDiscardMessage