Class Metrics

java.lang.Object
chemaxon.descriptors.Metrics

@PublicApi public class Metrics extends Object
The Metrics class implements dissimilarity metrics for MolecularDescriptors. For the sake of general availability of this dissimilarity calculations by any MolecularDescriptor derivatives, methods take float and int arrays as input parameters, thus they do not need to access to the internal representation of descriptors. This, however, may introduce some overhead in dissimilarity calculations, since MolecularDescriptor objects may need to transform their internal representation into an int or a float array. If this overhead is significant, then the required dissimilarity function has to be implemented as part of the descriptor class.
Since:
JChem 2.3
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    asymmetricEuclidean(float[] v1, float[] v2, double asymmetryFactor)
    Calculates the asymmetric Euclidean distance.
    static float
    asymmetricEuclidean(int[] v1, int[] v2, double asymmetryFactor)
    Calculates the asymmetric Euclidean distance.
    static float
    asymmetricNormalizedEuclidean(float[] v1, float[] v2, double asymmetryFactor)
    Calculates the asymmetric normalized Euclidean distance.
    static float
    asymmetricNormalizedEuclidean(int[] v1, int[] v2, double asymmetryFactor)
    Calculates the asymmetric normalized Euclidean distance.
    static float
    asymmetricTanimoto(float[] v1, float[] v2, float asymmetryFactor)
    Calculates the asymmetric Tanimoto dissimilarity for floating point values.
    static float
    asymmetricTanimoto(int[] v1, int[] v2, float asymmetryFactor)
    Calculates the asymmetric Tanimoto dissimilarity for floating point values.
    static float
    binaryAsymmetricEuclidean(int[] v1, int[] v2, float asymmetryFactor)
    Calculates the asymmetric Euclidean distance of binary descriptors.
    static float
    binaryAsymmetricNormalizedEuclidean(int[] v1, int[] v2, float asymmetryFactor)
    Calculates the asymmetric normalized Euclidean distance of binary descriptors.
    static float
    binaryAsymmetricNormalizedEuclidean(int[] v1, int oneCount1, int[] v2, int oneCount2, float asymmetryFactor)
    Calculates the asymmetric normalized Euclidean distance of binary descriptors.
    static float
    binaryAsymmetricTanimoto(int[] v1, int[] v2, float asymmetryFactor)
    Calculates asymmetric Tanimoto dissimilarity for binary descriptors.
    static float
    binaryAsymmetricTanimoto(int[] v1, int oneCount1, int[] v2, int oneCount2, float asymmetryFactor)
    Calculates asymmetricTanimoto dissimilarity for binary descriptors.
    static float
    binaryEuclidean(int[] v1, int[] v2)
    Calculates the Euclidean distance of two binary descriptors.
    static float
    binaryNormalizedEuclidean(int[] v1, int[] v2)
    Calculates the normalized Euclidean distance of two binary descriptors.
    static float
    binaryNormalizedEuclidean(int[] v1, int oneCount1, int[] v2, int oneCount2)
    Calculates the normalized Euclidean distance of two binary descriptors.
    static float
    binaryTanimoto(int[] v1, int[] v2)
    Calculates Tanimoto dissimilarity for binary descriptors.
    static float
    binaryTanimoto(int[] v1, int oneCount1, int[] v2, int oneCount2)
    Calculates Tanimoto dissimilarity for binary descriptors.
    static float
    binaryTversky(int[] v1, float wv1, int[] v2, float wv2)
    Calculates Tversky dissimilarity for binary descriptors.
    static float
    binaryWeightedAsymmetricEuclidean(int[] v1, int[] v2, float[] weights, float asymmetryFactor)
    Calculates the weighted asymmetric Euclidean distance of binary descriptors.
    static float
    binaryWeightedAsymmetricNormalizedEuclidean(int[] v1, int[] v2, float[] weights, float asymmetryFactor)
    Calculates the weighted asymmetric normalized Euclidean distance of binary descriptors.
    static float
    binaryWeightedAsymmetricNormalizedEuclidean(int[] v1, int oneCount1, int[] v2, int oneCount2, float[] weights, float asymmetryFactor)
    Calculates the weighted asymmetric normalized Euclidean distance of binary descriptors.
    static float
    binaryWeightedEuclidean(int[] v1, int[] v2, float[] weights)
    Calculates the weighted Euclidean distance of binary descriptors.
    static float
    binaryWeightedNormalizedEuclidean(int[] v1, int[] v2, float[] weights)
    Calculates the weighted normalized Euclidean distance of binary descriptors.
    static float
    binaryWeightedNormalizedEuclidean(int[] v1, int oneCount1, int[] v2, int oneCount2, int[] weights)
    Calculates the weighted normalized Euclidean distance of binary descriptors.
    static int
    calcBitCount(int i)
    Counts the number of bits set (1) in the integer parameter.
    static int
    calcBitCount(int[] v)
    Counts the number of bits set (1) in a bit vector.
    static float
    euclidean(float[] v1, float[] v2)
    Calculates the Euclidean distance.
    static float
    euclidean(int[] v1, int[] v2)
    Calculates the Euclidean distance.
    static float
    normalizedEuclidean(float[] v1, float[] v2)
    Calculates the normalized Euclidean distance.
    static float
    normalizedEuclidean(int[] v1, int[] v2)
    Calculates the normalized Euclidean distance.
    static float
    scaledAsymmetricTanimoto(float[] v1, float[] v2, float[] hypothesis, float scaleFactor, float asymmetryFactor)
    Calculates the scaled asymmetric Tanimoto dissimilarity for floating point values.
    static float
    scaledAsymmetricTanimoto(int[] v1, int[] v2, float[] hypothesis, float scaleFactor, float asymmetryFactor)
    Calculates the scaled asymmetric Tanimoto dissimilarity for floating point values.
    static float
    scaledTanimoto(float[] v1, float[] v2, float[] hypothesis, float scaleFactor)
    Calculates the scaled Tanimoto dissimilarity for floating point values.
    static float
    scaledTanimoto(int[] v1, int[] v2, float[] hypothesis, float scaleFactor)
    Calculates the scaled Tanimoto dissimilarity for floating point values.
    static float
    tanimoto(float[] v1, float[] v2)
    Calculates Tanimoto dissimilarity for floating point values.
    static float
    tanimoto(int[] v1, int[] v2)
    Calculates Tanimoto dissimilarity for floating point values.
    static float
    tversky(float[] v1, float wv1, float[] v2, float wv2)
    Calculates Tversky dissimilarity for floating point values.
    static float
    tversky(int[] v1, float wv1, int[] v2, float wv2)
    Calculates Tversky dissimilarity index for integer values.
    static float
    weightedAsymmetricEuclidean(float[] v1, float[] v2, float[] weights, float asymmetryFactor)
    Calculates the weighted asymmetric Euclidean distance.
    static float
    weightedAsymmetricEuclidean(int[] v1, int[] v2, float[] weights, float asymmetryFactor)
    Calculates the weighted asymmetric Euclidean distance.
    static float
    weightedAsymmetricNormalizedEuclidean(float[] v1, float[] v2, float[] weights, float asymmetryFactor)
    Calculates the weighted asymmetric normalized Euclidean distance.
    static float
    weightedAsymmetricNormalizedEuclidean(int[] v1, int[] v2, float[] weights, float asymmetryFactor)
    Calculates the weighted asymmetric normalized Euclidean distance.
    static float
    weightedEuclidean(float[] v1, float[] v2, float[] weights)
    Calculates the weighted Euclidean distance.
    static float
    weightedEuclidean(int[] v1, int[] v2, float[] weights)
    Calculates the weighted Euclidean distance.
    static float
    weightedNormalizedEuclidean(float[] v1, float[] v2, float[] weights)
    Calculates the weighted normalized Euclidean distance.
    static float
    weightedNormalizedEuclidean(int[] v1, int[] v2, float[] weights)
    Calculates the weighted normalized Euclidean distance.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Metrics

      public Metrics()
  • Method Details

    • euclidean

      public static float euclidean(float[] v1, float[] v2)
      Calculates the Euclidean distance. The dissimilarity coefficient returned ranges from 0 to MAX_FLOAT, this coefficient is not normalized.
      Parameters:
      v1 - first vector
      v2 - second vector
      Returns:
      dissimilarity coefficient
    • normalizedEuclidean

      public static float normalizedEuclidean(float[] v1, float[] v2)
      Calculates the normalized Euclidean distance. The dissimilarity coefficient returned ranges from 0 to 1.
      Parameters:
      v1 - first vector
      v2 - second vector
      Returns:
      dissimilarity coefficient
    • asymmetricEuclidean

      public static float asymmetricEuclidean(float[] v1, float[] v2, double asymmetryFactor)
      Calculates the asymmetric Euclidean distance. The dissimilarity coefficient returned ranges from 0 to MAX_FLOAT. This metric is also known as directed Euclidean.
      Parameters:
      v1 - first vector
      v2 - second vector
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • asymmetricNormalizedEuclidean

      public static float asymmetricNormalizedEuclidean(float[] v1, float[] v2, double asymmetryFactor)
      Calculates the asymmetric normalized Euclidean distance. The dissimilarity coefficient returned ranges from 0 to 1.
      Parameters:
      v1 - first vector
      v2 - second vector
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • weightedEuclidean

      public static float weightedEuclidean(float[] v1, float[] v2, float[] weights)
      Calculates the weighted Euclidean distance.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      Returns:
      dissimilarity coefficient
    • weightedNormalizedEuclidean

      public static float weightedNormalizedEuclidean(float[] v1, float[] v2, float[] weights)
      Calculates the weighted normalized Euclidean distance.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      Returns:
      dissimilarity coefficient
    • weightedAsymmetricEuclidean

      public static float weightedAsymmetricEuclidean(float[] v1, float[] v2, float[] weights, float asymmetryFactor)
      Calculates the weighted asymmetric Euclidean distance.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • weightedAsymmetricNormalizedEuclidean

      public static float weightedAsymmetricNormalizedEuclidean(float[] v1, float[] v2, float[] weights, float asymmetryFactor)
      Calculates the weighted asymmetric normalized Euclidean distance.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • tanimoto

      public static float tanimoto(float[] v1, float[] v2)
      Calculates Tanimoto dissimilarity for floating point values.
      Parameters:
      v1 - first vector
      v2 - second vector
      Returns:
      Tanimoto dissimilarity
    • tversky

      public static float tversky(float[] v1, float wv1, float[] v2, float wv2)
      Calculates Tversky dissimilarity for floating point values.
      Parameters:
      v1 - first vector
      wv1 - weight for the first vector
      v2 - second vector
      wv2 - weight for the second vector
      Returns:
      Tversky index
    • asymmetricTanimoto

      public static float asymmetricTanimoto(float[] v1, float[] v2, float asymmetryFactor)
      Calculates the asymmetric Tanimoto dissimilarity for floating point values.
      Parameters:
      v1 - first vector
      v2 - second vector
      asymmetryFactor - asymmetry ratio
      Returns:
      Tanimoto dissimilarity
    • scaledTanimoto

      public static float scaledTanimoto(float[] v1, float[] v2, float[] hypothesis, float scaleFactor)
      Calculates the scaled Tanimoto dissimilarity for floating point values.
      Parameters:
      v1 - first vector
      v2 - second vector
      hypothesis - scaling (consensus) hypothesis
      scaleFactor - scale factor
      Returns:
      Tanimoto dissimilarity
    • scaledAsymmetricTanimoto

      public static float scaledAsymmetricTanimoto(float[] v1, float[] v2, float[] hypothesis, float scaleFactor, float asymmetryFactor)
      Calculates the scaled asymmetric Tanimoto dissimilarity for floating point values.
      Parameters:
      v1 - first vector
      v2 - second vector
      hypothesis - scaling (consensus) hypothesis
      scaleFactor - scale factor
      asymmetryFactor - asymmetry ratio
      Returns:
      Tanimoto dissimilarity
    • euclidean

      public static float euclidean(int[] v1, int[] v2)
      Calculates the Euclidean distance. The dissimilarity coefficient returned ranges from 0 to MAX_FLOAT, this coefficient is not normalized.
      Parameters:
      v1 - first vector
      v2 - second vector
      Returns:
      dissimilarity coefficient
    • normalizedEuclidean

      public static float normalizedEuclidean(int[] v1, int[] v2)
      Calculates the normalized Euclidean distance. The dissimilarity coefficient returned ranges from 0 to 1.
      Parameters:
      v1 - first vector
      v2 - second vector
      Returns:
      dissimilarity coefficient
    • asymmetricEuclidean

      public static float asymmetricEuclidean(int[] v1, int[] v2, double asymmetryFactor)
      Calculates the asymmetric Euclidean distance. The dissimilarity coefficient returned ranges from 0 to MAX_FLOAT. This metric is also known as directed Euclidean.
      Parameters:
      v1 - first vector
      v2 - second vector
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • asymmetricNormalizedEuclidean

      public static float asymmetricNormalizedEuclidean(int[] v1, int[] v2, double asymmetryFactor)
      Calculates the asymmetric normalized Euclidean distance. The dissimilarity coefficient returned ranges from 0 to 1.
      Parameters:
      v1 - first vector
      v2 - second vector
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • weightedEuclidean

      public static float weightedEuclidean(int[] v1, int[] v2, float[] weights)
      Calculates the weighted Euclidean distance.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      Returns:
      dissimilarity coefficient
    • weightedNormalizedEuclidean

      public static float weightedNormalizedEuclidean(int[] v1, int[] v2, float[] weights)
      Calculates the weighted normalized Euclidean distance.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      Returns:
      dissimilarity coefficient
    • weightedAsymmetricEuclidean

      public static float weightedAsymmetricEuclidean(int[] v1, int[] v2, float[] weights, float asymmetryFactor)
      Calculates the weighted asymmetric Euclidean distance.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • weightedAsymmetricNormalizedEuclidean

      public static float weightedAsymmetricNormalizedEuclidean(int[] v1, int[] v2, float[] weights, float asymmetryFactor)
      Calculates the weighted asymmetric normalized Euclidean distance.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • tanimoto

      public static float tanimoto(int[] v1, int[] v2)
      Calculates Tanimoto dissimilarity for floating point values.
      Parameters:
      v1 - first vector
      v2 - second vector
      Returns:
      Tanimoto dissimilarity
    • tversky

      public static float tversky(int[] v1, float wv1, int[] v2, float wv2)
      Calculates Tversky dissimilarity index for integer values.
      Parameters:
      v1 - first vector
      wv1 - weight for the first vector
      v2 - second vector
      wv2 - weight for the second vector
      Returns:
      Tversky dissimilarity index
    • asymmetricTanimoto

      public static float asymmetricTanimoto(int[] v1, int[] v2, float asymmetryFactor)
      Calculates the asymmetric Tanimoto dissimilarity for floating point values.
      Parameters:
      v1 - first vector
      v2 - second vector
      asymmetryFactor - asymmetry ratio
      Returns:
      Tanimoto dissimilarity
    • scaledTanimoto

      public static float scaledTanimoto(int[] v1, int[] v2, float[] hypothesis, float scaleFactor)
      Calculates the scaled Tanimoto dissimilarity for floating point values.
      Parameters:
      v1 - first vector
      v2 - second vector
      hypothesis - scaling (consensus) hypothesis
      scaleFactor - scale factor
      Returns:
      Tanimoto dissimilarity
    • scaledAsymmetricTanimoto

      public static float scaledAsymmetricTanimoto(int[] v1, int[] v2, float[] hypothesis, float scaleFactor, float asymmetryFactor)
      Calculates the scaled asymmetric Tanimoto dissimilarity for floating point values.
      Parameters:
      v1 - first vector
      v2 - second vector
      hypothesis - scaling (consensus) hypothesis
      scaleFactor - scale factor
      asymmetryFactor - asymmetry ratio
      Returns:
      Tanimoto dissimilarity
    • calcBitCount

      public static int calcBitCount(int i)
      Counts the number of bits set (1) in the integer parameter.
      Parameters:
      i - an integer value
      Returns:
      number of 1 bits in the parameter passed
    • calcBitCount

      public static int calcBitCount(int[] v)
      Counts the number of bits set (1) in a bit vector.
      Parameters:
      v - bit vector, represented by an integer vector, each element stores 32 bits
      Returns:
      number of 1 bits in the bit vector
    • binaryEuclidean

      public static float binaryEuclidean(int[] v1, int[] v2)
      Calculates the Euclidean distance of two binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      Returns:
      dissimilarity coefficient
    • binaryNormalizedEuclidean

      public static float binaryNormalizedEuclidean(int[] v1, int[] v2)
      Calculates the normalized Euclidean distance of two binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      Returns:
      dissimilarity coefficient
    • binaryNormalizedEuclidean

      public static float binaryNormalizedEuclidean(int[] v1, int oneCount1, int[] v2, int oneCount2)
      Calculates the normalized Euclidean distance of two binary descriptors. This method should be called in place of binaryNormalizedEuclidean( final int[] v1, final int[] v2 ) when the number of bits set (1) is known in both input vectors, as this method does not recalculate these values which results in faster operation.
      Parameters:
      v1 - first vector
      oneCount1 - number of 1 bits in v1
      v2 - second vector
      oneCount2 - number of 1 bits in v1
      Returns:
      dissimilarity coefficient
    • binaryWeightedEuclidean

      public static float binaryWeightedEuclidean(int[] v1, int[] v2, float[] weights)
      Calculates the weighted Euclidean distance of binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      Returns:
      dissimilarity coefficient
    • binaryWeightedNormalizedEuclidean

      public static float binaryWeightedNormalizedEuclidean(int[] v1, int[] v2, float[] weights)
      Calculates the weighted normalized Euclidean distance of binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      Returns:
      dissimilarity coefficient
    • binaryWeightedNormalizedEuclidean

      public static float binaryWeightedNormalizedEuclidean(int[] v1, int oneCount1, int[] v2, int oneCount2, int[] weights)
      Calculates the weighted normalized Euclidean distance of binary descriptors.
      Parameters:
      v1 - first vector
      oneCount1 - number of 1 bits in v1
      v2 - second vector
      oneCount2 - number of 1 bits in v2
      weights - weight factors for every coordinate
      Returns:
      dissimilarity coefficient
    • binaryAsymmetricEuclidean

      public static float binaryAsymmetricEuclidean(int[] v1, int[] v2, float asymmetryFactor)
      Calculates the asymmetric Euclidean distance of binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • binaryAsymmetricNormalizedEuclidean

      public static float binaryAsymmetricNormalizedEuclidean(int[] v1, int[] v2, float asymmetryFactor)
      Calculates the asymmetric normalized Euclidean distance of binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • binaryAsymmetricNormalizedEuclidean

      public static float binaryAsymmetricNormalizedEuclidean(int[] v1, int oneCount1, int[] v2, int oneCount2, float asymmetryFactor)
      Calculates the asymmetric normalized Euclidean distance of binary descriptors. This method should be called in place of binaryAsymmetricNormalizedEuclidean( final int[] v1, final int[] v2 ) when the number of bits set (1) is known in both input vectors, as this method does not recalculate these values which results in faster operation.
      Parameters:
      v1 - first vector
      oneCount1 - number of 1 bits in v1
      v2 - second vector
      oneCount2 - number of 1 bits in v2
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • binaryWeightedAsymmetricEuclidean

      public static float binaryWeightedAsymmetricEuclidean(int[] v1, int[] v2, float[] weights, float asymmetryFactor)
      Calculates the weighted asymmetric Euclidean distance of binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • binaryWeightedAsymmetricNormalizedEuclidean

      public static float binaryWeightedAsymmetricNormalizedEuclidean(int[] v1, int[] v2, float[] weights, float asymmetryFactor)
      Calculates the weighted asymmetric normalized Euclidean distance of binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      weights - weight factors for every coordinate
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • binaryWeightedAsymmetricNormalizedEuclidean

      public static float binaryWeightedAsymmetricNormalizedEuclidean(int[] v1, int oneCount1, int[] v2, int oneCount2, float[] weights, float asymmetryFactor)
      Calculates the weighted asymmetric normalized Euclidean distance of binary descriptors. This method should be called in place of binaryWeightedAsymmetricNormalizedEuclidean( final int[] v1, final int[] v2, final float[] weights, float asymmetryFactor ) when the number of bits set (1) is known in both input vectors, as this method does not recalculate these values which results in faster operation.
      Parameters:
      v1 - first vector
      oneCount1 - number of 1 bits in v1
      v2 - second vector
      oneCount2 - number of 1 bits in v2
      weights - weight factors for every coordinate
      asymmetryFactor - asymmetry ratio
      Returns:
      dissimilarity coefficient
    • binaryTanimoto

      public static float binaryTanimoto(int[] v1, int[] v2)
      Calculates Tanimoto dissimilarity for binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      Returns:
      Tanimoto dissimilarity
    • binaryTversky

      public static float binaryTversky(int[] v1, float wv1, int[] v2, float wv2)
      Calculates Tversky dissimilarity for binary descriptors.
      Parameters:
      v1 - first vector
      wv1 - weight for the first vector
      v2 - second vector
      wv2 - weight for the second vector
      Returns:
      Tversky dissimilarity
    • binaryAsymmetricTanimoto

      public static float binaryAsymmetricTanimoto(int[] v1, int[] v2, float asymmetryFactor)
      Calculates asymmetric Tanimoto dissimilarity for binary descriptors.
      Parameters:
      v1 - first vector
      v2 - second vector
      asymmetryFactor - asymmetry ratio
      Returns:
      Tanimoto dissimilarity
    • binaryTanimoto

      public static float binaryTanimoto(int[] v1, int oneCount1, int[] v2, int oneCount2)
      Calculates Tanimoto dissimilarity for binary descriptors. This method should be called in place of binaryTanimoto( final int[] v1, final int[] v2 ) when the number of bits set (1) is known in both input vectors, as this method does not recalculate these values which results in faster operation.
      Parameters:
      v1 - first vector
      oneCount1 - number of 1 bits in v1
      v2 - second vector
      oneCount2 - number of 1 bits in v2
      Returns:
      Tanimoto dissimilarity
    • binaryAsymmetricTanimoto

      public static float binaryAsymmetricTanimoto(int[] v1, int oneCount1, int[] v2, int oneCount2, float asymmetryFactor)
      Calculates asymmetricTanimoto dissimilarity for binary descriptors. This method should be called in place of binaryTanimoto( final int[] v1, final int[] v2, float asymmetryFactor ) when the number of bits set (1) is known in both input vectors, as this method does not recalculate these values which results in faster operation.
      Parameters:
      v1 - first vector
      oneCount1 - number of 1 bits in v1
      v2 - second vector
      oneCount2 - number of 1 bits in v2
      asymmetryFactor - asymmetry ratio
      Returns:
      Tanimoto dissimilarity