Skip to content

Potential overflow when calculating exp #209

@HaisongDing

Description

@HaisongDing

scoreMatExp = np.exp(np.asarray(mat))

One simple fix would be:
mat_array = np.asarray(mat)
mat_array = (mat_array.transpose() - mat_array.max(axis=1)).transpose()
scoreMatExp = np.exp(mat_array)

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