def _grid_from_X(X, percentiles=(0.05, 0.95), grid_resolution=100):
 if (len(percentiles) != 2):
  raise ValueError('percentile must be tuple of len 2')
 if (not all(((0.0 <= x <= 1.0) for x in percentiles))):
  raise ValueError('percentile values must be in [0, 1]')
 axes = []
 for col in range(X.shape[1]):
  uniques = np.unique(X[:, col])
  if (uniques.shape[0] < grid_resolution):
   axis = uniques
  else:
   emp_percentiles = mquantiles(X, prob=percentiles, axis=0)
   axis = np.linspace(emp_percentiles[(0, col)], emp_percentiles[(1, col)], num=grid_resolution, endpoint=True)
  axes.append(axis)
 return (cartesian(axes), axes)

def _grid_from_X ( X , percentiles = ( 0.05 , 0.95 ) , grid_resolution = 100 ) : if ( len ( percentiles ) != 2 ) : raise ValueError ( 'percentile must be tuple of len 2' ) if ( not all ( ( ( 0.0 <= x <= 1.0 ) for x in percentiles ) ) ) : raise ValueError ( 'percentile values must be in [0, 1]' ) axes = [ ] for col in range ( X . shape [ 1 ] ) : uniques = np . unique ( X [ : , col ] ) if ( uniques . shape [ 0 ] < grid_resolution ) : axis = uniques else : emp_percentiles = mquantiles ( X , prob = percentiles , axis = 0 ) axis = np . linspace ( emp_percentiles [ ( 0 , col ) ] , emp_percentiles [ ( 1 , col ) ] , num = grid_resolution , endpoint = True ) axes . append ( axis ) return ( cartesian ( axes ) , axes )
generate a grid of points based on the percentiles of x .