def max_likelihood(self, data, weights=None, stats=None):
        """
        Maximize the likelihood for given data
        :param data:
        :param weights:
        :param stats:
        :return:
        """
        if isinstance(data, list):
            x = np.vstack([d[0] for d in data])
            y = np.vstack([d[1] for d in data])
        elif isinstance(data, tuple):
            assert len(data) == 2
        elif isinstance(data, np.ndarray):
            x, y = data[:,:self.D_in], data[:, self.D_in:]
        else:
            raise Exception("Invalid data type")

        from sklearn.linear_model import LogisticRegression
        for n in progprint_xrange(self.D_out):
            lr = LogisticRegression(fit_intercept=False)
            lr.fit(x, y[:,n])
            self.A[n] = lr.coef_
def max_likelihood ( self , data , weights = None , stats = None ) : if isinstance ( data , list ) : x = np . vstack ( [ d [ 0 ] for d in data ] ) y = np . vstack ( [ d [ 1 ] for d in data ] ) elif isinstance ( data , tuple ) : assert len ( data ) == 2 elif isinstance ( data , np . ndarray ) : x , y = data [ : , : self . D_in ] , data [ : , self . D_in : ] else : raise Exception ( "Invalid data type" ) from sklearn . linear_model import LogisticRegression for n in progprint_xrange ( self . D_out ) : lr = LogisticRegression ( fit_intercept = False ) lr . fit ( x , y [ : , n ] ) self . A [ n ] = lr . coef_
Maximize the likelihood for given data
        :param data:
        :param weights:
        :param stats:
        :return: