/fingerprint/man/distance.Rd
Unknown | 132 lines | 119 code | 13 blank | 0 comment | 0 complexity | e9f884e1dbef6b317f39dccce522aa8c MD5 | raw file
1\name{distance} 2\alias{distance} 3\title{ 4Calculates the Similarity or Dissimilarity Between Two Fingerprints 5} 6\description{ 7 A number of distance metrics can be calculated for binary 8 fingerprints. Some of these are actually similarity metrics and 9 thus represent the reverse of a distance metric. 10 11 The following are distance (dissimilarity) metrics 12 \itemize{ 13 \item Hamming 14 \item Mean Hamming 15 \item Soergel 16 \item Pattern Difference 17 \item Variance 18 \item Size 19 \item Shape 20 } 21 22 The following metrics are similarity metrics and so the distance can 23 be obtained by subtracting the value fom 1.0 24 \itemize{ 25 \item Tanimoto 26 \item Dice 27 \item Modified Tanimoto 28 \item Simple 29 \item Jaccard 30 \item Russel-Rao 31 \item Rodgers Tanimoto 32 \item Cosine 33 \item Achiai 34 \item Carbo 35 \item Baroniurbanibuser 36 \item Kulczynski2 37 \item Robust 38 } 39 40 Finally the method also provides a set of composite and asymmetric 41 distance metrics 42 \itemize{ 43 \item Hamann 44 \item Yule 45 \item Pearson 46 \item Dispersion 47 \item McConnaughey 48 \item Stiles 49 \item Simpson 50 \item Petke 51 } 52 The default metric is the Tanimoto coefficient. 53} 54\usage{ 55distance(fp1, fp2, method) 56} 57\arguments{ 58 \item{fp1}{ 59 An object of class \code{fingerprint} or \code{featvec} 60 } 61 \item{fp2}{ 62 An object of class \code{fingerprint} or \code{featvec} 63 } 64 \item{method}{ 65 The type of distance metric desired. Partial matching is 66 supported and the deault is \code{tanimoto}. Alternative values are 67 \itemize{ 68 \item \code{euclidean} 69 \item \code{hamming} 70 \item \code{meanHamming} 71 \item \code{soergel} 72 \item \code{patternDifference} 73 \item \code{variance} 74 \item \code{size} 75 \item \code{shape} 76 77 \item \code{jaccard} 78 \item \code{dice} 79 \item \code{mt} 80 \item \code{simple} 81 \item \code{russelrao} 82 \item \code{rodgerstanimoto} 83 \item \code{cosine} 84 \item \code{achiai} 85 \item \code{carbo} 86 \item \code{baroniurbanibuser} 87 \item \code{kulczynski2} 88 \item \code{robust} 89 90 \item \code{hamann} 91 \item \code{yule} 92 \item \code{pearson} 93 \item \code{mcconnaughey} 94 \item \code{stiles} 95 96 \item \code{simpson} 97 \item \code{petke} 98 } 99 If the two fingerprints are of class \code{featvec} then the following methods 100 may be specified: \code{tanimoto}, \code{robust} and \code{dice}. 101 102 } 103} 104\value{ 105 Numeric value representing the distance in the specified metric between the 106 supplied fingerprint objects 107} 108\examples{ 109# make a 2 fingerprint vectors 110fp1 <- new("fingerprint", nbit=6, bits=c(1,2,5,6)) 111fp2 <- new("fingerprint", nbit=6, bits=c(1,2,5,6)) 112 113# calculate the tanimoto coefficient 114distance(fp1,fp2) # should be 1 115 116# Invert the second fingerprint 117fp3 <- !fp2 118 119distance(fp1,fp3) # should be 0 120} 121 122\references{Fligner, M.A.; Verducci, J.S.; Blower, P.E.; 123 A Modification of the Jaccard-Tanimoto Similarity Index for 124 Diverse Selection of Chemical Compounds Using Binary Strings, 125 \emph{Technometrics}, 2002, \emph{44}(2), 110-119 126 127 Monve, V.; Introduction to Similarity Searching in 128 Chemistry, \emph{MATCH - Comm. Math. Comp. Chem.}, 2004, \emph{51}, 7-38 129} 130 131\keyword{logic} 132\author{Rajarshi Guha \email{rajarshi.guha@gmail.com}}