![]() |
Chemical Data Processing Library Python API - Version 1.2.3
|
Functor class for calculating the Dice Similarity [GSIM] of bitsets. More...
Public Member Functions | |
None | __init__ () |
Initializes the DiceSimilarity instance. | |
None | __init__ (DiceSimilarity func) |
Initializes a copy of the DiceSimilarity instance func. More... | |
int | getObjectID () |
Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
DiceSimilarity | assign (DiceSimilarity func) |
Replaces the current state of self with a copy of the state of the DiceSimilarity instance func. More... | |
float | __call__ (Util.BitSet bs1, Util.BitSet bs2) |
Calculates the Dice Similarity [GSIM] of the bitsets bs1 and bs2. More... | |
Properties | |
objectID = property(getObjectID) | |
Functor class for calculating the Dice Similarity [GSIM] of bitsets.
None CDPL.Descr.DiceSimilarity.__init__ | ( | DiceSimilarity | func | ) |
Initializes a copy of the DiceSimilarity instance func.
func | The DiceSimilarity instance to copy. |
int CDPL.Descr.DiceSimilarity.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python DiceSimilarity
instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b
thus cannot tell reliably whether the two DiceSimilarity
instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID()
.
DiceSimilarity CDPL.Descr.DiceSimilarity.assign | ( | DiceSimilarity | func | ) |
Replaces the current state of self with a copy of the state of the DiceSimilarity
instance func.
func | The DiceSimilarity instance to copy. |
float CDPL.Descr.DiceSimilarity.__call__ | ( | Util.BitSet | bs1, |
Util.BitSet | bs2 | ||
) |
Calculates the Dice Similarity [GSIM] of the bitsets bs1 and bs2.
The Dice Similarity is calculated by:
[ S_{ab} = \frac{2 * N_{ab}}{N_a + N_b + 2 * N_{ab}} ]
where is the number of bits that are set in both bitsets, is the number of bits that are only set in the first bitset and 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. |