Skip to content

Commit

Permalink
🤖 Lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-branch committed Feb 23, 2024
1 parent ccadb93 commit b9990d3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ivy/functional/frontends/sklearn/metrics/_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ def recall_score(y_true, y_pred, *, sample_weight=None):
if sample_weight is not None:
sample_weight = ivy.array(sample_weight)
if sample_weight.shape[0] != y_true.shape[0]:
raise IvyValueError("sample_weight must have the same length as y_true and y_pred")
raise IvyValueError(
"sample_weight must have the same length as y_true and y_pred"
)
sample_weight = sample_weight / ivy.sum(sample_weight)
else:
sample_weight = ivy.ones_like(y_true)

# Calculate true positives and actual positives
true_positives = ivy.logical_and(ivy.equal(y_true, 1), ivy.equal(y_pred, 1)).astype("int64")
true_positives = ivy.logical_and(ivy.equal(y_true, 1), ivy.equal(y_pred, 1)).astype(
"int64"
)
actual_positives = ivy.equal(y_true, 1).astype("int64")

# Apply sample weights
Expand Down

0 comments on commit b9990d3

Please sign in to comment.