initFA with hurdle noise throws exception
willtownes opened this issue · 1 comments
willtownes commented
I tried running the interactive tutorial using msigdb annotation. When I changed the noise from gaussian to hurdle, it threw the following exception:
AttributeError: 'CSparseFA' object has no attribute 'Known'
AttributeErrorTraceback (most recent call last)
<ipython-input-5-a7d489ec39a5> in <module>()
28 print ("Loaded {:d} cells, {:d} genes".format(data['Y'].shape[0],data['Y'].shape[1]))
29 print ("Annotation: {:d} terms".format(len(data['terms'])))
---> 30 FA = fscLVM.initFA(data['Y'],data['terms'],data['I'],data['genes'],noise='hurdle',nHidden=3, minGenes=15)
31
32 #tic = time.time()
/usr/local/lib/python2.7/site-packages/fscLVM/utils.pyc in initFA(Y, terms, I, gene_ids, nHidden, nHiddenSparse, pruneGenes, FPR, FNR, noise, minGenes, do_preTrain, nFix)
905
906 if do_preTrain==True:
--> 907 Ilabel = preTrain(Y, terms, pi, noise=noise, nFix=nFix)
908 pi = pi[:,Ilabel]
909 terms = terms[Ilabel]
/usr/local/lib/python2.7/site-packages/fscLVM/utils.pyc in preTrain(Y, terms, P_I, noise, nFix)
498 pi0=pi.copy()
499 FA0 = fscLVM.CSparseFA(components=K,sigmaOff=sigmaOff,sigmaOn=SP.ones(pi.shape[1])*1.0,sparsity=sparsity,nIterations=50,permutation_move=False,priors=priors,initType='pcaRand')
--> 500 FA0.init(**init)
501 if nFix==None:
502 nFix = FA0.nKnown+FA0.nLatent
/usr/local/lib/python2.7/site-packages/fscLVM/core.pyc in init(self, init_data, Pi, terms, noise, init_factors, unannotated_id)
646 self.W.E1[:,k] = SP.sqrt(1./self.components)*SP.randn(self._D)
647 self.S.diagSigmaS[:,k] = 1./2
--> 648 self.S.E1[:,SP.arange(self.nKnown)] = self.Known
649 if self.nLatent>0:
650 for iL in self.iLatent:
AttributeError: 'CSparseFA' object has no attribute 'Known'
flophys commented
I have now merged the devel branch into master and this is fixed and should work. Let me know in case you still have problems.