@PublicAPI public class SimilarityCalculatorFactory extends java.lang.Object
Example Usage: SimilarityCalculator sc = SimilarityCalculatorFactory.create("TVERSKY;0.33;0.99"); The filed separator ";" is used as defined in SimilarityCalculatorFactory.SEPARATOR. int[] query = precalculated fingerprint; bitstring represented as int array. sc.setQueryFingerprint(query); // here can be a loop that iterates on target fingerprints int[] target = precalculated fingerprint; bitstring represented as int array. float similarity = sc.getSimilarity(target); float disssimilarity = sc.getDissimilarity(target); // target loop ends
Modifier and Type | Class and Description |
---|---|
static class |
SimilarityCalculatorFactory.Representation |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SEPARATOR
This character is used to separate fields of the parameter string.
|
Modifier and Type | Method and Description |
---|---|
static SimilarityCalculator<int[]> |
create(java.lang.String params)
Creates a similarity calculator object according to the user defined parameters.
|
static SimilarityCalculator<int[]> |
create(java.lang.String params,
int from,
int to)
Creates a similarity calculator object according to the user defined parameters.
|
static java.text.NumberFormat |
getNumberFormat() |
static float |
parse(java.lang.String number) |
public static java.lang.String SEPARATOR
public static SimilarityCalculator<int[]> create(java.lang.String params) throws java.text.ParseException
params
- Define similarity function type and its possible parameters.
There is a brief and a detailed notation. Use only one of them at the same time.
The fields are separated with ";" by default but this SEPARATOR
can be changed. Everything is case insensitive.
Brief: (sequence sensitive) - At first position there must the metrics name stand: TANIMOTO, TVERSKY, DICE, EUCLIDEAN, NORMALIZED_EUCLIDEAN, SUBSTRUCTURE, SUPERSTRUCTURE, DEFAULT the default metrics type is now Tanimoto. - At the third and fourth position the alpha parameter for query and beta for target is expeceted if Tversky index is selected.If not given, default parameter values are 1-1 resulting in TANIMOTO metric. -e.g.: TVERSKY;0.33;0.99 or DICE Detailed: (sequence insensitive) - Metrics name is given using the the prefix: "metrics=" (without quotation mark) TANIMOTO, TVERSKY, DICE, EUCLIDEAN, NORMALIZED_EUCLIDEAN, SUBSTRUCTURE, SUPERSTRUCTURE - to set Tversky weight for query use tverskyWeightForQuery= - to set Tversky weight for target use tverskyWeightForTarget= If the weight was not given, the default "1" is used. -e.g. metrics=TVERSKY;tverskyWeightForQuery=0.33;tverskyWeightForTarget=0.99
java.text.ParseException
- if input string errorpublic static SimilarityCalculator<int[]> create(java.lang.String params, int from, int to) throws java.text.ParseException
params
- Defines similarity function type and its possible parameters. See: create
( String params )
from
- The starting position from which the integer array is examined (inclusive)to
- The ending position to which the integer array is examined (exclusive)java.text.ParseException
- if input string errorpublic static float parse(java.lang.String number) throws java.text.ParseException
java.text.ParseException
public static java.text.NumberFormat getNumberFormat()