old_contents: import numpy as np
  
  class BaseTopicModel():
      """
      Attributes
      ----------
      n_doc: int
          the number of total documents in the corpus
      n_voca: int
          the vocabulary size of the corpus
      verbose: boolean
          if True, print each iteration step while inference.
      """
      def __init__(self, n_doc, n_voca, **kwargs):
          self.n_doc = n_doc
          self.n_voca = n_voca
          self.verbose = kwargs.pop('verbose', True)
  
  
  class BaseGibbsParamTopicModel(BaseTopicModel):
      """ Base class of parametric topic models with Gibbs sampling inference
  
      Attributes
      ----------
      n_topic: int
          a number of topics to be inferred through the Gibbs sampling
      TW: ndarray, shape (n_voca, n_topic)
          word-topic matrix, keeps the number of assigned word tokens for each word-topic pair
      DT: ndarray, shape (n_doc, n_topic)
          document-topic matrix, keeps the number of assigned word tokens for each document-topic pair
      sum_T: ndarray, shape (n_topic)
          number of word tokens assigned for each topic
      alpha: float
          symmetric parameter of Dirichlet prior for document-topic distribution
      beta: float
          symmetric parameter of Dirichlet prior for topic-word distribution
      """
  
      def __init__(self, n_doc, n_voca, n_topic, alpha, beta, **kwargs):
          super(BaseGibbsParamTopicModel, self).__init__(n_doc=n_doc, n_voca=n_voca, **kwargs)
          self.n_topic = n_topic
          self.TW = np.zeros([self.n_topic, self.n_voca])
          self.DT = np.zeros([self.n_doc, self.n_topic])
          self.sum_T = np.zeros(self.n_topic)
  
          self.alpha = alpha
          self.beta = beta
  
          self.topic_assignment = list()
  
          self.TW += self.beta
          self.sum_T += self.beta * self.n_voca
          self.DT += self.alpha
  
new_contents: import numpy as np
  
  class BaseTopicModel(object):
      """
      Attributes
      ----------
      n_doc: int
          the number of total documents in the corpus
      n_voca: int
          the vocabulary size of the corpus
      verbose: boolean
          if True, print each iteration step while inference.
      """
      def __init__(self, n_doc, n_voca, **kwargs):
          self.n_doc = n_doc
          self.n_voca = n_voca
          self.verbose = kwargs.pop('verbose', True)
  
  
  class BaseGibbsParamTopicModel(BaseTopicModel):
      """ Base class of parametric topic models with Gibbs sampling inference
  
      Attributes
      ----------
      n_topic: int
          a number of topics to be inferred through the Gibbs sampling
      TW: ndarray, shape (n_voca, n_topic)
          word-topic matrix, keeps the number of assigned word tokens for each word-topic pair
      DT: ndarray, shape (n_doc, n_topic)
          document-topic matrix, keeps the number of assigned word tokens for each document-topic pair
      sum_T: ndarray, shape (n_topic)
          number of word tokens assigned for each topic
      alpha: float
          symmetric parameter of Dirichlet prior for document-topic distribution
      beta: float
          symmetric parameter of Dirichlet prior for topic-word distribution
      """
  
      def __init__(self, n_doc, n_voca, n_topic, alpha, beta, **kwargs):
          super(BaseGibbsParamTopicModel, self).__init__(n_doc=n_doc, n_voca=n_voca, **kwargs)
          self.n_topic = n_topic
          self.TW = np.zeros([self.n_topic, self.n_voca])
          self.DT = np.zeros([self.n_doc, self.n_topic])
          self.sum_T = np.zeros(self.n_topic)
  
          self.alpha = alpha
          self.beta = beta
  
          self.topic_assignment = list()
  
          self.TW += self.beta
          self.sum_T += self.beta * self.n_voca
          self.DT += self.alpha
  
subject: Use new-style class for BaseTopicModel