Пример #1
0
 def subsample(self, n, seed=87):
     """Subsample without replacement. Return a new TSTData """
     if n > self.X.shape[0] or n > self.Y.shape[0]:
         raise ValueError('n should not be larger than sizes of X, Y.')
     ind_x = util.subsample_ind(self.X.shape[0], n, seed)
     ind_y = util.subsample_ind(self.Y.shape[0], n, seed)
     return TSTData(self.X[ind_x, :], self.Y[ind_y, :], self.label)
Пример #2
0
 def subsample(self, n, seed=87):
     """Subsample without replacement. Return a new TSTData """
     if n > self.X.shape[0] or n > self.Y.shape[0]:
         raise ValueError('n should not be larger than sizes of X, Y.')
     ind_x = util.subsample_ind( self.X.shape[0], n, seed )
     ind_y = util.subsample_ind( self.Y.shape[0], n, seed )
     return TSTData(self.X[ind_x, :], self.Y[ind_y, :], self.label)
Пример #3
0
 def sample(self, n, seed=981):
     if 2*n > self.X.shape[0]:
         raise ValueError('2*n=%d exceeds the size of X = %d'%(2*n, self.X.shape[0]))
     ind = util.subsample_ind(self.X.shape[0], 2*n, seed)
     #print ind
     x = self.X[ind[:n]]
     y = self.X[ind[n:]]
     assert(x.shape[0]==y.shape[0])
     return TSTData(x, y)
Пример #4
0
 def sample(self, n, seed=981):
     if 2*n > self.X.shape[0]:
         raise ValueError('2*n=%d exceeds the size of X = %d'%(2*n, self.X.shape[0]))
     ind = util.subsample_ind(self.X.shape[0], 2*n, seed)
     #print ind
     x = self.X[ind[:n]]
     y = self.X[ind[n:]]
     assert(x.shape[0]==y.shape[0])
     return TSTData(x, y)