def __init__(self, data, mfmethod, nsub=20, show_progress=True, mapW=False, base_sel=2, num_bases=3 , niterH=1, compute_h=True, compute_w=True, sstrategy='rand'): NMF.__init__(self, data, num_bases=num_bases, compute_h=compute_h, show_progress=show_progress, compute_w=compute_w) self._niterH = niterH self._nsub = nsub self.data = data self._mfmethod = mfmethod self._mapW = mapW self._sstrategy = sstrategy self._base_sel = base_sel # assign the correct distance function if self._sstrategy == 'cur': self._subfunc = self.curselect elif self._sstrategy == 'kmeans': self._subfunc = self.kmeansselect elif self._sstrategy == 'hull': self._subfunc = self.hullselect elif self._sstrategy == 'laesa': self._subfunc = self.laesaselect elif self._sstrategy == 'sivm': self._subfunc = self.sivmselect else: self._subfunc = self.randselect
def __init__(self, data, mfmethod, nsub=20, show_progress=True, mapW=False, base_sel=2, num_bases=3 , niterH=1, compute_h=True, compute_w=True, sstrategy='rand'): NMF.__init__(self, data, num_bases=num_bases, compute_h=compute_h, show_progress=show_progress, compute_w=compute_w) self._niterH = niterH self._nsub = nsub self.data = data self._mfmethod = mfmethod self._mapW = mapW self._sstrategy = sstrategy self._base_sel = base_sel # assign the correct distance function if self._sstrategy == 'cur': self._subfunc = self.curselect elif self._sstrategy == 'kmeans': self._subfunc = self.kmeansselect elif self._sstrategy == 'hull': self._subfunc = self.hullselect elif self._sstrategy == 'laesa': self._subfunc = self.laesaselect elif self._sstrategy == 'sivm': self._subfunc = self.sivmselect else: self._subfunc = self.randselect
def __init__(self, data, num_bases=0, niter=1, show_progress=False, compW=True, center_mean=True): NMF.__init__(self, data, num_bases=num_bases, niter=niter, show_progress=show_progress, compW=compW) # center the data around the mean first self._center_mean = center_mean if self._center_mean: # copy the data before centering it -> arrays # are passed by reference ... self._data_orig = data self._meanv = self._data_orig[:, :].mean(axis=1).reshape( data.shape[0], -1) self.data = self._data_orig - self._meanv else: self.data = data
def __init__(self, data, num_bases=4, niter=100, show_progress=False, compW=True): """ Inits Nmf class: sampleNmf = Nmf(data, num_bases=4, niter=100, show_progress=True, compW=True) Args: data (required) : d x n data matrix [d - dimension, n -number of samples] num_bases : number of basis vectors for W (default: 4) niter : number of iterations (default: 100) show_progress : (default: True) compW : set to True if W and H should be optimized, set to False if only H should be optimized. This is usefull if W is computed somewhere or if new data should be mapped on a given set of basis vectors W. """ # data can be either supplied by conventional numpy arrays or # as a numpy array within a pytables table (should be preferred for large data sets) NMF.__init__(self, data, num_bases=num_bases, niter=niter, show_progress=show_progress, compW=compW)
def __init__(self, data_1, data_2, lambd=0.5, num_bases=4, niter=100, show_progress=False, compH=True, compW=True): # generate a new data set data using a weighted # combination of data_1 and data_2 self._data_1 = data_1 self._data_2 = data_2 self._lambd = lambd data = np.concatenate( (lambd * self._data_1, (1.0 - lambd) * self._data_2), axis=0) NMF.__init__(self, data, num_bases=num_bases, niter=niter, show_progress=show_progress, compW=compW)
def __init__(self, data, num_bases=4, niter=10, show_progress=False, compW=True): NMF.__init__(self, data, num_bases=num_bases, niter=niter, show_progress=show_progress, compW=compW)
def __init__(self, data, num_bases=0, center_mean=True): NMF.__init__(self, data, num_bases=num_bases) # center the data around the mean first self._center_mean = center_mean if self._center_mean: # copy the data before centering it self._data_orig = data self._meanv = self._data_orig[:,:].mean(axis=1).reshape(data.shape[0],-1) self.data = self._data_orig - self._meanv else: self.data = data
def __init__(self, data, num_bases=4, niter=100, show_progress=False, compW=True): # call inherited method NMF.__init__(self, data, num_bases=num_bases, niter=niter, show_progress=show_progress, compW=compW)
def __init__(self, data, num_bases=0, center_mean=True, **kwargs): NMF.__init__(self, data, num_bases=num_bases) # center the data around the mean first self._center_mean = center_mean if self._center_mean: # copy the data before centering it self._data_orig = data self._meanv = self._data_orig[:,:].mean(axis=1).reshape(data.shape[0],-1) self.data = self._data_orig - self._meanv else: self.data = data
def __init__(self, data, num_bases=4, niter=100, show_progress=False, compW=True): # data can be either supplied by conventional numpy arrays or # as a numpy array within a pytables table (should be preferred for large data sets) NMF.__init__(self, data, num_bases=num_bases, niter=niter, show_progress=show_progress, compW=compW)
def __init__(self, data, num_bases=4, niter=100, show_progress=False, compW=True): # data can be either supplied by conventional numpy arrays or # as a numpy array within a pytables table (should be preferred for large data sets) NMF.__init__(self, data, num_bases=num_bases, niter=niter, show_progress=show_progress, compW=compW) # controls how fast lambda should increase: # this influence convergence to binary values during the update. A value # <1 will result in non-binary decompositions as the update rule effectively # is a conventional nmf update rule. Values >1 give more weight to making the # factorization binary with increasing iterations. # setting either W or H to 0 results make the resulting matrix non binary. self._lamb_increase_W = 1.1 self._lamb_increase_H = 1.1
def __init__(self, data, num_bases=4, lamb=2.0): # call inherited method NMF.__init__(self, data, num_bases=num_bases) self._lamb = lamb
def __init__(self, data, k=-1, num_bases=4): # call inherited method NMF.__init__(self, data, num_bases=num_bases) self._k = k if self._k == -1: self._k = num_bases
def __init__(self, data, k=-1, num_bases=4): # call inherited method NMF.__init__(self, data, num_bases=num_bases) self._k = k if self._k == -1: self._k = num_bases
def __init__(self, data, num_bases=4, lamb=2.0): # call inherited method NMF.__init__(self, data, num_bases=num_bases) self._lamb = lamb