Skip to content

Sparse to Dense #79

@brett1479

Description

@brett1479

In choice_calcs.py line 930, it appears the library is calling rows_to_obs.toarray() which converts a sparse array to a potentially huge dense array (for my use case, the resulting sparse array is small, and the dense version is about 200 GiB).
Here is the existing code:

weights_per_obs =\
        np.max(rows_to_obs.toarray() * weights[:, None], axis=0)

Is the intended behavior given below?

M = rows_to_obs.multiply(weights.reshape(-1,1))
weights_per_obs = np.max(M, axis=0).toarray().reshape(-1)

If so, I think this is a simple fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions