matsengrp / torchdms

Analyze deep mutational scanning data with PyTorch
https://matsengrp.github.io/torchdms/
2 stars 0 forks source link

Monotonic Error when using Linear #167

Closed jgallowa07 closed 2 years ago

jgallowa07 commented 2 years ago

When specifying --monotonic 1.0 for increasing monotonic layers, we get the following error:

LOG: Independent start 1/5
Traceback (most recent call last):
  File "/home/jgallowa/miniconda3/envs/torchdms4/bin/tdms", line 33, in <module>
    sys.exit(load_entry_point('torchdms', 'console_scripts', 'tdms')())
  File "/home/jgallowa/miniconda3/envs/torchdms4/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/jgallowa/miniconda3/envs/torchdms4/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/jgallowa/miniconda3/envs/torchdms4/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/jgallowa/miniconda3/envs/torchdms4/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/jgallowa/miniconda3/envs/torchdms4/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/jgallowa/miniconda3/envs/torchdms4/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/jgallowa/Projects/torchdms/torchdms/torchdms/cli.py", line 735, in go
    ctx.invoke(
  File "/home/jgallowa/miniconda3/envs/torchdms4/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/jgallowa/Projects/torchdms/torchdms/torchdms/cli.py", line 538, in train
    analysis.multi_train(**training_params)
  File "/home/jgallowa/Projects/torchdms/torchdms/torchdms/analysis.py", line 310, in multi_train
    self.model.randomize_parameters()
  File "/home/jgallowa/Projects/torchdms/torchdms/torchdms/model.py", line 197, in randomize_parameters
    self._reflect_monotonic_params()
  File "/home/jgallowa/Projects/torchdms/torchdms/torchdms/model.py", line 183, in _reflect_monotonic_params
    for param in self.monotonic_params_from_latent_space():
  File "/home/jgallowa/Projects/torchdms/torchdms/torchdms/model.py", line 175, in monotonic_params_from_latent_space
    is_latent_layer = parse_name[-2] == "latent_layer"
IndexError: list index out of range

This is obviously because monotonically increasing non-linearity does not apply to Linear model. Raise an Error in the Linear model code -> here