title: sklearn.mixture.DPGMM: only one cluster?
body: <p>I have a dataset for which I keep getting odd results with the Dirichlet process Gaussian mixture model in sklearn.</p>
  
  <pre><code>import sklearn.mixture, pandas
  import numpy as np
  from matplotlib import pyplot as plt
  
  A = np.random.normal(0, .5,200)
  B =  np.random.normal(2, .5,200)
  X = np.array(np.asmatrix(np.concatenate([A, B])).T)
  
  dpgmm = sklearn.mixture.DPGMM( n_iter=1000, verbose=True, 
  n_components=2, alpha=1, covariance_type = 'full')
  dpgmm.fit(X)
  print(dpgmm.means_)
  print(dpgmm.weights_)
  </code></pre>
  
  <p>To plot it I am using:</p>
  
  <pre><code>def pdf(x, mean, var, weight):
      p = np.exp(-(x - mean) ** 2 / (2 * var)) / np.sqrt(2 * np.pi * var)
      return p * weight
  
  def plot_gmm(model, data):
      colors = np.array(['r', 'g', 'b', 'm', 'c'])
      assignments = model.predict(data)
      clusters = np.unique(assignments)
      fig, ax = plt.subplots()
      ax.scatter(data[:, 0], np.zeros(data.size), c=colors[assignments], alpha=0.1)
      means = model.means_[clusters]
      variances = np.array([x.ravel() for x in np.array(model._get_covars())[clusters]])
      weights = model.weights_[clusters]
      for i in range(means.size):
          x = np.linspace(-0.1, 0.7, 100)
          y = pdf(x, means[i], variances[i], weights[i])
          ax.plot(x, y, color=colors[i], linewidth=2)
  </code></pre>
  
  <p>With DPGMM I get, across a range of values for n_components and alpha, a single component (I can't post the images because this is my first question on SO). If, on the other hand, I train a vanilla GMM with a 2 components, I get something that corresponds much better to my expectations.</p>
  
  <pre><code>gmm = sklearn.mixture.GMM( n_iter=1000,  n_components=2, covariance_type='full')
  gmm.fit(X)
  plot_gmm(gmm, X)
  plt.show()
  </code></pre>
  
  <p>Is there something I am overlooking about the DPGMM?</p>