我有一个大数据集(我无法将整个数据存储在内存中)。我想在这个数据集上拟合一个 GMM。
我可以在小批量数据上重复使用 GMM.fit()
(sklearn.mixture.GMM
) 吗??
最佳答案
没有理由反复贴合。 只需随机抽取您认为您的机器可以在合理时间内计算的尽可能多的数据点。如果变异不是很大,随机样本将具有与完整数据集大致相同的分布。
randomly_sampled = np.random.choice(full_dataset, size=10000, replace=False)
#If data does not fit in memory you can find a way to randomly sample when you read it
GMM.fit(randomly_sampled)
和使用
GMM.predict(full_dataset)
# Again you can fit one by one or batch by batch if you cannot read it in memory
对其余的进行分类。
关于python - 大型数据集上的 Sklearn-GMM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29095769/