def set_global_params(self, hmodel=None, 
                                U1=None, U0=None, 
                                K=0, beta=None, topic_prior=None,
                                Ebeta=None, EbetaLeftover=None, theta=None, **kwargs):
        if hmodel is not None:
          self.K = hmodel.allocModel.K
          self.U1 = hmodel.allocModel.U1
          self.U0 = hmodel.allocModel.U0
          self.set_helper_params()
          return

        if U1 is not None and U0 is not None:
          self.U1 = U1
          self.U0 = U0
          self.K = U1.size
          self.set_helper_params()
          return

        if Ebeta is not None and EbetaLeftover is not None:
          Ebeta = np.squeeze(Ebeta)
          EbetaLeftover = np.squeeze(EbetaLeftover)
          beta = np.hstack( [Ebeta, EbetaLeftover])
          self.K = beta.size - 1
          
        elif beta is not None:
          assert beta.size == K
          beta = np.hstack([beta, np.min(beta)/100.])
          beta = beta/np.sum(beta)
          self.K = beta.size - 1
        else:
          raise ValueError('Bad parameters. Vector beta not specified.')

        # Now, use the specified value of beta to find the best U1, U0
        assert beta.size == self.K + 1
        assert abs(np.sum(beta) - 1.0) < 0.001
        vMean = OptimHDP.beta2v(beta)
        # for each k=1,2...K
        #  find the multiplier vMass[k] such that both are true
        #  1) vMass[k] * vMean[k] > 1.0
        #  2) vMass[k] * (1-vMean[k]) > self.alpha0
        vMass = np.maximum( 1./vMean , self.alpha0/(1.-vMean))
        self.U1 = vMass * vMean
        self.U0 = vMass * (1-vMean)
        assert np.all( self.U1 >= 1.0 - 0.00001)
        assert np.all( self.U0 >= self.alpha0 - 0.00001)
        assert self.U1.size == self.K
        assert self.U0.size == self.K

        ####################################### Set Global Params for Theta
        if theta is not None and beta is not None:
          self.theta = theta
        else:
          self.theta = np.ones( (self.nNodeTotal, self.K + 1 ) )

        self.set_helper_params()



  ######################################################### Evidence
  #########################################################
dataset/ETHPy150Open daeilkim/refinery/refinery/bnpy/bnpy-dev/bnpy/allocmodel/admix/HDPRelModel.py/HDPRelAssortModel.set_global_params/original