![]() |
Chemical Data Processing Library C++ API - Version 1.2.3
|
Functor class for calculating the Dice Similarity [GSIM] of bitsets. More...
#include <SimilarityFunctors.hpp>
Public Member Functions | |
double | operator() (const Util::BitSet &bs1, const Util::BitSet &bs2) const |
Calculates the Dice Similarity [GSIM] of the bitsets bs1 and bs2. More... | |
Functor class for calculating the Dice Similarity [GSIM] of bitsets.
|
inline |
Calculates the Dice Similarity [GSIM] of the bitsets bs1 and bs2.
The Dice Similarity \( S_{ab} \) is calculated by:
\[ S_{ab} = \frac{2 * N_{ab}}{N_a + N_b + 2 * N_{ab}} \]
where \( N_{ab} \) is the number of bits that are set in both bitsets, \( N_a \) is the number of bits that are only set in the first bitset and \( N_b \) is the number of bits that are only set in the second bitset.
If the specified bitsets bs1 and bs2 are of different size, missing bits at the end of the smaller bitset are assumed to be zero.
bs1 | The first bitset. |
bs2 | The second bitset. |