Skip to content

Commit

Permalink
return zero recall on empty ground truth (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz authored Feb 14, 2022
1 parent df2feef commit f9df387
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/search/hnsw.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ func (b *HNSWBuilder) evaluate(idx *HNSW, prune0 bool) float32 {
}
return nil
})
if count == 0 {
return 0
}
return result / count
}

Expand Down
3 changes: 3 additions & 0 deletions base/search/ivf.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ func (b *IVFBuilder) evaluate(idx *IVF, prune0 bool) float32 {
}
return nil
})
if count == 0 {
return 0
}
return result / count
}

Expand Down

0 comments on commit f9df387

Please sign in to comment.