bundles / scipy 1.18.0 / scipy / cluster / vq / _vq_impl / _py_vq
function
scipy.cluster.vq._vq_impl:_py_vq
Signature
def _py_vq(obs, code_book, check_finite = True)Summary
Python version of vq algorithm.
Extended Summary
The algorithm computes the Euclidean distance between each observation and every frame in the code_book.
Parameters
obs: ndarrayExpects a rank 2 array. Each row is one observation.
code_book: ndarrayCode book to use. Same format than obs. Should have same number of features (e.g., columns) than obs.
check_finite: bool, optionalWhether to check that the input matrices contain only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs. Default: True
Returns
code: ndarraycode[i] gives the label of the ith obversation; its code is code_book[code[i]].
mind_dist: ndarraymin_dist[i] gives the distance between the ith observation and its corresponding code.
Notes
This function is slower than the C version but works for all input types. If the inputs have the wrong types for the C versions of the function, this one is called as a last resort.
It is about 20 times slower than the C version.
Aliases
scipy.cluster.vq.py_vq