Beispiel #1
0
    def __init__(self,
                 class_dict_coder=None,
                 n_folds=None,
                 sparse_coder=None,
                 param_grid=None,
                 n_class_samples=None,
                 n_test_samples=None,
                 n_tests=1,
                 method="global",
                 mmap=False,
                 n_jobs=1):

        classifier.__init__(self,
                            n_folds=n_folds,
                            param_grid=param_grid,
                            n_class_samples=n_class_samples,
                            n_test_samples=n_test_samples,
                            n_tests=n_tests,
                            name=method + 'src_feature_classifier')

        # a class that will do class dictionary learning
        # of the data
        self.class_dict_coder = class_dict_coder
        self.sparse_coder = sparse_coder
        # if method='global' then we extract global SRC features
        # if method='local' then we extract local SRC features
        self.method = method
        self.mmap = mmap
        self.n_jobs = n_jobs
        self.sparse_coder.mmap = self.mmap
        self.sparse_coder.n_jobs = self.n_jobs
        self.D = None
        self.features_extracted = False
        self.Z_train = None
        self.Z_test = None
Beispiel #2
0
    def __init__(self,
                 class_dict_coder=None,
                 n_folds=None,
                 sparse_coder=None,
                 n_class_samples=None,
                 n_test_samples=None,
                 n_tests=1,
                 method="global",
                 mmap=False,
                 n_jobs=1):

        classifier.__init__(self,
                            n_folds=n_folds,
                            n_class_samples=n_class_samples,
                            n_test_samples=n_test_samples,
                            n_tests=n_tests,
                            name=method + '_src_classifier')

        self.class_dict_coder = class_dict_coder
        self.sparse_coder = sparse_coder
        # if method='global' then we apply the global SRC classifier
        # if method='local' then we apply the local SRC classifier
        self.method = method
        self.mmap = mmap
        self.n_jobs = n_jobs
Beispiel #3
0
    def __init__(self, class_dict_coder=None, param_grid=None,
                 sparse_coder=None, max_iter=2, approx=True, eta=0,
                 n_class_samples=None, n_test_samples=None, n_tests=1, n_folds=None,
                 alpha=1, beta=1, mmap=False, verbose=False, n_jobs=1):

        classifier.__init__(self, n_folds=n_folds, param_grid=param_grid,
                            n_class_samples=n_class_samples, n_test_samples=n_test_samples,
                            n_tests=n_tests, name='lc_ksvd_classifier')
        # n_class_atoms,n_nonzero_coefs are arrays
        # that specify the params of each class dict
        self.class_dict_coder = class_dict_coder
        self.n_class_atoms = None
        self.sparse_coder = sparse_coder
        self.max_iter = max_iter
        self.approx = approx
        # the parameters of the LC-KSVD algorithm
        self.alpha = alpha
        self.beta = beta
        self.mmap = mmap
        self.verbose = verbose
        self.n_jobs = n_jobs
        self.sparse_coder.n_jobs = n_jobs
Beispiel #4
0
    def __init__(self,
                 class_dict_coder=None,
                 param_grid=None,
                 sparse_coder=None,
                 max_iter=2,
                 approx=True,
                 eta=0,
                 n_class_samples=None,
                 n_test_samples=None,
                 n_tests=1,
                 n_folds=None,
                 alpha=1,
                 beta=1,
                 mmap=False,
                 verbose=False,
                 n_jobs=1):

        classifier.__init__(self,
                            n_folds=n_folds,
                            param_grid=param_grid,
                            n_class_samples=n_class_samples,
                            n_test_samples=n_test_samples,
                            n_tests=n_tests,
                            name='lc_ksvd_classifier')
        # n_class_atoms,n_nonzero_coefs are arrays
        # that specify the params of each class dict
        self.class_dict_coder = class_dict_coder
        self.n_class_atoms = None
        self.sparse_coder = sparse_coder
        self.max_iter = max_iter
        self.approx = approx
        # the parameters of the lc_ksvd algorithm
        self.alpha = alpha
        self.beta = beta
        self.mmap = mmap
        self.verbose = verbose
        self.n_jobs = n_jobs
        self.sparse_coder.n_jobs = n_jobs