MCPcopy Index your code
hub / github.com/scikit-learn/scikit-learn / _map_to_integer

Function _map_to_integer

sklearn/utils/_encode.py:164–168  ·  view source on GitHub ↗

Map values based on its position in uniques.

(values, uniques)

Source from the content-addressed store, hash-verified

162
163
164def _map_to_integer(values, uniques):
165 """Map values based on its position in uniques."""
166 xp, _ = get_namespace(values, uniques)
167 table = _nandict({val: i for i, val in enumerate(uniques)})
168 return xp.asarray([table[v] for v in values], device=device(values))
169
170
171def _unique_python(values, *, return_inverse, return_counts):

Callers 2

_unique_pythonFunction · 0.85
_encodeFunction · 0.85

Calls 3

get_namespaceFunction · 0.90
deviceFunction · 0.90
_nandictClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…