Skip to content

Weighted Arrays? #776

@ParadaCarleton

Description

@ParadaCarleton

I've been considering this for a while. Would it make sense to define a new struct, a weighted_array, which contains both an array and a set of weights? The primary advantages are as follows:

  1. The weighted array can be stored contiguously in memory as an array of (element, weight) tuples. Weights and array elements are almost always accessed together, so this allows for faster access.
  2. Allows weighted_arrays to be passed as a single argument in place of an array.
  3. The user can conveniently manipulate weights together with observations. For example, dropping missing values would also automatically drop the weights associated with them.
    (The old interface can also be kept.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions