User 71f9fd1282

09-09-2004 13:33:39

How can I define and use my own (custom) metric in the .jsp example?

I am using custom fingerprints implemented in classes FP*.java.

The similarity score between two fingerprints x and y should be computed according to xMy, where x is the first fingerprint, M a matrix and y the second fingerprint.

In more detail:

xMy is x*(M*y) that means, multiplication of Matrix M with "vector" y and afterwards multiplication of the resulting vector with "vector" x. The idea is that not only common bits in the two fingerprints should higher the score but also bits resembling "interchangeable substructures".

I modified the FP.java file the following way:

final static private String[] metrics = { "Tanimoto", "MyScore"}

final static private float[] defaultThresholds = { 0.3F, 0.3F }

...

Can the computation take place in the

public float getDissimilarity method?

there is a comment

// add new metrics here

and I inserted

case 1 :

int score=0; //"MyScore"

int DEFAULT_LENGTH=379; //length fingerprint

float[][] m = ...;

//read the single "Bits" of the two fingerprints....

for (i=0; i<DEFAULT_LENGTH;i++)

if (getKey(i)==1)

{

for (j=0;j<DEFAULT_LENGTH;j++)

{

if (((FP)other).getKey(j)==1)

{

score=score+m

I am using custom fingerprints implemented in classes FP*.java.

The similarity score between two fingerprints x and y should be computed according to xMy, where x is the first fingerprint, M a matrix and y the second fingerprint.

In more detail:

xMy is x*(M*y) that means, multiplication of Matrix M with "vector" y and afterwards multiplication of the resulting vector with "vector" x. The idea is that not only common bits in the two fingerprints should higher the score but also bits resembling "interchangeable substructures".

I modified the FP.java file the following way:

final static private String[] metrics = { "Tanimoto", "MyScore"}

final static private float[] defaultThresholds = { 0.3F, 0.3F }

...

Can the computation take place in the

public float getDissimilarity method?

there is a comment

// add new metrics here

and I inserted

case 1 :

int score=0; //"MyScore"

int DEFAULT_LENGTH=379; //length fingerprint

float[][] m = ...;

//read the single "Bits" of the two fingerprints....

for (i=0; i<DEFAULT_LENGTH;i++)

if (getKey(i)==1)

{

for (j=0;j<DEFAULT_LENGTH;j++)

{

if (((FP)other).getKey(j)==1)

{

score=score+m

*[j];*

}

}

}

return score;

This does not work :(.

What else must I do (which files must I modify/create) to use my custom score in the .jsp-application?

Thanks for your help}

}

}

return score;

This does not work :(.

What else must I do (which files must I modify/create) to use my custom score in the .jsp-application?

Thanks for your help