|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nrc.fuzzy.SimilarityOperator | +--nrc.fuzzy.SimilarityByPossibilityOperator
A class that provides an operator to calculate the similarity between 2 fuzzy values. Given two fuzzy values, f1 and f2, similarity is defined as:
similarity = if necessity(f1,f2) > 0.5 then possibility(f1,f2) else (necessity(f1,f2) + 0.5) * possibility(f1,f2) where necessity(f1,f2) = 1 - possibility(not f1,f2) and possibility(f1,f2) = max(min(u (x),u (x)) x f1 f2
The default similarity operator is the SimilarityByPossibilityOperator. This can be changed using the static setDefaultSimilarityOperator method of the FuzzyValue class.
SimilarityOperator
,
SimilarityOperatorInterface
,
SimilarityByAreaOperator
,
Serialized FormConstructor Summary | |
SimilarityByPossibilityOperator()
|
Method Summary | |
double |
similarity(nrc.fuzzy.FuzzyValue fv1,
nrc.fuzzy.FuzzyValue fv2)
SIMILARITY: a method to calculate the similarity measure of two fuzzy sets Given two fuzzy values, f1 and f2, similarity is defined as: |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimilarityByPossibilityOperator()
Method Detail |
public double similarity(nrc.fuzzy.FuzzyValue fv1, nrc.fuzzy.FuzzyValue fv2) throws IncompatibleFuzzyValuesException
similarity = if necessity(f1,f2) > 0.5 then possibility(f1,f2) else (necessity(f1,f2) + 0.5) * possibility(f1,f2) where necessity(f1,f2) = 1 - possibility(not f1,f2) and possibility(f1,f2) = max(min(u (x),u (x)) x f1 f2
This version of a similarity function is useful in some cases but breaks down when there is some overlap but large parts not overlapping. For example if we have the fuzzy values with LeftLinearFuzzySet(0.499999, 0.500001) and RightLinearFuzzySet(0.499999, 0.500001) we'd expect a similarity to be close to 0.0 but it is 0.25 in this case. So if we are using triangular or trapezoid fuzzy sets this measure may be OK. This is a measure that was used in the FuzzyCLIPS system and a better approach might be to use the more useful measure, similarityByArea.
Note: we must check that the 2 fuzzy values have the same Fuzzy variable
Note: If the fuzzy values are the same (equals) then returns a 1.0
similarity
in interface SimilarityOperatorInterface
fv1
- fv2
-
IncompatibleFuzzyValuesException
- if the fuzzy values do not have
identical fuzzy variables the operation cannot be done
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |