norsys.netica
Class Sensitivity

java.lang.Object
  |
  +--norsys.netica.Sensitivity

public class Sensitivity
extends java.lang.Object

A sensitivity measurer, which determines to what degree a new finding at one node is expected to affect the beliefs of a certain other node.

Since:
2.08
Version:
5.04 - January 21, 2012

Field Summary
static int ENTROPY_SENSV

Measure entropy or mutual information.

static int REAL_SENSV

Measure the effect on the real numeric value (rather than just the state).

static int VARIANCE_OF_REAL_SENSV

Measure variance or mean squared change on the real numeric value (rather than just the state).

static int VARIANCE_SENSV

Measure variance or mean squared change.

 
Constructor Summary
Sensitivity(Node queryNode, NodeList varyingNodes, int whatFind)

Creates a sensitivity measuring object, which measures how much the beliefs at one node (called the "query node" or "target node") will change if a finding is entered at another node (called the "varying node").

 
Method Summary
 void finalize()

Frees all resources this Sensitivity is using.

 double getMutualInfo(Node varyingNode)

Measures the mutual information between two nodes, which is how much a finding at one node (called the "varying node") is expected to alter the beliefs (measured as decrease in its entropy) at another node (called the "query node").

 double getVarianceOfReal(Node varyingNode)

Measures how much a finding at one node (called the "varying node") is expected to reduce the variance of another node (called the "query node").

 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

public static final  int ENTROPY_SENSV 
Measure entropy or mutual information. See Sensitivity.


public static final  int REAL_SENSV 
Measure the effect on the real numeric value (rather than just the state). See Sensitivity.


public static final  int VARIANCE_SENSV 
Measure variance or mean squared change. See Sensitivity.


public static final  int VARIANCE_OF_REAL_SENSV 
Measure variance or mean squared change on the real numeric value (rather than just the state). See Sensitivity.

Constructor Detail
public Sensitivity (
 Node  queryNode
 NodeList  varyingNodes
 int  whatFind 
) throws NeticaException
Creates a sensitivity measuring object, which measures how much the beliefs at one node (called the "query node" or "target node") will change if a finding is entered at another node (called the "varying node"). This is sometimes called "utility-free value of information".

For queryNode, pass the query node, and for varyingNodes, pass a list of all nodes that might later be used as varying nodes.

There are two different measures available: variance reduction and entropy reduction (i.e., mutual information).

For whatFind, pass the bitwise-OR of which measures you want the created object capable of measuring. To measure variance reduction, pass VARIANCE_OF_REAL_SENSV (= REAL_SENSV + VARIANCE_SENSV), and to measure mutual information, pass ENTROPY_SENSV.

After the object is created, to measure variance reduction, pass the new object to getVarianceOfReal along with a particular findings node. To measure mutual information between two nodes, pass it to getMutualInfo.

When you are finished with the sensitivity object, free the resources it uses by calling finalize.

Netica uses an efficient algorithm that takes the current findings into account, and requires only a few belief updatings no matter how many nodes are contained in varyingNodes. When you request the first sensitivity measure of the query node relative to one of the varying nodes (by calling getMutualInfo or getVarianceOfReal), the belief updatings are done and the results cached for subsequent calls involving other varying nodes.

These methods are available as "Network -> Sensitivity to Finding" in Netica Application. For more information on them, contact Norsys for the "Sensitivity" document.

Parameters:
Node    queryNode    query Node for this Sensitivity
NodeList    varyingNodes    finding Nodes for this Sensitivity
int    whatFind    a bitwise OR of some of the constants: ENTROPY_SENSV, REAL_SENSV, or VARIANCE_SENSV.

Version:

Versions 2.03 and later have this method.
In the C Version of the API, this function is named NewSensvToFinding_bn.
See Also:
finalize    (reverse operation) Delete the Sensitivity when finished with it
getVarianceOfReal    Use the Sensitivity to find the variance reduction due to finding
getMutualInfo    Use the Sensitivity to find the mutual info (entropy reduction)

Example:
  Net net = new Net ("ChestClinic.dne");
  Sensitivity svCancer = new Sensitivity (net.getNode ("Cancer"), 
                                          net.getNodes(), 
                                          Sensitivity.ENTROPY_SENSV);
  double mutinfo = svCancer.getMutualInfo (net.getNode ("Dyspnea"));
  double entropy = svCancer.getMutualInfo (net.getNode ("Cancer"));
  svCancer.finalize(); // if memory is short, you may choose to force the early cleanup 
                       // of native Netica resources by explicitly calling the finalize
                       // before the Garbage Collector may get around to doing so.
Method Detail
public void finalize ( ) throws NeticaException
Frees all resources this Sensitivity is using.

If memory is short, you may choose to force the early cleanup of native Netica resources by explicitly calling this method rather than waiting, often in vain, for the Java Garbage Collector to get around to doing this.

If you try to use this Sensitivity after calling this method, you will get an exception, with no harm done.

If you override this method, be sure to call the base class method (super.finalize();).

Version:

Versions 2.03 and later have this method.
In the C Version of the API, this function is named DeleteSensvToFinding_bn.
See Also:
Sensitivity    (reverse operation) Create a new Sensitivity to do sensitivity analysis

Example:
Overrides:
finalize in class java.lang.Object

public double getMutualInfo (
 Node  varyingNode 
) throws NeticaException
Measures the mutual information between two nodes, which is how much a finding at one node (called the "varying node") is expected to alter the beliefs (measured as decrease in its entropy) at another node (called the "query node").

The query node is set by the particular Sensitivity created (see Sensitivity). The varying node is passed as findingNode.

This method returns the mutual information between two nodes (measured in bits). It can be used with any discrete or discretized nodes. Mutual information is the expected reduction in entropy of one node (measured in bits) due to a finding at another.

The maximum possible decrease in entropy of the query node is when entropy goes to zero, i.e., all uncertainty is removed. That happens when a finding is obtained for the query node itself. So to find the entropy of a node, measure the mutual information between a node and itself (that is why "entropy" is sometimes called "self information").

To create a Sensitivity that can measure mutual information, pass ENTROPY_SENSV for whatFind when calling Sensitivity. For its varyingNodes argument, pass a list of all the nodes that might later be passed as findingNode to this method.

Mutual information is symmetric between nodes (i.e., it has the same value when varying and query nodes are reversed). That makes this method useful to measure the degree to which one varying node can effect a number of different query nodes in an efficient way, by just passing the varying node to Sensitivity, and each of the query nodes to this method.

The mutual information between two nodes can depend greatly on what findings are entered elsewhere in the net, and this method will properly take that into account.

The first time this method is called by some Sensitivity after the findings of a net have changed, it takes longer to return, but after that, for each findingNode passed, it returns quickly.

This method is available as "Network -> Sensitivity to Finding" in Netica Application. For more information on it, contact Norsys for the "Sensitivity" document.

Parameters:
Node    varyingNode    The node we pretend to put a finding at.

Version:

Versions 2.03 and later have this method.
In the C Version of the API, this function is named GetMutualInfo_bn.
See Also:
getVarianceOfReal    Use a different measure of sensitivity: variance reduction
Sensitivity    Create the Sensitivity
NetTester.getLogLoss    Get the "logarithmic loss" score, when testing a Bayes net with case data

Example:

public double getVarianceOfReal (
 Node  varyingNode 
) throws NeticaException
Measures how much a finding at one node (called the "varying node") is expected to reduce the variance of another node (called the "query node").

The query node is set by the particular Sensitivity created (see Sensitivity). The varying node is passed as findingNode.

getVarianceOfReal can only be used with query nodes that are discretized continuous nodes, or that have a real numeric value associated with each state. It measures the expected change squared in the expected real value of the query node, due to a finding at the varying node. This turns out to be the same as the expected decrease in variance of the expected real value of the query node, due to a finding at the varying node. The varying nodes do not have to be continuous or have real numeric values attached to their states.

The maximum possible decrease in variance of the query node, is when variance goes to zero, i.e., all uncertainty is removed. That happens when a finding is obtained for the query node itself. So to find the variance of a node, measure the variance reduction between a node and itself.

To create a Sensitivity that can measure variance reduction, pass REAL_SENSV + VARIANCE_SENSV for whatFind when calling Sensitivity. For its varyingNodes argument, pass a list of all the nodes that might later be passed as findingNode to this method.

The variance reduction between two nodes can depend greatly on what findings are entered elsewhere in the net, and this method will properly take that into account.

The first time this method is called by some Sensitivity after the findings of a net have changed, it takes longer to return, but after that, for each findingNode passed, it returns quickly.

This method is available as "Network -> Sensitivity to Finding" in Netica Application. For more information on it, contact Norsys for the "Sensitivity" document.

Parameters:
Node    findingNode    The node we pretend to put a finding at.

Version:

Versions 2.03 and later have this method.
In the C Version of the API, this function is named GetVarianceOfReal_bn.
See Also:
Sensitivity    Create the Sensitivity required to measure variance reduction due to finding
getMutualInfo    Use a different measure of sensitivity: mutual info (entropy reduction)