Processing math: 100%
Chemical Data Processing Library Python API - Version 1.2.3
All Classes Namespaces Functions Variables Pages
Public Member Functions | Properties | List of all members
CDPL.Descr.TanimotoSimilarity Class Reference

Functor class for calculating Tanimoto Similarities [CITB] of bitsets and vectors. More...

+ Inheritance diagram for CDPL.Descr.TanimotoSimilarity:

Public Member Functions

None __init__ ()
 Initializes the TanimotoSimilarity instance.
 
None __init__ (TanimotoSimilarity func)
 Initializes a copy of the TanimotoSimilarity instance func. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
TanimotoSimilarity assign (TanimotoSimilarity func)
 Replaces the current state of self with a copy of the state of the TanimotoSimilarity instance func. More...
 
float __call__ (Util.BitSet bs1, Util.BitSet bs2)
 Calculates the Tanimoto Similarity of the bitsets bs1 and bs2. More...
 
float __call__ (Math.FVector v1, Math.FVector v2)
 Calculates the Tanimoto Similarity of the vectors v1 and v2. More...
 
float __call__ (Math.DVector v1, Math.DVector v2)
 Calculates the Tanimoto Similarity of the vectors v1 and v2. More...
 
float __call__ (Math.LVector v1, Math.LVector v2)
 Calculates the Tanimoto Similarity of the vectors v1 and v2. More...
 
float __call__ (Math.ULVector v1, Math.ULVector v2)
 Calculates the Tanimoto Similarity of the vectors v1 and v2. More...
 

Properties

 objectID = property(getObjectID)
 

Detailed Description

Functor class for calculating Tanimoto Similarities [CITB] of bitsets and vectors.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Descr.TanimotoSimilarity.__init__ ( TanimotoSimilarity  func)

Initializes a copy of the TanimotoSimilarity instance func.

Parameters
funcThe TanimotoSimilarity instance to copy.

Member Function Documentation

◆ getObjectID()

int CDPL.Descr.TanimotoSimilarity.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python TanimotoSimilarity 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 TanimotoSimilarity 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().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ assign()

TanimotoSimilarity CDPL.Descr.TanimotoSimilarity.assign ( TanimotoSimilarity  func)

Replaces the current state of self with a copy of the state of the TanimotoSimilarity instance func.

Parameters
funcThe TanimotoSimilarity instance to copy.
Returns
self

◆ __call__() [1/5]

float CDPL.Descr.TanimotoSimilarity.__call__ ( Util.BitSet  bs1,
Util.BitSet  bs2 
)

Calculates the Tanimoto Similarity of the bitsets bs1 and bs2.

The Tanimoto Similarity S_{ab} is calculated by:

[ S_{ab} = \frac{N_{ab}}{N_a + 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 set in the first bitset and N_b is the number of bits that are 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.

Parameters
bs1The first bitset.
bs2The second bitset.
Returns
The calculated similarity measure.

◆ __call__() [2/5]

float CDPL.Descr.TanimotoSimilarity.__call__ ( Math.FVector  v1,
Math.FVector  v2 
)

Calculates the Tanimoto Similarity of the vectors v1 and v2.

The Tanimoto Similarity S_{12} is calculated by:

[ S_{12} = \frac{\vec{v}_1 \cdot \vec{v}_2}{{\left | \vec{v}_1 \right |}^2 + {\left | \vec{v}_2 \right |}^2 - \vec{v}_1 \cdot \vec{v}_2} ]

Parameters
v1The first vector.
v2The second vector.
Returns
The calculated similarity measure.

◆ __call__() [3/5]

float CDPL.Descr.TanimotoSimilarity.__call__ ( Math.DVector  v1,
Math.DVector  v2 
)

Calculates the Tanimoto Similarity of the vectors v1 and v2.

The Tanimoto Similarity S_{12} is calculated by:

[ S_{12} = \frac{\vec{v}_1 \cdot \vec{v}_2}{{\left | \vec{v}_1 \right |}^2 + {\left | \vec{v}_2 \right |}^2 - \vec{v}_1 \cdot \vec{v}_2} ]

Parameters
v1The first vector.
v2The second vector.
Returns
The calculated similarity measure.

◆ __call__() [4/5]

float CDPL.Descr.TanimotoSimilarity.__call__ ( Math.LVector  v1,
Math.LVector  v2 
)

Calculates the Tanimoto Similarity of the vectors v1 and v2.

The Tanimoto Similarity S_{12} is calculated by:

[ S_{12} = \frac{\vec{v}_1 \cdot \vec{v}_2}{{\left | \vec{v}_1 \right |}^2 + {\left | \vec{v}_2 \right |}^2 - \vec{v}_1 \cdot \vec{v}_2} ]

Parameters
v1The first vector.
v2The second vector.
Returns
The calculated similarity measure.

◆ __call__() [5/5]

float CDPL.Descr.TanimotoSimilarity.__call__ ( Math.ULVector  v1,
Math.ULVector  v2 
)

Calculates the Tanimoto Similarity of the vectors v1 and v2.

The Tanimoto Similarity S_{12} is calculated by:

[ S_{12} = \frac{\vec{v}_1 \cdot \vec{v}_2}{{\left | \vec{v}_1 \right |}^2 + {\left | \vec{v}_2 \right |}^2 - \vec{v}_1 \cdot \vec{v}_2} ]

Parameters
v1The first vector.
v2The second vector.
Returns
The calculated similarity measure.