Interface SMTaxonomyPath
-
- All Superinterfaces:
SimilarityMeasure
,SMTaxonomy
- All Known Implementing Classes:
SMTaxonomyPathImpl
public interface SMTaxonomyPath extends SMTaxonomy
The similarity between query and case based on the shortest path between query and case in relation to the longest possible path.To compute the similarity between two nodes first first the longest path in the taxonomy is searched. The path is required, to compute a value using the weights for up and down:
maxPathWeighted = weightUp * #maxStepsUpward + weightDown * #maxStepsDownward
For this, the height of the deepest node is taken and doubled. In many taxonomies, this path is longer than the real existing longest path. But it's important, that the value of maxPathWeighted is always the highest possible value. Using different weights for up and down, there might be different paths, with different steps counts. So, a overestimating path is used.
At next, the common parent of the nodes is searched. Second, the path is traversed up from query to the common parent and traversed down to the case node. Thereby, each step upward is weighted and each step downward is weighted.
The value for the path is calculated as follows:
currentPath = weightUp * #stepsUpward + weightDown * #stepsDownward
Using the values for nodePathWeighted and maxPathWeighted, the similarity is calculated as follows:
sim = (maxPathWeighted - nodePathWeighted) / maxPathWeighted
- Author:
- Rainer Maximini, Alexander Schultheis
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_WEIGHT_DOWN
Default weight for steps downwards in path between nodes is 1.0.static double
DEFAULT_WEIGHT_UP
Default weight for steps upwards in path between nodes is 1.0.static String
NAME
Name of similarity measure is "TaxonomyPath".-
Fields inherited from interface de.uni_trier.wi2.procake.similarity.SimilarityMeasure
COMPONENT, COMPONENT_KEY, LOG_ORDER_NAME_NOT_FOUND
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double
getWeightDown()
double
getWeightUp()
void
setWeightDown(double weight)
Sets the weight for a step down.void
setWeightUp(double weight)
Sets the weight for a step up.-
Methods inherited from interface de.uni_trier.wi2.procake.similarity.SimilarityMeasure
compute, getDataClass, getName, getSystemName, isForceOverride, isReusable, setForceOverride
-
Methods inherited from interface de.uni_trier.wi2.procake.similarity.base.taxonomy.SMTaxonomy
getInstanceTaxonomyOrderPredicate
-
-
-
-
Field Detail
-
NAME
static final String NAME
Name of similarity measure is "TaxonomyPath".- See Also:
- Constant Field Values
-
DEFAULT_WEIGHT_DOWN
static final double DEFAULT_WEIGHT_DOWN
Default weight for steps downwards in path between nodes is 1.0.- See Also:
- Constant Field Values
-
DEFAULT_WEIGHT_UP
static final double DEFAULT_WEIGHT_UP
Default weight for steps upwards in path between nodes is 1.0.- See Also:
- Constant Field Values
-
-
Method Detail
-
getWeightDown
double getWeightDown()
- Returns:
- The weight for a step down.
-
setWeightDown
void setWeightDown(double weight)
Sets the weight for a step down.- Parameters:
weight
- must be between 0 an 1. Other values will be rounded automatically.
-
getWeightUp
double getWeightUp()
- Returns:
- The weight for a step up.
-
setWeightUp
void setWeightUp(double weight)
Sets the weight for a step up.- Parameters:
weight
- must be between 0 an 1. Other values will be rounded automatically.
-
-