2 成分ガウス混合モデルを以下に示すデータに当てはめることに興味があります。ただし、ここでプロットしているのは、0 ~ 1 の間に正規化された対数変換されたカウントであるため、データが取る最大値は 0 です。結果のフィットを取得しますが、これは明らかに私が望んでいるものではありません。
from sklearn.mixture import GaussianMixture
import numpy as np
# start with some count data in (0,1]
logged_counts = np.log(counts)
model = GaussianMixture(2).fit(logged_counts.reshape(-1,1))
# plot resulting fit
x_range = np.linspace(np.min(logged_counts), 0, 1000)
pdf = np.exp(model.score_samples(x_range.reshape(-1, 1)))
responsibilities = model.predict_proba(x_range.reshape(-1, 1))
pdf_individual = responsibilities * pdf[:, np.newaxis]
plt.hist(logged_counts, bins='auto', density=True, histtype='stepfilled', alpha=0.5)
plt.plot(x_range, pdf, '-k', label='Mixture')
plt.plot(x_range, pdf_individual, '--k', label='Components')
plt.legend()
plt.show()
一番上のコンポーネントの平均を 0 に固定し、もう一方の平均、2 つの分散、および混合分数のみを最適化できれば幸いです。(さらに、右側のコンポーネントに半法線を使用できるようにしたいと考えています。) python/sklearn の組み込み関数を使用してこれを行う簡単な方法はありますか、または使用してそのモデルを自分で構築する必要がありますか?確率的プログラミング言語?