Interface SMTaxonomyPath
- All Superinterfaces:
SimilarityMeasure
,SMTaxonomy
- All Known Implementing Classes:
SMTaxonomyPathImpl
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
Modifier and TypeFieldDescriptionstatic final double
Default weight for steps downwards in path between nodes is 1.0.static final double
Default weight for steps upwards in path between nodes is 1.0.static final String
Name of similarity measure is "TaxonomyPath".Fields inherited from interface de.uni_trier.wi2.procake.similarity.SimilarityMeasure
LOG_ORDER_NAME_NOT_FOUND
-
Method Summary
Modifier and TypeMethodDescriptiondouble
double
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 Details
-
NAME
Name of similarity measure is "TaxonomyPath".- See Also:
-
DEFAULT_WEIGHT_DOWN
static final double DEFAULT_WEIGHT_DOWNDefault weight for steps downwards in path between nodes is 1.0.- See Also:
-
DEFAULT_WEIGHT_UP
static final double DEFAULT_WEIGHT_UPDefault weight for steps upwards in path between nodes is 1.0.- See Also:
-
-
Method Details
-
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.
-