(self, sample_indices=None, num_samples=1)
return(samples)
returns samples according to the KDE
		
			Parameters
			----------
				sample_inices: list of ints
					Indices into the training data used as centers for the samples
				
				num_samples: int
					if samples_indices is None, this specifies how many samples
					are drawn.
returns samples according to the KDE
		
			Parameters
			----------
				sample_inices: list of ints
					Indices into the training data used as centers for the samples
				
				num_samples: int
					if samples_indices is None, this specifies how many samples
					are drawn.
returns samples according to the KDE Parameters ---------- sample_inices : list of ints Indices into the training data used as centers for the samples num_samples : int if samples_indices is None this specifies how many samples are drawn .
def sample(self, sample_indices=None, num_samples=1):
		""" returns samples according to the KDE
		
			Parameters
			----------
				sample_inices: list of ints
					Indices into the training data used as centers for the samples
				
				num_samples: int
					if samples_indices is None, this specifies how many samples
					are drawn.
				
		"""
		if sample_indices is None:
			sample_indices = np.random.choice(self.data.shape[0], size=num_samples)
		samples = self.data[sample_indices]

		possible_steps = np.arange(-self.num_values+1,self.num_values) / self.num_values
		ps = 0.5*(1-self.bw) * np.power(self.bw, np.abs(possible_steps))
		ps[self.num_values-1] = (1-self.bw)
		ps /= ps.sum()
		
		delta = np.zeros_like(samples)
		oob_idx = np.arange(samples.shape[0])

		while len(oob_idx) > 0:
			samples[oob_idx] -= delta[oob_idx]		# revert move
			delta[oob_idx] = np.random.choice(possible_steps, size=len(oob_idx), p=ps)
			samples[oob_idx] += delta[oob_idx]
			oob_idx = oob_idx[np.argwhere(np.logical_or(samples[oob_idx] > 1-1/(3*self.num_values), samples[oob_idx] < 1/(3*self.num_values))).flatten()]

		
		return(samples)
def sample ( self , sample_indices = None , num_samples = 1 ) : if sample_indices is None : sample_indices = np . random . choice ( self . data . shape [ 0 ] , size = num_samples ) samples = self . data [ sample_indices ] possible_steps = np . arange ( - self . num_values + 1 , self . num_values ) / self . num_values ps = 0.5 * ( 1 - self . bw ) * np . power ( self . bw , np . abs ( possible_steps ) ) ps [ self . num_values - 1 ] = ( 1 - self . bw ) ps /= ps . sum ( ) delta = np . zeros_like ( samples ) oob_idx = np . arange ( samples . shape [ 0 ] ) while len ( oob_idx ) > 0 : samples [ oob_idx ] -= delta [ oob_idx ] # revert move delta [ oob_idx ] = np . random . choice ( possible_steps , size = len ( oob_idx ) , p = ps ) samples [ oob_idx ] += delta [ oob_idx ] oob_idx = oob_idx [ np . argwhere ( np . logical_or ( samples [ oob_idx ] > 1 - 1 / ( 3 * self . num_values ) , samples [ oob_idx ] < 1 / ( 3 * self . num_values ) ) ) . flatten ( ) ] return ( samples )