QueryProcessor.SF.ScoringFunction.EMD
Class Signatures

java.lang.Object
  extended by QueryProcessor.SF.ScoringFunction.EMD.Signatures

public class Signatures
extends java.lang.Object

This class represents to signatures for which a distance should be calculated.


Constructor Summary
Signatures(double[][] costMatrix)
          Creates a new instance of Signatures
Signatures(double[][] costMatrix, double[] pDummyCostVector, double[] qDummyCostVector)
          Creates a new instance of Signatures
Signatures(java.lang.Object[] pFeatures, java.lang.Object[] qFeatures, QueryProcessor.SF.ScoringFunction.EMD.GroundDistance groundDistance)
          Creates a new instance of Signatures
Signatures(java.lang.Object[] pFeatures, java.lang.Object[] qFeatures, QueryProcessor.SF.ScoringFunction.EMD.GroundDistance groundDistance, java.lang.Object pDummyFeature, java.lang.Object qDummyFeature)
          Creates a new instance of Signatures
Signatures(Signatures sig)
          Creates a new instance of Signatures (copy constructor)
 
Method Summary
 double getCost(int i, int j)
          Gets the cost-entry for the specified index (including Dummys if needed)
 int getPSize()
          Returns the feature-count of signature P (including Dummys if needed)
 double getPWeight(int index)
          Gets the weight for the specified feature in P (including Dummys if needed)
 double getPWeightSum()
          Returns the linear sum of the weights of signature P (ex!
 int getQSize()
          Returns the feature-count of signature Q (including Dummys if needed)
 double getQWeight(int index)
          Gets the weight for the specified feature in Q (including Dummys if needed)
 double getQWeightSum()
          Returns the linear sum of the weights of signature Q (ex!
 int getSimplePSize()
          Returns the feature-count of signature P (no Dummys)
 int getSimpleQSize()
          Returns the feature-count of signature Q (no Dummys)
 void setPWeight(int index, double weight)
          Sets the weight for the specified feature in P
 void setPWeights(double[] weights)
          Sets the weights of all features in P
 void setQWeight(int index, double weight)
          Sets the weight for the specified feature in Q
 void setQWeights(double[] weights)
          Sets the weights of all features in Q
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Signatures

public Signatures(Signatures sig)
Creates a new instance of Signatures (copy constructor)

Parameters:
sig - The signature to clone

Signatures

public Signatures(double[][] costMatrix)
           throws QueryProcessor.SF.ScoringFunction.EMD.InvalidMatrixException,
                  QueryProcessor.SF.ScoringFunction.EMD.InvalidDummyCostException
Creates a new instance of Signatures

Parameters:
costMatrix - The Cost-Matrix for transporting weights from P to Q (starting at [0, 0])
Throws:
InvalidMatrixException - If the specified Matrix is invalid
InvalidDummyCostException - If the dimensions of the dummyvectors are not matching the dimensions of the costmatrix

Signatures

public Signatures(double[][] costMatrix,
                  double[] pDummyCostVector,
                  double[] qDummyCostVector)
           throws QueryProcessor.SF.ScoringFunction.EMD.InvalidMatrixException,
                  QueryProcessor.SF.ScoringFunction.EMD.InvalidDummyCostException
Creates a new instance of Signatures

Parameters:
costMatrix - The Cost-Matrix for transporting weights from P to Q (starting at [0, 0])
pDummyCostVector - The Cost-Vector for Siganture P if required
qDummyCostVector - The Cost-Vector for Siganture Q if required
Throws:
InvalidMatrixException - If the specified Matrix is invalid
InvalidDummyCostException - If the dimensions of the dummyvectors are not matching the dimensions of the costmatrix

Signatures

public Signatures(java.lang.Object[] pFeatures,
                  java.lang.Object[] qFeatures,
                  QueryProcessor.SF.ScoringFunction.EMD.GroundDistance groundDistance)
           throws QueryProcessor.SF.ScoringFunction.EMD.InvalidFeatureException
Creates a new instance of Signatures

Parameters:
pFeatures - The features of signature P
qFeatures - The features of signature Q
groundDistance - The function for calculating a distance between to features of P and Q
Throws:
InvalidFeatureException - If no features are supplyed

Signatures

public Signatures(java.lang.Object[] pFeatures,
                  java.lang.Object[] qFeatures,
                  QueryProcessor.SF.ScoringFunction.EMD.GroundDistance groundDistance,
                  java.lang.Object pDummyFeature,
                  java.lang.Object qDummyFeature)
           throws QueryProcessor.SF.ScoringFunction.EMD.InvalidFeatureException
Creates a new instance of Signatures

Parameters:
pFeatures - The features of signature P
qFeatures - The features of signature Q
groundDistance - The function for calculating a distance between to features of P and Q
pDummyFeature - The Dummy-Feature of P if requred (null means zero-cost dummy-features for P)
qDummyFeature - The Dummy-Feature of Q if requred (null means zero-cost dummy-features for Q)
Throws:
InvalidFeatureException - If no features are supplyed
Method Detail

getPSize

public int getPSize()
Returns the feature-count of signature P (including Dummys if needed)

Returns:
The feature-count

getSimplePSize

public int getSimplePSize()
Returns the feature-count of signature P (no Dummys)

Returns:
The feature-count

getQSize

public int getQSize()
Returns the feature-count of signature Q (including Dummys if needed)

Returns:
The feature-count

getSimpleQSize

public int getSimpleQSize()
Returns the feature-count of signature Q (no Dummys)

Returns:
The feature-count

getPWeightSum

public double getPWeightSum()
Returns the linear sum of the weights of signature P (ex!cluding Dummyweight)

Returns:
The feature-count

getQWeightSum

public double getQWeightSum()
Returns the linear sum of the weights of signature Q (ex!cluding Dummyweight)

Returns:
The feature-count

getPWeight

public double getPWeight(int index)
                  throws java.lang.IndexOutOfBoundsException
Gets the weight for the specified feature in P (including Dummys if needed)

Parameters:
index - The index of the feature (Starting at 1)
Returns:
The weight
Throws:
java.lang.IndexOutOfBoundsException - If index is not matching the signature

setPWeight

public void setPWeight(int index,
                       double weight)
                throws java.lang.IndexOutOfBoundsException
Sets the weight for the specified feature in P

Parameters:
index - The index of the feature (Starting at 1)
weight - The weight
Throws:
java.lang.IndexOutOfBoundsException - If index is not matching the signature

setPWeights

public void setPWeights(double[] weights)
                 throws QueryProcessor.SF.ScoringFunction.EMD.InvalidWeightsVectorException
Sets the weights of all features in P

Parameters:
weights - The weights vector
Throws:
InvalidWeightsVectorException - If index is not matching the signature

getQWeight

public double getQWeight(int index)
                  throws java.lang.IndexOutOfBoundsException
Gets the weight for the specified feature in Q (including Dummys if needed)

Parameters:
index - The index of the feature (Starting at 1)
Returns:
The weight
Throws:
java.lang.IndexOutOfBoundsException - If index is not matching the signature

setQWeight

public void setQWeight(int index,
                       double weight)
                throws java.lang.IndexOutOfBoundsException
Sets the weight for the specified feature in Q

Parameters:
index - The index of the feature (Starting at 1)
weight - The weight
Throws:
java.lang.IndexOutOfBoundsException - If index is not matching the signature

setQWeights

public void setQWeights(double[] weights)
                 throws QueryProcessor.SF.ScoringFunction.EMD.InvalidWeightsVectorException
Sets the weights of all features in Q

Parameters:
weights - The weights vector
Throws:
InvalidWeightsVectorException - If index is not matching the signature

getCost

public double getCost(int i,
                      int j)
               throws java.lang.IndexOutOfBoundsException
Gets the cost-entry for the specified index (including Dummys if needed)

Parameters:
i - (Starting at 1)
j - (Starting at 1)
Returns:
The cost cij
Throws:
java.lang.IndexOutOfBoundsException - If index is not matching the signature