Chemical Data Processing Library C++ API - Version 1.2.3
Public Member Functions | List of all members
CDPL::Descr::EuclideanSimilarity Class Reference

Functor class for calculating the Euclidean Similarity [GSIM] of bitsets. More...

#include <SimilarityFunctors.hpp>

Public Member Functions

double operator() (const Util::BitSet &bs1, const Util::BitSet &bs2) const
 Calculates the Euclidean Similarity [GSIM] of the bitsets bs1 and bs2. More...
 

Detailed Description

Functor class for calculating the Euclidean Similarity [GSIM] of bitsets.

Member Function Documentation

◆ operator()()

double CDPL::Descr::EuclideanSimilarity::operator() ( const Util::BitSet bs1,
const Util::BitSet bs2 
) const
inline

Calculates the Euclidean Similarity [GSIM] of the bitsets bs1 and bs2.

The Euclidean Similarity \( S_{ab} \) is calculated by:

\[ S_{ab} = \sqrt{\frac{N_{ab} + N_{!ab}}{N_a + N_b + N_{ab} + 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 only in the first bitset, \( N_b \) is the number of bits that are set only in the second bitset and \( N_{!ab} \) is the number of bits that are not set in both bitsets.

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.

The documentation for this class was generated from the following file: