code: def gaussian_hinton_diagram(
      startprob,
      transmat,
      means,
      variances,
      vmin=0,
      vmax=1,
      infer_hidden=True,
  ):
      """
      Show the initial state probabilities, the transition probabilities
      as heatmaps, and draw the emission distributions.
      """
  
      num_states = transmat.shape[0]
  
      f = plt.figure(figsize=(3 * (num_states), 2 * num_states))
      grid = gs.GridSpec(3, 3)
  
      ax = f.add_subplot(grid[0, 0])
      ax.imshow(startprob[None, :], vmin=vmin, vmax=vmax)
      ax.set_title("Initial Probabilities", size=14)
  
      ax = f.add_subplot(grid[1:, 0])
      ax.imshow(transmat, vmin=vmin, vmax=vmax)
      ax.set_title("Transition Probabilities", size=14)
  
      ax = f.add_subplot(grid[1:, 1:])
      for i in range(num_states):
          keep = True
          if infer_hidden:
              if np.all(np.abs(transmat[i] - transmat[i][0]) < 1e-4):
                  keep = False
          if keep:
              s_min = means[i] - 10 * variances[i]
              s_max = means[i] + 10 * variances[i]
              xx = np.arange(s_min, s_max, (s_max - s_min) / 1000)
              norm = scipy.stats.norm(means[i], np.sqrt(variances[i]))
              yy = norm.pdf(xx)
              keep = yy > 0.01
              ax.plot(xx[keep], yy[keep], label="State: {}".format(i))
      ax.set_title("Emissions Probabilities", size=14)
      ax.legend(loc="best")
      f.tight_layout()
      return f
  
file_path: hmmlearn/examples/plot_variational_inference.py
imports: import collections
  import numpy
  import matplotlib.pyplot
  import matplotlib.gridspec
  import scipy.stats
  from sklearn.utils import check_random_state
  from hmmlearn import hmm, vhmm
  import matplotlib
label_desc: Use image node_id 1 for calling a global function with example usage: gaussian_hinton_diagram(startprob, transmat, means, variances, vmin, vmax, infer_hidden) and returns: f