def run_birth_move(curModel, targetData, SS, randstate=np.random, 
                    ktarget=None, **kwargs):
  ''' Create new model that expands curModel with several new components

      Args
      --------
      curModel : bnpy HModel
      targetData : bnpy DataObj
      SS : bnpy SuffStatBag
      randstate : numpy random number generator
      ktarget : int id of target component (for visualization only)
      
      Returns
      --------
      model : bnpy HModel
      SS : bnpy SuffStatBag
      MoveInfo : dict, with fields
  '''
  try:
    if SS is None:
      msg = "BIRTH failed. SS must be valid SuffStatBag, not None."
      raise BirthProposalError(msg)

    if kwargs['topicmodelbirth']:
      assert hasattr(targetData, 'nDoc')
      import BirthMoveTopicModel
      freshSS = BirthMoveTopicModel.create_expanded_suff_stats(
                                targetData, curModel, SS,
                                randstate=randstate, **kwargs)
      kwargs['doRemoveRedundant'] = True
      kwargs['cleanupModifyOrigComps'] = True
    else:
      freshModel = curModel.copy()
      freshSS = learn_fresh_model(freshModel, targetData, 
                              randstate=randstate, curModel=curModel, **kwargs)

    Kfresh = freshSS.K
    Kold = curModel.obsModel.K
    assert Kold == SS.K

    # TODO: remove this hack!
    if hasattr(SS, 'Nmajor'):
      freshSS.setField('Nmajor', np.zeros(freshSS.K), dims='K')
    newSS = SS.copy()

    if kwargs['doRemoveRedundant'] and kwargs['cleanupModifyOrigComps']:
      newSS.insertEmptyComps(Kfresh - Kold)
      newSS += freshSS
      birthCompIDs = range(Kold, Kfresh)
      modifiedCompIDs = range(Kfresh)
    else:
      newSS.insertComps(freshSS)
      birthCompIDs = range(Kold, Kold+Kfresh)
      modifiedCompIDs = range(Kold, Kold+Kfresh)
    
    newModel = curModel.copy()
    newModel.update_global_params(newSS)

    MoveInfo = dict(didAddNew=True,
                    msg='BIRTH: %d fresh comps' % (len(birthCompIDs)),
                    modifiedCompIDs=modifiedCompIDs,
                    birthCompIDs=birthCompIDs,
                    extraSS=freshSS)

    if kwargs in 'doVizBirth' and kwargs['doVizBirth']:
      viz_birth_proposal_2D(curModel, newModel, ktarget, birthCompIDs)

    return newModel, newSS, MoveInfo
  except BirthProposalError, e:
    MoveInfo = dict(didAddNew=False, msg=str(e),
                    birthCompIDs=[], modifiedCompIDs=[])
    return curModel, SS, MoveInfo
dataset/ETHPy150Open daeilkim/refinery/refinery/bnpy/bnpy-dev/bnpy/learnalg/BirthMove.py/run_birth_move/swapped operands of `in`