Skip to content

Feature hashing fails with float strings inf and nan  #83

@abduhbm

Description

@abduhbm

To produce:

>>> from docarray import Document
>>> x = Document(text="to infinity and beyond")
>>> x.embed_feature_hashing()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/docarray-env/docarray/docarray/document/mixins/featurehash.py", line 40, in embed_feature_hashing
    _hash_column(f_id, val, n_dim, max_value, idxs, data, table)
  File "~/docarray-env/docarray/docarray/document/mixins/featurehash.py", line 63, in _hash_column
    table[col] += np.sign(h) * col_val
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions