我有一个大的数据集,我正在尝试从图像中获取gabor滤波器。当数据集过大时,会出现内存错误。
到目前为止,我有这个代码:

import numpy
from sklearn.feature_extraction.image import extract_patches_2d
from sklearn.decomposition import MiniBatchDictionaryLearning
from sklearn.decomposition import FastICA

def extract_dictionary(image, patches_size=(16,16), projection_dimensios=25, previous_dictionary=None):
    """
    Gets a higher dimension ica projection image.

    """
    patches = extract_patches_2d(image, patches_size)
    patches = numpy.reshape(patches, (patches.shape[0],-1))[:LIMIT]
    patches -= patches.mean(axis=0)
    patches /= numpy.std(patches, axis=0)
    #dico = MiniBatchDictionaryLearning(n_atoms=projection_dimensios, alpha=1, n_iter=500)
    #fit = dico.fit(patches)
    ica = FastICA(n_components=projection_dimensios)
    ica.fit(patches)

    return ica

当限制较大时,存在内存错误。scikit或其他python包中是否有一些在线(增量)的ica替代品?

最佳答案

不,没有。你真的需要ica过滤器吗?已经尝试过联机的MiniBatchDictionaryLearningMiniBatchKMeans
此外,尽管不是严格的在线RandomizedPCA能够在要提取的组件数量较少的情况下处理中大型数据。

08-20 02:18