我有一个大的数据集(我不能把所有的数据放在内存中)。我想在这个数据集上安装一个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
其余的分类。