class_docstr: Encapsulate the inner State Space Language Model for DTM.
  
  Some important attributes of this class:
  
      * `obs` is a matrix containing the document to topic ratios.
      * `e_log_prob` is a matrix containing the topic to word ratios.
      * `mean` contains the mean values to be used for inference for each word for a time slice.
      * `variance` contains the variance values to be used for inference of word in a time slice.
      * `fwd_mean` and`fwd_variance` are the forward posterior values for the mean and the variance.
      * `zeta` is an extra variational parameter with a value for each time slice.
class_docstr_tok: ["Encapsulate","the","inner","State","Space","Language","Model","for","DTM",".","Some","important","attributes","of","this","class",":","*","`","obs","`","is","a","matrix","containing","the","document","to","topic","ratios",".","*","`","e_log_prob","`","is","a","matrix","containing","the","topic","to","word","ratios",".","*","`","mean","`","contains","the","mean","values","to","be","used","for","inference","for","each","word","for","a","time","slice",".","*","`","variance","`","contains","the","variance","values","to","be","used","for","inference","of","word","in","a","time","slice",".","*","`","fwd_mean","`","and","`","fwd_variance","`","are","the","forward","posterior","values","for","the","mean","and","the","variance",".","*","`","zeta","`","is","an","extra","variational","parameter","with","a","value","for","each","time","slice","."]
docstr: Optimize the bound with respect to the observed variables.
  
  TODO:
  This is by far the slowest function in the whole algorithm.
  Replacing or improving the performance of this would greatly speed things up.
  
  Parameters
  ----------
  sstats : numpy.ndarray
      Sufficient statistics for a particular topic. Corresponds to matrix beta in the linked paper for the first
      time slice, expected shape (`self.vocab_len`, `num_topics`).
  totals : list of int of length `len(self.time_slice)`
      The totals for each time slice.
  
  Returns
  -------
  (numpy.ndarray of float, numpy.ndarray of float)
      The updated optimized values for obs and the zeta variational parameter.
docstr_tok: ["Optimize","the","bound","with","respect","to","the","observed","variables",".","TODO",":","This","is","by","far","the","slowest","function","in","the","whole","algorithm",".","Replacing","or","improving","the","performance","of","this","would","greatly","speed","things","up",".","Parameters","--","--","--","--","--","sstats",":","numpy.ndarray","Sufficient","statistics","for","a","particular","topic",".","Corresponds","to","matrix","beta","in","the","linked","paper","for","the","first","time","slice",",","expected","shape","(","`","self.vocab_len","`",",","`","num_topics","`",")",".","totals",":","list","of","int","of","length","`","len","(","self.time_slice",")","`","The","totals","for","each","time","slice",".","Returns","--","--","--","-","(","numpy.ndarray","of","float",",","numpy.ndarray","of","float",")","The","updated","optimized","values","for","obs","and","the","zeta","variational","parameter","."]
code: def update_obs(self, sstats, totals):
      """Optimize the bound with respect to the observed variables.
  
      TODO:
      This is by far the slowest function in the whole algorithm.
      Replacing or improving the performance of this would greatly speed things up.
  
      Parameters
      ----------
      sstats : numpy.ndarray
          Sufficient statistics for a particular topic. Corresponds to matrix beta in the linked paper for the first
          time slice, expected shape (`self.vocab_len`, `num_topics`).
      totals : list of int of length `len(self.time_slice)`
          The totals for each time slice.
  
      Returns
      -------
      (numpy.ndarray of float, numpy.ndarray of float)
          The updated optimized values for obs and the zeta variational parameter.
  
      """
  
      OBS_NORM_CUTOFF = 2
      STEP_SIZE = 0.01
      TOL = 1e-3
  
      W = self.vocab_len
      T = self.num_time_slices
  
      runs = 0
      mean_deriv_mtx = np.zeros((T, T + 1))
  
      norm_cutoff_obs = None
      for w in range(W):
          w_counts = sstats[w]
          counts_norm = 0
          # now we find L2 norm of w_counts
          for i in range(len(w_counts)):
              counts_norm += w_counts[i] * w_counts[i]
  
          counts_norm = np.sqrt(counts_norm)
  
          if (
              counts_norm < OBS_NORM_CUTOFF
              and norm_cutoff_obs is not None
          ):
              obs = self.obs[w]
              norm_cutoff_obs = np.copy(obs)
          else:
              if counts_norm < OBS_NORM_CUTOFF:
                  w_counts = np.zeros(len(w_counts))
  
              # TODO: apply lambda function
              for t in range(T):
                  mean_deriv_mtx[t] = self.compute_mean_deriv(
                      w, t, mean_deriv_mtx[t]
                  )
  
              deriv = np.zeros(T)
              args = self, w_counts, totals, mean_deriv_mtx, w, deriv
              obs = self.obs[w]
              model = "DTM"
  
              if model == "DTM":
                  # slowest part of method
                  obs = optimize.fmin_cg(
                      f=f_obs,
                      fprime=df_obs,
                      x0=obs,
                      gtol=TOL,
                      args=args,
                      epsilon=STEP_SIZE,
                      disp=0,
                  )
              if model == "DIM":
                  pass
              runs += 1
  
              if counts_norm < OBS_NORM_CUTOFF:
                  norm_cutoff_obs = obs
  
              self.obs[w] = obs
  
      self.zeta = self.update_zeta()
  
      return self.obs, self.zeta
  
imports: import logging
  import numpy
  from scipy.special import digamma, gammaln
  from scipy import optimize
  from gensim import utils, matutils
  from gensim.models import ldamodel
label_desc: Use image node_id 9 for calling the sslm obj's underlying member method code with example usage: obj.update_obs(sstats, totals) and returns: self,  self