code: def __proportional_function(self, doc, token, new_topic):
      if isinstance(doc, LDADoc) and isinstance(token, Token):
          old_topic = token.topic
          dt_alpha = doc.topic_sum(new_topic) + self.__model.alpha()
          wt_beta = (
              self.__model.word_topic_value(token.id, new_topic)
              + self.__model.beta()
          )
          t_sum_beta_sum = (
              self.__model.topic_sum_value(new_topic)
              + self.__model.beta_sum()
          )
          if new_topic == old_topic and wt_beta > 1:
              if dt_alpha > 1:
                  dt_alpha -= 1
              wt_beta -= 1
              t_sum_beta_sum -= 1
          return dt_alpha * wt_beta / t_sum_beta_sum
  
      elif isinstance(doc, SLDADoc) and isinstance(token, Sentence):
          sent = token
          old_topic = sent.topic
          result = doc.topic_sum(new_topic) + self.__model.alpha()
          if new_topic == old_topic:
              result -= 1
          for word_id in sent.tokens:
              wt_beta = (
                  self.__model.word_topic_value(word_id, new_topic)
                  + self.__model.beta()
              )
              t_sum_beta_sum = (
                  self.__model.topic_sum_value(new_topic)
                  + self.__model.beta_sum()
              )
              if new_topic == old_topic and wt_beta > 1:
                  wt_beta -= 1
                  t_sum_beta_sum -= 1
              result *= wt_beta / t_sum_beta_sum
          return result
      else:
          logger.error("Wrong input argument type!")
  
imports: import os
  import numpy
  from tqdm import tqdm
  from paddlehub.common.logger import logger
  from slda_news.document import LDADoc, SLDADoc, Token, Sentence
  from slda_news.vose_alias import VoseAlias
  from slda_news.util import rand, rand_k
label_desc: Use image node_id 8 for calling the MHSampler obj's underlying member method code with example usage: obj.__proportional_function(doc, token, new_topic) and returns: unknown, result