- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在做一个语音识别和机器学习相关的项目。我现在有两个类,我为每个类创建两个 GMM 分类器,分别用于标签“快乐”和“悲伤”
我想用 MFCC 向量训练 GMM 分类器。
我为每个标签使用两个 GMM 分类器。 (以前是每个文件的 GMM):
但是每次运行脚本时我都会得到不同的结果。使用相同的测试和训练样本可能是什么原因?
在下面的输出中,请注意我有 10 个测试样本,并且每行对应有序测试样本的结果
代码:
classifiers = {'happy':[],'sad':[]}
probability = {'happy':0,'sad':0}
def createGMMClassifiers():
for name, data in training.iteritems():
#For every class: In our case it is two, happy and sad
classifier = mixture.GMM(n_components = n_classes,n_iter=50)
#two classifiers.
for mfcc in data:
classifier.fit(mfcc)
addClassifier(name, classifier)
for testData in testing['happy']:
classify(testData)
def addClassifier(name,classifier):
classifiers[name]=classifier
def classify(testMFCC):
for name, classifier in classifiers.iteritems():
prediction = classifier.predict_proba(testMFCC)
for f, s in prediction:
probability[name]+=f
print 'happy ',probability['happy'],'sad ',probability['sad']
示例输出 1:
happy 154.300420496 sad 152.808941585
happy
happy 321.17737915 sad 318.621788517
happy
happy 465.294473363 sad 461.609246112
happy
happy 647.771003768 sad 640.451097035
happy
happy 792.420461416 sad 778.709674995
happy
happy 976.09526992 sad 961.337361541
happy
happy 1137.83592093 sad 1121.34722203
happy
happy 1297.14692405 sad 1278.51011583
happy
happy 1447.26926553 sad 1425.74595666
happy
happy 1593.00403707 sad 1569.85670672
happy
示例输出 2:
happy 51.699579504 sad 152.808941585
sad
happy 81.8226208497 sad 318.621788517
sad
happy 134.705526637 sad 461.609246112
sad
happy 167.228996232 sad 640.451097035
sad
happy 219.579538584 sad 778.709674995
sad
happy 248.90473008 sad 961.337361541
sad
happy 301.164079068 sad 1121.34722203
sad
happy 334.853075952 sad 1278.51011583
sad
happy 378.730734469 sad 1425.74595666
sad
happy 443.995962929 sad 1569.85670672
sad
最佳答案
But every time I run the script I am having different results. What might be the cause for that with same test and train samples?
scikit-learn 使用随机初始化器。如果您想要可重现的结果,可以设置 random_state argument
random_state: RandomState or an int seed (None by default)
for name, data in training.iteritems():
这是不正确的,因为您仅在最后一个样本上进行训练。在运行 fit 之前,您需要将每个标签的特征连接到单个数组中。您可以使用 np.concatenate 来实现此目的。
关于python - 每次使用 GMM 分类器运行都会得到不同的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38032454/
尝试使用 R 中的 GMM 包来估计线性模型的参数(a-f): LEV1 = a*Macro + b*Firm + c*Sector + d*qtr + e*fqtr + f*tax 宏、公司和部门是
我现在正在尝试在我的实验中使用 GMM。但我有以下问题。我对这个错误很困惑。 import tensorflow as tf class GMMDataLoader: def __init__
昨天我使用期望最大化算法实现了 GMM(高斯混合模型)。 如您所知,它将一些未知分布建模为混合高斯分布,我们需要了解其均值和方差,以及每个高斯分布的权重。 这是代码背后的数学原理(没那么复杂) htt
假设我们要在 2 个点上训练一个 1 维 GMM 聚类算法:0,2,使用 2 个簇。假设初始化是:高斯 1:均值 1,方差 1。高斯 2:均值 5,方差 1。 运行算法后,我们会得到什么样的高斯簇?当
我正在尝试遵循 this paper 第 3.2 节中给出的示例关于 gmm 的使用R包裹。所以我希望估计稳定分布的参数。我正在使用以下代码 library(gmm) library(stabledi
我正在尝试遵循 this paper 第 3.2 节中给出的示例关于 gmm 的使用R包裹。所以我希望估计稳定分布的参数。我正在使用以下代码 library(gmm) library(stabledi
我目前正在做一个语音识别和机器学习相关的项目。我现在有两个类,我为每个类创建两个 GMM 分类器,分别用于标签“快乐”和“悲伤” 我想用 MFCC 向量训练 GMM 分类器。 我为每个标签使用两个 G
我很困惑。我已经按照 MATLAB 代码为自己测试了一个程序: feature_train=[1 1 2 1.2 1 1 700 709 708 699 678]; No_of_Clusters =
我正在使用 sklearn 的 GMM 工具包构建一个基本的说话人识别器。我有 3 个类(class),每个类(class)都有一个分类器。在测试阶段,应选择概率最高的说话者的 GMM,并且程序应返回
我一直在使用 GMM cluster package by Bouman,我在网上没有找到任何适配模块。在我开始阅读 GMM 适应理论并实现它之前,我确实想知道是否有其他在线开源 GMM 项目可以完成
我有一个大数据集(我无法将整个数据存储在内存中)。我想在这个数据集上拟合一个 GMM。 我可以在小批量数据上重复使用 GMM.fit() (sklearn.mixture.GMM) 吗?? 最佳答案
我正在将两个高斯的混合拟合到一维数据(超过 1000 个点)。 两个高斯分布之和的峰值似乎相对于直方图的峰值向左移动。我假设这是因为我的数据有一个大约 0.5 的截止值。 绿线和红线是两条最合适的高斯
我一直在使用 Scikit-learn 的 GMM 函数。首先,我刚刚创建了一个沿 x=y 行的分布。 from sklearn import mixture import numpy as np i
我想使用 python 将高斯混合模型拟合到一组加权数据点。 我尝试了 sklearn.mixture.GMM() ,除了它对所有数据点的权重相同之外,它工作正常。有谁知道用这种方法为数据点分配权重的
据我了解: GMM 是一种概率模型,可以对正态分布的 N 个子种群进行建模。 GMM 中的每个分量都是高斯分布分布。 HMM 是一种具有隐藏状态的统计马尔可夫模型。当数据连续时,每个隐藏状态被建模为高
我已经使用 sklearn 高斯混合模型算法 (GMM) 对我的数据 (75000, 3) 进行了聚类。我有 4 个集群。我的数据的每个点都代表一个分子结构。现在我想得到每个簇最具代表性的分子结构,我
我使用数据集在 Matlab 中构建了一个高斯混合模型: model = gmdistribution.fit(data,M,'Replicates',5); 具有M = 3高斯分量。我测试了新数据:
我在 Python 中使用 sklearn.mixture.GMM,结果似乎取决于数据缩放。在下面的代码示例中,我更改了整体缩放比例,但没有更改维度的相对缩放比例。然而,在三种不同的缩放设置下,我得到
我想确定一个数据点属于一组数据的概率。我读到 sklearn GMM 可以做到这一点。我尝试了以下.... import numpy as np from sklearn.mixture import
我们正在尝试训练一个具有指定参数的高斯混合模型 (GMM)python 中的初始模型与 Spark 上的 MLLIB。pyspark 的 Doc 1.5.1 说我们应该使用 GaussianMixtu
我是一名优秀的程序员,十分优秀!