@@ -83,7 +83,7 @@ def compute(self) -> float | Sequence[float]:
8383 precision_ = _np_divide_no_nan (
8484 self .true_positives , self .true_positives + self .false_positives
8585 )
86- return _maybe_squeeze (precision_ )
86+ return _maybe_squeeze (precision_ ) # pyrefly: ignore[bad-return]
8787
8888
8989class Recall (ConfusionMetric ):
@@ -93,7 +93,7 @@ def compute(self) -> float | Sequence[float]:
9393 recall_ = _np_divide_no_nan (
9494 self .true_positives , self .true_positives + self .false_negatives
9595 )
96- return _maybe_squeeze (recall_ )
96+ return _maybe_squeeze (recall_ ) # pyrefly: ignore[bad-return]
9797
9898
9999class FBeta (ConfusionMetric ):
@@ -145,7 +145,7 @@ def compute(self) -> float | Sequence[float]:
145145 recall_ = _np_divide_no_nan (
146146 self .true_positives , self .true_positives + self .false_negatives
147147 )
148- return _maybe_squeeze (
148+ return _maybe_squeeze ( # pyrefly: ignore[bad-return]
149149 _np_divide_no_nan (
150150 np .multiply (precision_ , recall_ ) * (self .beta + 1.0 ),
151151 np .multiply (precision_ , self .beta ) + recall_ ,
@@ -174,7 +174,7 @@ def from_model_output(
174174 predictions = y_pred ,
175175 labels = y_true ,
176176 weights = weights ,
177- thresholds = default_thresholds (num_thresholds ),
177+ thresholds = default_thresholds (num_thresholds ), # pyrefly: ignore[bad-argument-type]
178178 )
179179 return cls (
180180 true_positives = tp ,
@@ -237,7 +237,7 @@ def compute(self) -> float:
237237 self .false_positives , self .false_positives + self .true_negatives
238238 )
239239 # We negate the integral because the thresholds are in ascending order.
240- return - np .trapezoid (tp_rate , fp_rate )
240+ return - np .trapezoid (tp_rate , fp_rate ) # pyrefly: ignore[bad-return]
241241
242242
243243class PrecisionAtRecall (ConfusionMetric ):
@@ -261,7 +261,7 @@ def from_model_output(
261261 predictions = y_pred ,
262262 labels = y_true ,
263263 weights = weights ,
264- thresholds = default_thresholds (num_thresholds ),
264+ thresholds = default_thresholds (num_thresholds ), # pyrefly: ignore[bad-argument-type]
265265 )
266266 return cls (
267267 true_positives = tp ,
@@ -593,7 +593,7 @@ def _estimate_confusion_matrix(thresholds: jt.Scalar) -> tuple[
593593
594594 return jnp .sum (tp ), jnp .sum (tn ), jnp .sum (fp ), jnp .sum (fn )
595595
596- thresholds = jnp .asarray (thresholds , dtype = jnp .float32 )
596+ thresholds = jnp .asarray (thresholds , dtype = jnp .float32 ) # pyrefly: ignore[bad-assignment]
597597 return jax .vmap (_estimate_confusion_matrix )(thresholds )
598598
599599
0 commit comments