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

Give ability for users to get uncertainty values. #144

Merged
merged 3 commits into from
Sep 7, 2021

Conversation

Dref360
Copy link
Member

@Dref360 Dref360 commented Aug 18, 2021

Summary:

Allow the user to store uncertainties on disk when calling ActiveLearningLoop.step.

An issue that this create is that BatchBALD indices are not correlated with their uncertainty so this breaks a test. Not sure what is the best course of action.

Features:

Fix issue where NLPDataset was always imported.

Checklist:

  • Your code is documented (To validate this, add your module to tests/documentation_test.py).
  • Your code is tested with unit tests.
  • You moved your Issue to the PR state.

@@ -64,9 +70,18 @@ def step(self, pool=None) -> bool:
if len(pool) > 0:
probs = self.get_probabilities(pool, **self.kwargs)
if probs is not None and (isinstance(probs, types.GeneratorType) or len(probs) > 0):
to_label = self.heuristic(probs)
to_label, uncertainty = self.heuristic.get_ranks(probs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe put a flag to save uncertainties or not since it might take more time if people dont need it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not save if the path is None


if partial_multi_bald_b.max() < MIN_SPREAD:
COUNT += 1
if COUNT > 50 or len(history) >= predictions.shape[0]:
break

return np.array(history)

def reorder_indices(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did we remove this exception?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We raise that exception somewhere else in get_ranks


def reorder_indices(self, predictions):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we randomly sampling the predictions here instead of finding the variance of the iterations ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Random we just sample randomly

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I thought it was the Variance one. my bad

_ = active_loop.step()
assert len(os.listdir(tmpdir)) == 1
file = pjoin(tmpdir, os.listdir(tmpdir)[0])
assert "pool=90" in file and "labelled=10"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the part after and is always true, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on how many items are labelled

parmidaatg
parmidaatg previously approved these changes Aug 23, 2021
Copy link
Collaborator

@parmidaatg parmidaatg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@parmidaatg parmidaatg merged commit 252f280 into master Sep 7, 2021
@parmidaatg parmidaatg deleted the refactor_uncertainty branch September 7, 2021 15:38
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

Successfully merging this pull request may close these issues.

None yet

2 participants