Skip to content

Commit

Permalink
refactor(datalab): extract the assignment to self.issues outside if/e…
Browse files Browse the repository at this point in the history
…lif block
  • Loading branch information
elisno committed May 10, 2023
1 parent e9aaac1 commit 86704c0
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions cleanlab/datalab/issue_manager/noniid.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,15 @@ def find_issues(self, features: Optional[npt.NDArray] = None, **kwargs) -> None:
score_median_threshold = np.median(scores) * 0.7
issue_mask = scores < score_median_threshold
if self.p_value >= self.significance_threshold:
self.issues = pd.DataFrame(
{
f"is_{self.issue_name}_issue": np.zeros(self.N, dtype=bool),
self.issue_score_key: scores,
},
)
issue_mask = np.zeros(self.N, dtype=bool)
elif issue_mask.sum() == 0:
issue_mask[scores.argmin()] = True
self.issues = pd.DataFrame(
{
f"is_{self.issue_name}_issue": issue_mask,
self.issue_score_key: scores,
},
)
self.issues = pd.DataFrame(
{
f"is_{self.issue_name}_issue": issue_mask,
self.issue_score_key: scores,
},
)

self.summary = self.make_summary(score=self.p_value)

Expand Down

0 comments on commit 86704c0

Please sign in to comment.