Пример #1
0
    def setY(self, Y, standardize=False):
        """
        Set phenotype matrix
        
        Args:
            Y:              phenotype matrix [N, P]
            standardize:    if True, phenotype is standardized (zero mean, unit variance)
        """
        assert Y.shape[
            0] == self.N, 'VarianceDecomposition:: Incompatible shape'
        assert Y.shape[
            1] == self.P, 'VarianceDecomposition:: Incompatible shape'

        if standardize:
            Y = preprocess.standardize(Y)

        #check that missing values match the current structure
        assert (~(sp.isnan(Y).any(axis=1)) == self.Iok).all(
        ), 'VarianceDecomposition:: pattern of missing values needs to match Y given at initialization'

        self.Y = Y
        self.vd.setPheno(Y)

        self.init = False
        self.optimum = None

        self.cache['Sigma'] = None
        self.cache['Hessian'] = None
Пример #2
0
    def setY(self,Y,standardize=False):
        """
        Set phenotype matrix
        
        Args:
            Y:              phenotype matrix [N, P]
            standardize:    if True, phenotype is standardized (zero mean, unit variance)
        """
        assert Y.shape[0]==self.N, 'VarianceDecomposition:: Incompatible shape'
        assert Y.shape[1]==self.P, 'VarianceDecomposition:: Incompatible shape'

        
        if standardize:
            Y=preprocess.standardize(Y)

        #check that missing values match the current structure
        assert (~(sp.isnan(Y).any(axis=1))==self.Iok).all(), 'VarianceDecomposition:: pattern of missing values needs to match Y given at initialization'

        self.Y = Y
        self.vd.setPheno(Y)

        self.init    = False
        self.optimum = None
    
        self.cache['Sigma']   = None
        self.cache['Hessian'] = None
Пример #3
0
    def __init__(self, Y, standardize=False):
        """
        Args:
            Y:              phenotype matrix [N, P]
            standardize:    if True, impute missing phenotype values by mean value,
                            zero-mean and unit-variance phenotype (Boolean, default False)
        """

        #check whether Y is a vector, if yes reshape
        if (len(Y.shape) == 1):
            Y = Y[:, sp.newaxis]

        #create column of 1 for fixed if nothing providede
        self.N = Y.shape[0]
        self.P = Y.shape[1]
        self.Nt = self.N * self.P
        self.Iok = ~(sp.isnan(Y).any(axis=1))

        #outsourced to handle missing values:
        if standardize:
            Y = preprocess.standardize(Y)

        self.Y = Y
        self.vd = limix.CVarianceDecomposition(Y)
        self.n_randEffs = 0
        self.n_fixedEffs = 0
        self.gp = None
        self.init = False
        self.fast = False
        self.noisPos = None
        self.optimum = None

        # for predictions
        self.Fstar = []
        self.Kstar = []
        self.Ntest = None

        # for multi trait models
        self.trait_covar_type = []
        self.rank = []
        self.fixed_tc = []
        self.diag = []
        self.jitter = []

        self.cache = {}
        self.cache['Sigma'] = None
        self.cache['Hessian'] = None

        pass
Пример #4
0
    def __init__(self,Y,standardize=False):
        """
        Args:
            Y:              phenotype matrix [N, P]
            standardize:    if True, impute missing phenotype values by mean value,
                            zero-mean and unit-variance phenotype (Boolean, default False)
        """

        #check whether Y is a vector, if yes reshape
        if (len(Y.shape)==1):
            Y = Y[:,sp.newaxis]
        
        #create column of 1 for fixed if nothing providede
        self.N       = Y.shape[0]
        self.P       = Y.shape[1]
        self.Nt      = self.N*self.P
        self.Iok     = ~(sp.isnan(Y).any(axis=1))

        #outsourced to handle missing values:
        if standardize:
            Y=preprocess.standardize(Y)

        self.Y  = Y
        self.vd = limix.CVarianceDecomposition(Y)
        self.n_randEffs  = 0
        self.n_fixedEffs = 0
        self.gp      = None
        self.init    = False
        self.fast    = False
        self.noisPos = None
        self.optimum = None

        # for predictions
        self.Fstar = []
        self.Kstar = []
        self.Ntest = None

        # for multi trait models 
        self.trait_covar_type = []
        self.rank     = []
        self.fixed_tc = []
        self.diag     = []
        self.jitter   = []
        
        self.cache = {}
        self.cache['Sigma']   = None
        self.cache['Hessian'] = None

        pass
Пример #5
0
    def __init__(self, Y, standardize=False):
        """
        Args:
            Y:              phenotype matrix [N, P]
            standardize:    if True, impute missing phenotype values by mean value,
                            zero-mean and unit-variance phenotype (Boolean, default False)
        """

        #create column of 1 for fixed if nothing providede
        self.N = Y.shape[0]
        self.P = Y.shape[1]
        self.Nt = self.N * self.P
        self.Iok = ~(SP.isnan(Y).any(axis=1))

        #outsourced to handle missing values:
        if standardize:
            Y = preprocess.standardize(Y)

        self.Y = Y
        self.vd = limix.CVarianceDecomposition(Y)
        self.n_terms = 0
        self.gp = None
        self.init = False
        self.fast = False
        self.noisPos = None
        self.optimum = None

        # for multi trait models
        self.covar_type = []
        self.diag = []
        self.offset = []

        self.cache = {}
        self.cache['Sigma'] = None
        self.cache['Hessian'] = None
        self.cache['Lparams'] = None
        self.cache['paramsST'] = None

        pass
Пример #6
0
    def __init__(self,Y,standardize=False):
        """
        Args:
            Y:              phenotype matrix [N, P]
            standardize:    if True, impute missing phenotype values by mean value,
                            zero-mean and unit-variance phenotype (Boolean, default False)
        """
        
        #create column of 1 for fixed if nothing providede
        self.N       = Y.shape[0]
        self.P       = Y.shape[1]
        self.Nt      = self.N*self.P
        self.Iok     = ~(SP.isnan(Y).any(axis=1))

        #outsourced to handle missing values:
        if standardize:
            Y=preprocess.standardize(Y)

        self.Y       = Y
        self.vd      = limix.CVarianceDecomposition(Y)
        self.n_terms = 0
        self.gp      = None
        self.init    = False
        self.fast    = False
        self.noisPos = None
        self.optimum = None

        # for multi trait models 
        self.covar_type = []
        self.diag       = []
        self.offset     = []
        
        self.cache = {}
        self.cache['Sigma']   = None
        self.cache['Hessian'] = None
        self.cache['Lparams'] = None
        self.cache['paramsST']= None

        pass