Skip to content

Commit

Permalink
Merge pull request #32 from ramp-kits/fix_scoring
Browse files Browse the repository at this point in the history
fix assert error
  • Loading branch information
frcaud authored Dec 14, 2023
2 parents b713e78 + 9823d40 commit ec22353
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions stroke/scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ def score_function(self, Y_true: np.array, Y_pred: np.array):
Sørensen–Dice coefficient.
"""
y_true = np.array(Y_true.y_true)
assert len(y_true) == len(Y_pred.y_pred)
if len(Y_pred.y_pred) != 0:
assert len(y_true) == len(Y_pred.y_pred)
if len(Y_pred.y_pred) == 0:
return 0
estimator = Y_pred.y_pred[0].estimator

fscore = 0
for y_true_i, prediction_object in zip(y_true, Y_pred.y_pred):
dat = estimator.predict(BIDSLoader.load_image_tuple(prediction_object.pred))
dat = estimator.predict(
BIDSLoader.load_image_tuple(prediction_object.pred)
)

# Using proxy of y_true.shape != y_pred.shape to indicate that data needs to be unpacked
if y_true_i.shape != dat.shape:
Expand Down

0 comments on commit ec22353

Please sign in to comment.