Package rdkit :: Package DataStructs :: Module SparseIntVect
[hide private]
[frames] | no frames]

Module SparseIntVect

source code

Classes [hide private]
  pySparseIntVect
this class is pretty much obsolete (it's in C++ now)
Functions [hide private]
 
pyDiceSimilarity(v1, v2, bounds=None, useAbs=False)
Implements the DICE similarity metric.
source code
 
DotProduct(bv1, bv2) source code
 
_test() source code
Variables [hide private]
  __package__ = 'rdkit.DataStructs'

Imports: copy, DataStructs, DiceSimilarity


Function Details [hide private]

pyDiceSimilarity(v1, v2, bounds=None, useAbs=False)

source code 
Implements the DICE similarity metric.

>>> v1 = DataStructs.IntSparseIntVect(10)
>>> v2 = DataStructs.IntSparseIntVect(10)
>>> v1.UpdateFromSequence((1,2,3))
>>> v2.UpdateFromSequence((1,2,3))
>>> DiceSimilarity(v1,v2)
1.0

>>> v2 = DataStructs.IntSparseIntVect(10)
>>> v2.UpdateFromSequence((5,6))
>>> DiceSimilarity(v1,v2)
0.0

>>> v1 = DataStructs.IntSparseIntVect(10)
>>> v2 = DataStructs.IntSparseIntVect(10)
>>> v1.UpdateFromSequence((1,2,3,4))
>>> v2.UpdateFromSequence((1,3,5,7))
>>> DiceSimilarity(v1,v2)
0.5

>>> v1 = DataStructs.IntSparseIntVect(10)
>>> v2 = DataStructs.IntSparseIntVect(10)
>>> v1.UpdateFromSequence((1,2,3,4,5,6))
>>> v2.UpdateFromSequence((1,3))
>>> DiceSimilarity(v1,v2)
0.5