DataStructs.SparseIntVect

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(...) DiceSimilarity( (SparseBitVect)bv1, (SparseBitVect)bv2 [, (bool)returnDistance=0]) -> float :... | source code
pyDiceSimilarity(v1, v2, bounds=None, useAbs=False) Implements the DICE similarity metric. | source code
DotProduct(bv1, bv2) | source code
_test() | source code

Function Details | [hide private]

### DiceSimilarity(...) | source code
    DiceSimilarity( (SparseBitVect)bv1, (SparseBitVect)bv2 [, (bool)returnDistance=0]) -> float :

        C++ signature :
            double DiceSimilarity(SparseBitVect,SparseBitVect [,bool=0])

    DiceSimilarity( (ExplicitBitVect)bv1, (ExplicitBitVect)bv2 [, (bool)returnDistance=0]) -> float :
        2*B(bv1&bv2) / (B(bv1) + B(bv2))

        C++ signature :
            double DiceSimilarity(ExplicitBitVect,ExplicitBitVect [,bool=0])

    DiceSimilarity( (SparseBitVect)bv1, (str)pkl [, (bool)returnDistance=0]) -> float :

        C++ signature :
            double DiceSimilarity(SparseBitVect,std::string [,bool=0])

    DiceSimilarity( (ExplicitBitVect)bv1, (str)pkl [, (bool)returnDistance=0]) -> float :
        2*B(bv1&bv2) / (B(bv1) + B(bv2))

        C++ signature :
            double DiceSimilarity(ExplicitBitVect,std::string [,bool=0])

    DiceSimilarity( (IntSparseIntVect)siv1, (IntSparseIntVect)siv2 [, (bool)returnDistance=False [, (float)bounds=0.0]]) -> float :
        return the Dice similarity between two vectors

        C++ signature :
            double DiceSimilarity(RDKit::SparseIntVect<int>,RDKit::SparseIntVect<int> [,bool=False [,double=0.0]])

    DiceSimilarity( (LongSparseIntVect)siv1, (LongSparseIntVect)siv2 [, (bool)returnDistance=False [, (float)bounds=0.0]]) -> float :
        return the Dice similarity between two vectors

        C++ signature :
            double DiceSimilarity(RDKit::SparseIntVect<long long>,RDKit::SparseIntVect<long long> [,bool=False [,double=0.0]])

    DiceSimilarity( (UIntSparseIntVect)siv1, (UIntSparseIntVect)siv2 [, (bool)returnDistance=False [, (float)bounds=0.0]]) -> float :
        return the Dice similarity between two vectors

        C++ signature :
            double DiceSimilarity(RDKit::SparseIntVect<unsigned int>,RDKit::SparseIntVect<unsigned int> [,bool=False [,double=0.0]])

    DiceSimilarity( (ULongSparseIntVect)siv1, (ULongSparseIntVect)siv2 [, (bool)returnDistance=False [, (float)bounds=0.0]]) -> float :
        return the Dice similarity between two vectors

        C++ signature :
            double DiceSimilarity(RDKit::SparseIntVect<unsigned long long>,RDKit::SparseIntVect<unsigned long long> [,bool=False [,double=0.0]])

### 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