scikit-learn/scikit-learn
Vedi su GitHubSurprising result in BayesianGaussianMixture
Open
#8632 aperta il 22 mar 2017
Bughelp wantedmodule:mixture
Metriche repository
- Star
- (66.084 star)
- Metriche merge PR
- (Merge medio 10g) (90 PR mergiate in 30 g)
Descrizione
I'm surprised by the results of BayesianGaussianMixture
from sklearn.mixture import BayesianGaussianMixture
from sklearn.datasets import make_blobs
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
rng = np.random.RandomState(3)
X, y = make_blobs(n_samples=500, centers=10, random_state=rng, cluster_std=[rng.gamma(1.5) for i in range(10)])
fig, axes = plt.subplots(2, 4)
gammas = np.logspace(-5, 5, 4)
for gamma, ax in zip(gammas, axes.T):
bgmm = BayesianGaussianMixture(n_components=10, weight_concentration_prior=gamma).fit(X)
ax[0].scatter(X[:, 0], X[:, 1], s=5, alpha=.6, c=plt.cm.Vega10(bgmm.predict(X)))
ax[0].set_title("gamma={:.2f}".format(gamma))
ax[1].bar(range(10), bgmm.weights_)

I'm changing gamma pretty drastically but the distribution of weights doesn't seem to change. Is that expected?