com.cra.bnet.engine
Class Fuzzifier

java.lang.Object
  |
  +--com.cra.bnet.engine.Fuzzifier

public class Fuzzifier
extends Object

Fuzzifies a value of a continuous variable to soft evidence for a discrete variable. This class uses a set of triangular membership functions to fuzzify the continuous value. Each triangle is centered on one of the values provided to the constructor. The first triangle extends back to negative infinity and the last triangle extends to positive infinity. For example, suppose an instance was created as follows:

 double[] centers = new double[] {0, 10, 15};
 Fuzzifier fuzzifier = new Fuzzifier(centers);
 

This fuzzifier would consist of three triangular membership functions: the first centered at 0 with left side open to negative infinity and right-side ending at 10, the second centered at 10 with left side ending at 0 and right side ending at 15, and the third centered at 15 with left side ending at 10 and right side open to positive infinity. The fuzzifier can then be used to convert a continuous value into soft evidence for a discrete node:

 double[] evidence = fuzzifier.getEvidence(2.0);
 DiscreteNode node = ...;
 node.setEvidence(evidence);
 
The evidence array above represents soft (or fuzzy) evidence for the discrete node, which consists of [0.8 0.2 0]. Note that the discrete node must have the same number of states as the fuzzifier's number of centers. *

For more information and instruction on converting evidence from a continuous variable into soft evidence, please see the BNet.EngineKit Developer's Guide.


Constructor Summary
Fuzzifier(double[] centers)
          Creates a new Fuzzifier using the specified centers.
 
Method Summary
 double[] getCenters()
          Returns the centers that this fuzzifier uses.
 double[] getEvidence(double value)
          Fuzzifies the specified value and creates soft evidence that can be posted to a discrete node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fuzzifier

public Fuzzifier(double[] centers)
Creates a new Fuzzifier using the specified centers.

Parameters:
centers - centers used to define triangular membership functions.
Throws:
NullPointerException - if centers is null.
IllegalArgumentException - if centers array has less than two elements.
Method Detail

getCenters

public double[] getCenters()
Returns the centers that this fuzzifier uses.

Returns:
the centers that this fuzzifier uses.

getEvidence

public double[] getEvidence(double value)
Fuzzifies the specified value and creates soft evidence that can be posted to a discrete node. Clients can provide the returned array to the DiscreteNode.setEvidence method.

Parameters:
value - continuous value.
Returns:
soft evidence that can be posted to a discrete node.