Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/superintendent/acquisition_functions/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ def margin(probabilities: np.ndarray) -> np.ndarray:
new labels and catching any minority classes the algorithm currently
classifies as a different label.
"""
margin = (
return (
np.sort(probabilities, axis=1)[:, -1]
- np.sort(probabilities, axis=1)[:, -2]
)
return margin
Comment on lines -61 to -65
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function margin refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)



@make_acquisition_function(handle_multioutput="mean") # noqa: D002
Expand All @@ -86,8 +85,7 @@ def certainty(probabilities: np.ndarray):
classifies as a different label.

"""
certainty = probabilities.max(axis=-1)
return certainty
return probabilities.max(axis=-1)
Comment on lines -89 to +88
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function certainty refactored with the following changes:

  • Inline variable that is immediately returned (inline-immediately-returned-variable)



@make_acquisition_function(handle_multioutput="mean")
Expand Down
16 changes: 7 additions & 9 deletions src/superintendent/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ def _annotation_iterator(self):
self._display(x)
y = yield

if y is None:
pass
else:
if y is not None:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function Labeller._annotation_iterator refactored with the following changes:

  • Swap if/else to remove empty if body (remove-pass-body)

self.queue.submit(id_, y)

self.progressbar.value = self.queue.progress
Expand Down Expand Up @@ -285,13 +283,13 @@ def _compose(self):
]

def _render_processing(self, message="Rendering..."):
message = (
"<h1>{}".format(message)
+ '<i class="fa fa-spinner fa-spin"'
+ ' aria-hidden="true"></i>'
)
processing_display = widgets.HTML(value=message)
with self.feature_output:
message = (
"<h1>{}".format(message)
+ '<i class="fa fa-spinner fa-spin"'
+ ' aria-hidden="true"></i>'
)
processing_display = widgets.HTML(value=message)
Comment on lines -288 to +292
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function Labeller._render_processing refactored with the following changes:

  • Move assignments closer to their usage (move-assign)

IPython.display.clear_output()
display.default_display_function(processing_display)

Expand Down