Loading [MathJax]/extensions/tex2jax.js
scipy 1.10.1 Pypi GitHub Homepage
Other Docs

NotesParametersReturns
py_vq(obs, code_book, check_finite=True)

The algorithm computes the Euclidean distance between each observation and every frame in the code_book.

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.

Parameters

obs : ndarray

Expects a rank 2 array. Each row is one observation.

code_book : ndarray

Code book to use. Same format than obs. Should have same number of features (e.g., columns) than obs.

check_finite : bool, optional

Whether 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 : ndarray

code[i] gives the label of the ith obversation; its code is code_book[code[i]].

mind_dist : ndarray

min_dist[i] gives the distance between the ith observation and its corresponding code.

Python version of vq algorithm.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/cluster/vq.py#213
type: <class 'function'>
Commit: