python/pymethylprocess/MethylationDataTypes.py
def subsample(self, key='disease', n_samples=None, frac=None, categorical=False):
        """Subsample MethylationArray, make the set randomly smaller.

        Parameters
        ----------
        key
            If stratifying, use this column of pheno array.
        n_samples
            Number of samples to consider overall, or per stratum.
        frac
            Alternative to n_samples, where x frac of array or stratum is considered.
        categorical
            Whether to stratify by column.
        """
        np.random.seed(42)
        if categorical:
            pheno=self.pheno.groupby(key,group_keys=False).apply(lambda x: x.sample(frac=frac, n=min(x.shape[0],n_samples)))
        else:
            pheno=self.pheno.sample(frac=frac, n=(min(n_samples,self.pheno.shape[0]) if n_samples is not None else None))
        return MethylationArray(pheno,self.beta.loc[pheno.index.values,:],'subsampled')
Subsample MethylationArray, make the set randomly smaller.

        Parameters
        ----------
        key
            If stratifying, use this column of pheno array.
        n_samples
            Number of samples to consider overall, or per stratum.
        frac
            Alternative to n_samples, where x frac of array or stratum is considered.
        categorical
            Whether to stratify by column.
        
Subsample MethylationArray, make the set randomly smaller.
Parameters

key
If stratifying, use this column of pheno array.
n_samples
Number of samples to consider overall, or per stratum.
frac
Alternative to n_samples, where x frac of array or stratum is considered.
categorical
Whether to stratify by column.
Subsample MethylationArray make the set randomly smaller . Parameters key If stratifying use this column of pheno array . n_samples Number of samples to consider overall or per stratum . frac Alternative to n_samples where x frac of array or stratum is considered . categorical Whether to stratify by column .
def subsample(self, key='disease', n_samples=None, frac=None, categorical=False):
        np.random.seed(42)
        if categorical:
            pheno=self.pheno.groupby(key,group_keys=False).apply(lambda x: x.sample(frac=frac, n=min(x.shape[0],n_samples)))
        else:
            pheno=self.pheno.sample(frac=frac, n=(min(n_samples,self.pheno.shape[0]) if n_samples is not None else None))
        return MethylationArray(pheno,self.beta.loc[pheno.index.values,:],'subsampled')
def subsample ( self , key = 'disease' , n_samples = None , frac = None , categorical = False ) : np . random . seed ( 42 ) if categorical : pheno = self . pheno . groupby ( key , group_keys = False ) . apply ( lambda x : x . sample ( frac = frac , n = min ( x . shape [ 0 ] , n_samples ) ) ) else : pheno = self . pheno . sample ( frac = frac , n = ( min ( n_samples , self . pheno . shape [ 0 ] ) if n_samples is not None else None ) ) return MethylationArray ( pheno , self . beta . loc [ pheno . index . values , : ] , 'subsampled' )
Subsample MethylationArray, make the set randomly smaller.
Subsample MethylationArray make the set randomly smaller .
"""Subsample MethylationArray, make the set randomly smaller.

        Parameters
        ----------
        key
            If stratifying, use this column of pheno array.
        n_samples
            Number of samples to consider overall, or per stratum.
        frac
            Alternative to n_samples, where x frac of array or stratum is considered.
        categorical
            Whether to stratify by column.
        """
self
key
n_samples
frac
categorical