skcmeans.initialization Module

skcmeans.initialization.initialize_probabilistic(x, k, random_state=None)[source]

Selects initial points using a probabilistic clustering approximation.

Parameters:
  • x (np.ndarray) – (n_samples, n_features) The original data.
  • k (int) – The number of points to select.
  • random_state (int or np.random.RandomState, optional) – The generator used for initialization. Using an integer fixes the seed.
Returns:

  • np.ndarray – (n_samples, k) Cluster memberships
  • np.ndarray – (k, n_features) Cluster centers

skcmeans.initialization.initialize_random(x, k, random_state=None, eps=1e-12)[source]

Selects initial points randomly from the data.

Parameters:
  • x (np.ndarray) – (n_samples, n_features) The original data.
  • k (int) – The number of points to select.
  • random_state (int or np.random.RandomState, optional) – The generator used for initialization. Using an integer fixes the seed.
Returns:

  • Unitialized memberships
  • selection (np.ndarray) – (k, n_features) A length-k subset of the original data.