Пример #1
0
 def Y(self, value):
     """ set phenotype """
     self._N = value.shape[0]
     self._P = value.shape[1]
     self._Y = value
     # missing data
     self._Iok = ~sp.isnan(value)
     self._veIok = vec(self._Iok)[:,0]
     self._miss = (~self._Iok).any()
     # notify and clear_cached
     self.clear_cache('pheno')
     self._notify()
     self._notify('pheno')
Пример #2
0
 def _initGP(self):
     """
     Internal method for initialization of the GP inference objetct
     """
     if self._inference=='GP2KronSum': 
         signalPos = sp.where(sp.arange(self.n_randEffs)!=self.noisPos)[0][0]
         gp = GP2KronSum(Y=self.Y, F=self.sample_designs, A=self.trait_designs,
                         Cg=self.trait_covars[signalPos], Cn=self.trait_covars[self.noisPos],
                         R=self.sample_covars[signalPos])
     else:
         mean = MeanKronSum(self.Y, self.sample_designs, self.trait_designs) 
         Iok = vec(~sp.isnan(mean.Y))[:,0] 
         if Iok.all():   Iok = None
         covar = SumCov(*[KronCov(self.trait_covars[i], self.sample_covars[i], Iok=Iok) for i in range(self.n_randEffs)])
         gp = GP(covar = covar, mean = mean) 
     self.gp = gp
Пример #3
0
 def _initGP(self):
     """
     Internal method for initialization of the GP inference objetct
     """
     if self._inference == 'GP2KronSum':
         signalPos = sp.where(
             sp.arange(self.n_randEffs) != self.noisPos)[0][0]
         gp = GP2KronSum(Y=self.Y,
                         F=self.sample_designs,
                         A=self.trait_designs,
                         Cg=self.trait_covars[signalPos],
                         Cn=self.trait_covars[self.noisPos],
                         R=self.sample_covars[signalPos])
     else:
         mean = MeanKronSum(self.Y, self.sample_designs, self.trait_designs)
         Iok = vec(~sp.isnan(mean.Y))[:, 0]
         if Iok.all(): Iok = None
         covar = SumCov(*[
             KronCov(self.trait_covars[i], self.sample_covars[i], Iok=Iok)
             for i in range(self.n_randEffs)
         ])
         gp = GP(covar=covar, mean=mean)
     self.gp = gp
Пример #4
0
 def WKiy(self):
     R = vec(self.FYLcALc())
     # the following could be further optimized but do not care for now
     R -= sp.dot(self.WLW().T, vec(self.DWrYLcWc()))
     return R
Пример #5
0
 def WKiy(self):
     R = vec(self.FYLcALc())
     # the following could be further optimized but do not care for now
     R -= sp.dot(self.WLW().T, vec(self.DWrYLcWc()))
     return R
Пример #6
0
 def ve_WrDLrYLcWc(self):
     return vec(sp.dot(self.covar.Wr().T, sp.dot(self.DLrYLc(), self.covar.Wc())))
Пример #7
0
 def y(self):
     r = vec(self.Y)
     if self._miss:
         r = r[self._veIok]
     return r
Пример #8
0
 def yres(self):
     r = vec(self.Yres()) 
     if self._miss:
         r = r[~self._veIok]
     return r
Пример #9
0
 def ve_WrDLrYLcWc(self):
     return vec(
         sp.dot(self.covar.Wr().T, sp.dot(self.DLrYLc(), self.covar.Wc())))