{ } Raw JSON

bundles / scipy 1.17.1 / scipy / cluster / vq / _krandinit

function

scipy.cluster.vq:_krandinit

source: /scipy/cluster/vq.py :526

Signature

def   _krandinit ( data k rng xp )

Summary

Returns k samples of a random variable whose parameters depend on data.

Extended Summary

More precisely, it returns k observations sampled from a Gaussian random variable whose mean and covariances are the ones estimated from the data.

Parameters

data : ndarray

Expect a rank 1 or 2 array. Rank 1 is assumed to describe 1-D data, rank 2 multidimensional data, in which case one row is one observation.

k : int

Number of samples to generate.

rng : `numpy.random.Generator` or `numpy.random.RandomState`

Random number generator.

Returns

x : ndarray

A 'k' by 'N' containing the initial centroids

Aliases

  • scipy.cluster.vq._krandinit