![]() |
Chemical Data Processing Library C++ API - Version 1.3.0
|
Functor class for calculating the Tversky Similarity [GSIM] of bitsets. More...
#include <SimilarityFunctors.hpp>
Public Member Functions | |
TverskySimilarity (double alpha=0.95, double beta=0.05) | |
Constructor. More... | |
double | operator() (const Util::BitSet &bs1, const Util::BitSet &bs2) const |
Calculates the Tversky Similarity [GSIM] of the bitsets bs1 and bs2. More... | |
Functor class for calculating the Tversky Similarity [GSIM] of bitsets.
|
inline |
Constructor.
alpha | Weights the contribution of the first bitset. |
beta | Weights the contribution of the second bitset. |
|
inline |
Calculates the Tversky Similarity [GSIM] of the bitsets bs1 and bs2.
The Tversky Similarity S_{ab} is calculated by:
S_{ab} = \frac{N_{ab}}{\alpha * N_a + \beta * N_b + 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. \alpha and \beta are bitset contribution weighting factors.
The Tversky measure is asymmetric. Setting the parameters \alpha = \beta = 1.0 makes it identical to the Tanimoto measure.
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. |