Menu

Details

Robin Hillyard

Details and Usage

Fuzzy

The central concept of FuzzyJ is the generic interface Fuzzy<x></x>. The constraint (bound) on the generic type X is that it extends Comparable<x></x>. The interface itself extends Comparable<fuzzy\<x>></fuzzy\<x> so that fuzzy objects themselves are comparable.

There are four method signatures:

  • int compareTo(X x)
  • boolean isExact()
  • X get()
  • Uncertainty<x> uncertainty()</x>

Of these, the isExact() method is really just a convenience method as exactness is determined by having the uncertainty() method return null.

So, a fuzzy object can be based on almost any type (just as long as we can compare such objects). I foresee fuzzy objects being based on patterns (for example regular expressions). For something along these lines, look at the unit tests for FuzzyBase. For more discussion on this subject, please see [Generic types].

But you are probably expecting that most fuzzy objects will be numbers and that makes good sense. Therefore, the interface FuzzyNumber<z></z> is defined to extend Fuzzy<z></z> such that Z additionally extends Number. It would be nice for FuzzyNumber also to extend Number, but since Number is an abstract type (not an interface), that is regrettably impossible. This is perhaps the most annoying thing about Java but we won't get sidetracked here.

However, the numeric aspects of the nominal value (the estimate) of a fuzzy object can generally be found simply by invoking the get() method which, for a FuzzyNumber at least, will be a Number.

Uncertainty

The Uncertainty<x></x> interface is where the actual fuzziness is represented. There are two method signatures:

  • X magnitude()
  • Shape shape()

Magnitude and shape are the two key attributes, giving a measure of the size of the uncertainty and an idea of its shape, that's to say the shape of the probability density function.

UncertaintyBasic

There are further method definitions in UncertaintyBasic<x></x> including three methods which help determine whether two fuzzy objects are effectively equal:

  • Fuzzy<x> combine(X, Fuzzy<x>, FuzzyBasic<x>)</x></x></x>
  • double confidence()
  • double probability(Fuzzy<x> other)</x>

The combine() method combines this uncertainty (fuzziness) with the uncertainty of another fuzzy object. This is typically used when two numbers are being compared -- the resulting fuzziness is the uncertainty around the numbers really being the same.

The method probability(other) yields the probability that the object which has this Uncertainty can be considered the same as other. The confidence() method gives the threshold for deciding with a probability is sufficient to consider two objects equal. [[Probably should relate to the null hypothesis here]]

FuzzyBasic

In parallel with the UncertaintyBasic interface is the FuzzyBasic<x></x> which provides the same sort of administrative functionality for fuzzy objects. There are five signatures:

  • Fuzzy<x> combineUncertainties(Fuzzy<x>)</x></x>
  • Fuzzy<x> make(X, Uncertainty<x>)</x></x>
  • Uncertainty<x> makeUncertainty(X, Shape)</x>
  • X makeX(Object)
  • double probabilityOfEquality(Fuzzy<x>)</x>

combineUncertainties essentially just calls the combine method of this object's uncertainty. Ditto for probabilityOfEquality.

The three "make" methods are necessary to allow for new objects to be made of the appropriate generic type. Such methods must obviously be implemented by each concrete extender of FuzzyBasic. [[The alternative of calling a (static) factory method and then casting the result doesnt always sit well with the compiler.]]

make obviously makes a new fuzzy object; makeUncertainty makes a new uncertainty object; makeX makes a not necessarily new X object (if the parameter object can be cast to X then that will be used).


Related

Wiki: Generic types
Wiki: Home

MongoDB Logo MongoDB