Example #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
Example #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'

        # TODO: update the current code

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

        self.init    = False
        self.optimum = None

        self.cache['Sigma']   = None
        self.cache['Hessian'] = None
Example #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 = dlimix.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
Example #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 = dlimix.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
Example #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)
        """
        #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 provided
        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)

        # set properties
        self.Y = Y
        self.n_randEffs = 0
        self.noisPos = None

        # fixed and ranodm effects
        self.sample_covars = []
        self.sample_cross_covars = []
        self.trait_covars = []
        self.sample_designs = []
        self.sample_test_designs = []
        self.trait_designs = []

        # desinc
        self._desync()

        #TODO: check if necessary
        self.Ntest = None
Example #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)
        """
        #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 provided
        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)

        # set properties
        self.Y = Y
        self.n_randEffs  = 0
        self.noisPos = None

        # fixed and ranodm effects 
        self.sample_covars = []
        self.sample_cross_covars = []
        self.trait_covars = []
        self.sample_designs = []
        self.sample_test_designs = []
        self.trait_designs = []

        # desinc
        self._desync()

        #TODO: check if necessary
        self.Ntest = None