Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clip without defined a_max #211

Closed
GeorgePearse opened this issue May 11, 2022 · 2 comments
Closed

Clip without defined a_max #211

GeorgePearse opened this issue May 11, 2022 · 2 comments

Comments

@GeorgePearse
Copy link
Collaborator

GeorgePearse commented May 11, 2022

https://github.com/ElementAI/baal/blob/798f6e3668d73c476013dcdc4aca8f54c3420b28/baal/active/heuristics/stochastics.py#L45

This line is causing me issues. Will try setting a_max to None, but I'm not sure of the implications relative to the intent.

Traceback (most recent call last):
  File "main.py", line 226, in <module>
    run(model, baal_trainer, baal_data_module, config, experiment_name)
  File "main.py", line 212, in run
    should_continue = baal_trainer.step(model, datamodule=baal_data_module)
  File "/workspace/environments/active-learning/lib/python3.8/site-packages/baal/utils/pytorch_lightning.py", line 202, in step
    to_label = self.heuristic(probs)
  File "/workspace/environments/active-learning/lib/python3.8/site-packages/baal/active/heuristics/heuristics.py", line 258, in __call__
    return self.get_ranks(predictions)[0]
  File "/workspace/environments/active-learning/lib/python3.8/site-packages/baal/active/heuristics/stochastics.py", line 45, in get_ranks
    distributions = np.clip(distributions, 0)
  File "<__array_function__ internals>", line 4, in clip
TypeError: _clip_dispatcher() missing 1 required positional argument: 'a_max'

Will try to submit PR for the string mapping mentioned in previous issue shortly (#210).

@Dref360
Copy link
Member

Dref360 commented May 11, 2022

Hmm strange as the tests passes.

distributions = distributions.clip(0) would be an easy fix.

Sometime due to numerical instabilities, entropy/bald can give negative values. So we clip the values to 0 to be sure.

Will you fix it in your PR? Otherwise I'll submit a small fix

@Dref360
Copy link
Member

Dref360 commented May 16, 2022

Closed in #213

@Dref360 Dref360 closed this as completed May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants