wilhelm-lab / spectrum_fundamentals

Fundamentals public repo
MIT License
8 stars 2 forks source link

The cleaned code for indices_to_one_hot breaks oktoberfest #50

Closed picciama closed 1 year ago

picciama commented 1 year ago

Describe the bug

The cleaned up version of the old indices_to_one_hot function here https://github.com/wilhelm-lab/spectrum_fundamentals/blob/development/spectrum_fundamentals/charge.py returns a 2d numpy array instead of a list of lists. This is breaking oktoberfest as it relies on prosit_grpcs where the function is called in a loop and the result wrapped in a list. Also, it is now zero-based instead of one-based! Change it back to one-based as the one-hot encoding would be wrong and breaks with charge state 6.

To Reproduce

Steps to reproduce the behavior:

  1. ...
  2. ...
  3. ...

Expected behavior

The function should return a numpy array and accept labels in one-based indexing, i.e. the charge state itself, not charge-state -1. Also, prosit_grpc should not call the function in a loop and the result wrapped in another list, as this is highly inefficient. The function should be called once to return a 2d numpy array followed by result.tolist() for a hotfix in prosit_grpc here: https://github.com/wilhelm-lab/prosit_grpc/blob/349c62d6fa214df472ae65b4b875981d6669c1fd/prosit_grpc/inputPROSIT.py#L103 System [please complete the following information]:

Additional context