HMMlearn Gaussian Mixture:设置每个混合分量的均值、权重和方差
HMMlearn Gaussian Mixture: set mean, weight and variance of each mixture component
我正在使用 HMMlearn 模块生成具有高斯混合模型的 HMM。
问题是我想在将模型拟合到任何数据之前初始化每个混合成分的均值、方差和权重。
我该怎么做?
Each HMM parameter has a character code which can be used to customize
its initialization and estimation. EM algorithm needs a starting point
to proceed, thus prior to training each parameter is assigned a value
either random or computed from the data. It is possible to hook into
this process and provide a starting point explicitly. To do so
- ensure that the character code for the parameter is missing from
init_params and then
- set the parameter to the desired value.
这是一个例子:
model = hmm.GaussianHMM(n_components=3, n_iter=100, init_params="t")
model.startprob_ = np.array([0.6, 0.3, 0.1])
model.means_ = np.array([[0.0, 0.0], [3.0, -3.0], [5.0, 10.0]])
model.covars_ = np.tile(np.identity(2), (3, 1, 1))
初始化a的另一个例子GMMHMM
model = hmm.GMMHMM(n_components=3, n_iter=100, init_params="smt")
model.gmms_ = [sklearn.mixture.GMM(),sklearn.mixture.GMM(),sklearn.mixture.GMM()]
GMM 本身可以使用其属性以非常相似的方式初始化,并通过在 init_params
字符串中提供,哪些属性应由构造函数初始化。
我正在使用 HMMlearn 模块生成具有高斯混合模型的 HMM。
问题是我想在将模型拟合到任何数据之前初始化每个混合成分的均值、方差和权重。
我该怎么做?
Each HMM parameter has a character code which can be used to customize its initialization and estimation. EM algorithm needs a starting point to proceed, thus prior to training each parameter is assigned a value either random or computed from the data. It is possible to hook into this process and provide a starting point explicitly. To do so
- ensure that the character code for the parameter is missing from init_params and then
- set the parameter to the desired value.
这是一个例子:
model = hmm.GaussianHMM(n_components=3, n_iter=100, init_params="t")
model.startprob_ = np.array([0.6, 0.3, 0.1])
model.means_ = np.array([[0.0, 0.0], [3.0, -3.0], [5.0, 10.0]])
model.covars_ = np.tile(np.identity(2), (3, 1, 1))
初始化a的另一个例子GMMHMM
model = hmm.GMMHMM(n_components=3, n_iter=100, init_params="smt")
model.gmms_ = [sklearn.mixture.GMM(),sklearn.mixture.GMM(),sklearn.mixture.GMM()]
GMM 本身可以使用其属性以非常相似的方式初始化,并通过在 init_params
字符串中提供,哪些属性应由构造函数初始化。