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]
 
DiceSimilarity(...)
C++ signature:...
source code
 
pyDiceSimilarity(v1, v2, bounds=None, useAbs=False)
Implements the DICE similarity metric.
source code
 
_test() source code
Function Details [hide private]

DiceSimilarity(...)

source code 
C++ signature:
    DiceSimilarity(SparseBitVect bv1, SparseBitVect bv2, bool returnDistance=0) -> double

2*B(bv1&bv2) / (B(bv1) + B(bv2))
C++ signature:
    DiceSimilarity(ExplicitBitVect bv1, ExplicitBitVect bv2, bool returnDistance=0) -> double
C++ signature:
    DiceSimilarity(SparseBitVect bv1, std::string pkl, bool returnDistance=0) -> double

2*B(bv1&bv2) / (B(bv1) + B(bv2))
C++ signature:
    DiceSimilarity(ExplicitBitVect bv1, std::string pkl, bool returnDistance=0) -> double

return the Dice similarity between two vectors
C++ signature:
    DiceSimilarity(RDKit::SparseIntVect<int> siv1, RDKit::SparseIntVect<int> siv2, bool returnDistance=False, double bounds=0.0) -> double

return the Dice similarity between two vectors
C++ signature:
    DiceSimilarity(RDKit::SparseIntVect<long long> siv1, RDKit::SparseIntVect<long long> siv2, bool returnDistance=False, double bounds=0.0) -> double

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