Question: Jaccard Similarity is a formula that tells you how similar two sets are. It is defined as the cardinality of the intersection divided by the cardinality of the union. Which choice is an accurate implementation in Python?
- `def jaccard(a, b): return len (a | b) / len (a & b)`
- `def jaccard(a, b): return len (a & b) / len (a | b)`
- `def jaccard(a, b): return len (a && b) / len (a || b)`
- `def jaccard(a, b): return a.intersection(b) / a.union(b)`
Answer: The correct answer of the above question is Option B:`def jaccard(a, b): return len (a & b) / len (a | b)`