8000 Replacing structured types with datatype · Issue #385 · neulab/ExplainaBoard · GitHub
[go: up one dir, main page]

Skip 8000 to content
Replacing structured types with datatype #385
@odashi

Description

@odashi

Several functions use NumPy's structured arrays. I thought it is better to replace them to dataclasses for several reasons:

  • It is basically not informative to users to know what members are contained in the array since the array does not provide static type information (i.e., users can't comprehend the behavior by seeing the function signatures). Unfortunately we couldn't expect that structured arrays are supported by a mypy-friendly manner in the near future: Type hinting / annotation (PEP 484) for ndarray, dtype, and ufunc numpy/numpy#7370 (comment)
  • Manipulating structured arrays with heterogeneous data is usually much expensive than manipulating usual objects. Enforcing memory alignment can mitigate this problem, but it requires to constrain the length of string fields, which may be not suitable for the current implementation.

RFC: @neubig @pfliu-nlp

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

      0