def birth_create_new_comps(self, hmodel, SS, BirthPlans=list(), Data=None):
    if Data is not None:
      if hasattr(Data, 'nDoc'):
        wordPerDocThr = self.algParams['birth']['birthWordsPerDocThr']
        if wordPerDocThr > 0:
          nWordPerDoc = np.asarray(Data.to_sparse_docword_matrix().sum(axis=1))
          candidates = nWordPerDoc >= wordPerDocThr
          candidates = np.flatnonzero(candidates)
        else:
          candidates = None
        targetData = Data.get_random_sample(
                                self.algParams['birth']['maxTargetSize'],
                                randstate=self.PRNG, candidates=candidates)
      else:
        targetData = Data.get_random_sample(
                                self.algParams['birth']['maxTargetObs'],
                                randstate=self.PRNG)


      Plan = dict(Data=targetData, ktarget=-1)
      BirthPlans = [Plan]

    nMoves = len(BirthPlans)
    BirthResults = list()
    for moveID, Plan in enumerate(BirthPlans):
      # Unpack data for current move
      ktarget = Plan['ktarget']
      targetData = Plan['Data']

      if ktarget is None or targetData is None:
        msg = Plan['msg']

      elif targetData.nObs < self.algParams['birth']['minTargetObs']:
        # Verify targetData large enough that birth would be productive
        msg = "BIRTH skipped. Target data too small (size %d)"
        msg = msg % (targetData.nObs)
      elif hasattr(targetData, 'nDoc') \
           and targetData.nDoc < self.algParams['birth']['minTargetSize']:
        msg = "BIRTH skipped. Target data too small (size %d)"
        msg = msg % (targetData.nDoc)

      else:
        hmodel, SS, MoveInfo = BirthMove.run_birth_move(
                 hmodel, targetData, SS, randstate=self.PRNG, 
                 ktarget=ktarget, **self.algParams['birth'])
        msg = MoveInfo['msg']
        if MoveInfo['didAddNew']:
          BirthResults.append(MoveInfo)

          for kk in MoveInfo['birthCompIDs']:
            self.LapsSinceLastBirth[kk] = -1

      if Data is None:
          self.print_msg( "%d/%d %s" % (moveID+1, nMoves, msg) )
      else:
          self.print_msg( "%d/%d BATCH %s" % (moveID+1, nMoves, msg) )

    return hmodel, SS, BirthResults
Create new components 
dataset/ETHPy150Open daeilkim/refinery/refinery/bnpy/bnpy-dev/bnpy/learnalg/MemoizedOnlineVBLearnAlg.py/MemoizedOnlineVBLearnAlg.birth_create_new_comps