def get_bin_seeds(X, bin_size, min_bin_freq=1):
 bin_sizes = defaultdict(int)
 for point in X:
  binned_point = np.round((point / bin_size))
  bin_sizes[tuple(binned_point)] += 1
 bin_seeds = np.array([point for (point, freq) in six.iteritems(bin_sizes) if (freq >= min_bin_freq)], dtype=np.float32)
 if (len(bin_seeds) == len(X)):
  warnings.warn(('Binning data failed with provided bin_size=%f, using data points as seeds.' % bin_size))
  return X
 bin_seeds = (bin_seeds * bin_size)
 return bin_seeds

def get_bin_seeds ( X , bin_size , min_bin_freq = 1 ) : bin_sizes = defaultdict ( int ) for point in X : binned_point = np . round ( ( point / bin_size ) ) bin_sizes [ tuple ( binned_point ) ] += 1 bin_seeds = np . array ( [ point for ( point , freq ) in six . iteritems ( bin_sizes ) if ( freq >= min_bin_freq ) ] , dtype = np . float32 ) if ( len ( bin_seeds ) == len ( X ) ) : warnings . warn ( ( 'Binning data failed with provided bin_size=%f, using data points as seeds.' % bin_size ) ) return X bin_seeds = ( bin_seeds * bin_size ) return bin_seeds
finds seeds for mean_shift .