예제 #1
0
 def __init__(self,
              Cg=None,
              Cn=None,
              G=None,
              R=None,
              rank=1,
              Cr=None,
              S_R=None,
              U_R=None):
     """
     Args:
         Cg:     Limix covariance matrix for Cg (dimension dim_c)
         Cn:     Limix covariance matrix for Cn (dimension dim_c)
         G:      [dim_r, rank_r] numpy covariance matrix for G
         R:      [dim_r, dim_r] numpy semidemidefinite covariance matrix for R
         rank:   rank of column low-rank covariance (default = 1)
         Cr:     Limix covariance matrix for Cr (optional).
                 If not specified, a low-rank covariance matrix is considered
         S_R:    N vector of eigenvalues of R
         U_R:    [N, N] eigenvector matrix of R
     """
     Covariance.__init__(self)
     self._Cr_act = True
     self._Cg_act = True
     self._Cn_act = True
     self.setColCovars(Cg=Cg, Cn=Cn, rank=rank, Cr=None)
     self.setR(R=R, S_R=S_R, U_R=U_R)
     self.G = G
     self.dim = self.dim_c * self.dim_r
     self._calcNumberParams()
     self._use_to_predict = False
예제 #2
0
 def __init__(self, dim, rank = 1):
     """
     Args:
         dim:        dimension of the low-rank covariance
         rank:       rank of the low-rank covariance
     """
     Covariance.__init__(self)
     self.initialize(dim, rank)
예제 #3
0
 def __init__(self, dim, rank=1):
     """
     Args:
         dim:        dimension of the low-rank covariance
         rank:       rank of the low-rank covariance
     """
     Covariance.__init__(self)
     self.initialize(dim, rank)
예제 #4
0
 def __init__(self, kinship, design, kinship_cm = None, kinship_cross = None, jitter = 1e-4):
     if kinship_cm is None:      kinship_cm = kinship
     if kinship_cross is None:   kinship_cross = kinship
     ff_dim = 2
     self.covff = FreeFormCov(ff_dim, jitter = 1e-4)
     self._K = kinship
     self._ZK = sp.dot(design, kinship_cross.T)
     self._KZ = sp.dot(kinship_cross, design.T)
     self._ZKZ = sp.dot(design, sp.dot(kinship_cm, design.T))
     Covariance.__init__(self, kinship.shape[0])
예제 #5
0
 def __init__(self, *covars):
     """
     Args:
         covars:     covariances to be considered in the sum
     """
     Covariance.__init__(self)
     self.dim = None
     self.covars = []
     for covar in covars:
         self.addCovariance(covar)
         covar.register(self.clear_all)
예제 #6
0
 def __init__(self, C, R, Iok=None):
     """
     Args:
         C:     column LIMIX covariance 
         R:     row numpy covariance matrix 
     """
     Covariance.__init__(self)
     self._C = C
     self._R = R
     self.dim = C.dim * R.shape[0]
     self.Iok = Iok
     C.register(self.clear_all)
예제 #7
0
파일: kronecker.py 프로젝트: jeffhsu3/limix
 def __init__(self, C, R, Iok=None):
     """
     Args:
         C:     column LIMIX covariance 
         R:     row numpy covariance matrix 
     """
     Covariance.__init__(self)
     self._C = C
     self._R = R
     self.dim = C.dim * R.shape[0]
     self.Iok = Iok 
     C.register(self.clear_all)
예제 #8
0
파일: freeform.py 프로젝트: mattions/limix
 def __init__(self, dim, jitter=1e-4):
     """
     Args:
         dim:        dimension of the free-form covariance
         jitter:     extent of diagonal offset which is added for numerical stability
                     (default value: 1e-4)
     """
     Covariance.__init__(self, dim)
     self._K_act = True
     self._calcNumberParams()
     self.dim = dim
     self.params = sp.zeros(self.n_params)
     self.idx_r, self.idx_c = sp.tril_indices(self.dim)
     self.set_jitter(jitter)
예제 #9
0
 def __init__(self, Cn = None, G = None, rank = 1):
     """
     Args:
         Cn:     Limix covariance matrix for Cn (dimension dim_c)
         G:      [dim_r, rank_r] numpy covariance matrix for G
         rank:   rank of column low-rank covariance (default = 1)
     """
     Covariance.__init__(self)
     self._Cr_act = True
     self._Cn_act = True
     self.setColCovars(Cn, rank = rank)
     self.G = G
     self.dim = self.dim_c * self.dim_r
     self._use_to_predict = False
예제 #10
0
 def __init__(self, Cn=None, G=None, rank=1):
     """
     Args:
         Cn:     Limix covariance matrix for Cn (dimension dim_c)
         G:      [dim_r, rank_r] numpy covariance matrix for G
         rank:   rank of column low-rank covariance (default = 1)
     """
     Covariance.__init__(self)
     self._Cr_act = True
     self._Cn_act = True
     self.setColCovars(Cn, rank=rank)
     self.G = G
     self.dim = self.dim_c * self.dim_r
     self._use_to_predict = False
예제 #11
0
 def __init__(self,
              kinship,
              design,
              kinship_cm=None,
              kinship_cross=None,
              jitter=1e-4):
     if kinship_cm is None: kinship_cm = kinship
     if kinship_cross is None: kinship_cross = kinship
     ff_dim = 2
     self.covff = FreeFormCov(ff_dim, jitter=1e-4)
     self._K = kinship
     self._ZK = sp.dot(design, kinship_cross.T)
     self._KZ = sp.dot(kinship_cross, design.T)
     self._ZKZ = sp.dot(design, sp.dot(kinship_cm, design.T))
     Covariance.__init__(self, kinship.shape[0])
예제 #12
0
 def __init__(self, Cg=None, Cn=None, R=None, S_R=None, U_R=None):
     """
     Args:
         Cg:     Limix covariance matrix for Cg (dimension dim_c)
         Cn:     Limix covariance matrix for Cn (dimension dim_c)
         R:      [dim_r, dim_r] numpy semidemidefinite covariance matrix for R
                 In alternative to R, S_R and U_R can be specified.
         S_R:    N vector of eigenvalues of R
         U_R:    [N, N] eigenvector matrix of R
     """
     Covariance.__init__(self)
     self._Cg_act = True
     self._Cn_act = True
     self.setColCovars(Cg, Cn)
     self.setR(R=R, S_R=S_R, U_R=U_R)
     self.dim = self.dim_c * self.dim_r
     self._use_to_predict = False
예제 #13
0
 def __init__(self, Cg = None, Cn = None, R = None, S_R = None, U_R = None):
     """
     Args:
         Cg:     Limix covariance matrix for Cg (dimension dim_c)
         Cn:     Limix covariance matrix for Cn (dimension dim_c)
         R:      [dim_r, dim_r] numpy semidemidefinite covariance matrix for R
                 In alternative to R, S_R and U_R can be specified.
         S_R:    N vector of eigenvalues of R
         U_R:    [N, N] eigenvector matrix of R
     """
     Covariance.__init__(self)
     self._Cg_act = True
     self._Cn_act = True
     self.setColCovars(Cg, Cn)
     self.setR(R=R, S_R=S_R, U_R=U_R)
     self.dim = self.dim_c * self.dim_r
     self._use_to_predict = False
예제 #14
0
파일: fixed.py 프로젝트: mattions/limix
    def __init__(self, K0, Kcross0=None):
        """
        Args:
            K0:         semi-definite positive matrix that defines the fixed-form covariance
            Kcross0:    cross covariance between training and test samples
                        (used only for out-of-sample predictions)
        """
        Covariance.__init__(self)
        self._scale_act = True
        self.K0 = assert_make_float_array(K0, "K0")
        assert_finite_array(self.K0)

        if Kcross0 is not None:
            Kcross0 = assert_make_float_array(Kcross0, "Kcross0")
            assert_finite_array(Kcross0)

        self.Kcross0 = Kcross0
        self.params = np.zeros(1)
예제 #15
0
파일: sqexp.py 프로젝트: mattions/limix
    def __init__(self, X, Xstar=None):
        """
        X:          [dim, 1] input matrix
        Xstar:      [dim_star, 1] out-of-sample input matrix
        """
        Covariance.__init__(self)
        self._scale_act = True
        self._length_act = True

        X = assert_make_float_array(X, "X")
        assert_finite_array(X)
        self.X = X

        if Xstar is not None:
            Xstar = assert_make_float_array(Xstar, "Xstar")
            assert_finite_array(Xstar)

        self.Xstar = Xstar
        self.params = np.zeros(2)
예제 #16
0
파일: sqexp.py 프로젝트: scalefreegan/limix
    def __init__(self, X, Xstar=None):
        """
        X:          [dim, 1] input matrix
        Xstar:      [dim_star, 1] out-of-sample input matrix
        """
        Covariance.__init__(self)
        self._scale_act = True
        self._length_act = True

        X = assert_make_float_array(X, "X")
        assert_finite_array(X)
        self.X = X

        if Xstar is not None:
            Xstar = assert_make_float_array(Xstar, "Xstar")
            assert_finite_array(Xstar)

        self.Xstar = Xstar
        self.params = np.zeros(2)
예제 #17
0
 def __init__(self, Cg=None, Cn=None, G=None, R=None, rank=1, Cr=None, S_R=None, U_R=None):
     """
     Args:
         Cg:     Limix covariance matrix for Cg (dimension dim_c)
         Cn:     Limix covariance matrix for Cn (dimension dim_c)
         G:      [dim_r, rank_r] numpy covariance matrix for G
         R:      [dim_r, dim_r] numpy semidemidefinite covariance matrix for R
         rank:   rank of column low-rank covariance (default = 1)
         Cr:     Limix covariance matrix for Cr (optional).
                 If not specified, a low-rank covariance matrix is considered
         S_R:    N vector of eigenvalues of R
         U_R:    [N, N] eigenvector matrix of R
     """
     Covariance.__init__(self)
     self._Cr_act = True
     self._Cg_act = True
     self._Cn_act = True
     self.setColCovars(Cg=Cg, Cn=Cn, rank=rank, Cr=None)
     self.setR(R=R, S_R=S_R, U_R=U_R)
     self.G = G
     self.dim = self.dim_c * self.dim_r
     self._calcNumberParams()
     self._use_to_predict = False
예제 #18
0
 def __init__(self):
     Covariance.__init__(self)
     self.covars = []
예제 #19
0
 def __init__(self, gp):
     Covariance.__init__(self)
     self.gp = gp
     gp.register(self.clear_all)
     self.dim = gp.mean.b.shape[0]