code: def sample(self, burnin, thinning, samples, append=True):
  
          
  
          if hasattr(self, 'sampled_topics') and append:
  
              sampled_topics = \
                  samplers_lda.sampler(self.docid, self.tokens,
                                       self.sampled_topics[self.samples-1, :],
                                       self.N, self.V, self.K, self.D,
                                       self.alpha, self.beta,
                                       burnin, thinning, samples)
  
              tt_temp = self.tt_comp(sampled_topics)
              dt_temp = self.dt_comp(sampled_topics)
  
              self.sampled_topics = \
                  np.concatenate((self.sampled_topics, sampled_topics))
              self.tt = np.concatenate((self.tt, tt_temp), axis=2)
              self.dt = np.concatenate((self.dt, dt_temp), axis=2)
  
              self.samples = self.samples + samples
  
          else:
  
                  self.samples = samples
  
                  seed = np.copy(self.topic_seed)
  
                  self.sampled_topics = \
                      samplers_lda.sampler(self.docid, self.tokens, seed,
                                           self.N, self.V, self.K, self.D,
                                           self.alpha, self.beta,
                                           burnin, thinning, self.samples)
  
                  self.tt = self.tt_comp(self.sampled_topics)
                  self.dt = self.dt_comp(self.sampled_topics)
docs: Estimate topics via Gibbs sampling.
          burnin: number of iterations to allow chain to burn in before sampling.
          thinning: thinning interval between samples.
          samples: number of samples to take.
          Total number of samples = burnin + thinning * samples
          If sampled topics already exist and append = True, extend chain from
          last sample.
          If append = False, start new chain from the seed.