| NORSYS SOFTWARE © 2012 | NETICA API | JAVA VERSION 5.04

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## norsys.netica
Class Net

    java.lang.Object
      |
      +--norsys.netica.General
            |
            +--norsys.netica.Net

All Implemented Interfaces:
  NeticaListener

public class Net
extends General

A Bayesian belief network or decision network.

Since:
  All versions
Version:
  5.04 - October 1, 2012

Field Summary
`static int` | `BELIEF_UPDATE` A form of autoUpdate.
`static int` | `DEFAULT_SAMPLING` A sampling method used by generateRandomCase.
`static long` | `FIRST_CASE` Pass this to read the first case.
`static int` | `FORWARD_SAMPLING` A sampling method used by generateRandomCase.
`static int` | `JOIN_TREE_SAMPLING` A sampling method used by generateRandomCase.
`static long` | `NEXT_CASE` Pass this to read the case following the last case read.
`static long` | `NO_MORE_CASES` Returned by Netica when trying to read past the last case.

Fields inherited from class norsys.netica.General
`NAME_MAX`

Constructor Summary
`Net()` Creates and returns a new net, initially having no nodes, and places it in the current default Environ (see getDefaultEnviron).
`Net(Environ env)` Creates and returns a new net, initially having no nodes.
`Net(Net net, java.lang.String newName, Environ newEnv, java.lang.String options)` Net copy-constructor.
`Net(Streamer inStream)` Reads a net from inStream, and returns the new net read, or throws a Netica Exception, if reading was impossible.

Method Summary
`void` | `absorb(NodeList nodeList)` Deprecated. renamed to use `absorbNodes` for clarity.
`void` | `absorbNodes(NodeList nodeList)` Absorbs the passed nodes, so that they are removed from the net, but the net's overall joint probability distribution for the remaining nodes is unchanged.
`void` | `compile()` Compiles this net for fast belief updating (i.e., junction tree propagation).
`java.lang.String` | `controlCaching(java.lang.String command, java.lang.String value, NodeList nodeList)` Contact Norsys for information on this function.
`NodeList` | `copyNodes(NodeList nodeList)` Duplicates the nodes in nodeList, and puts the duplicates in this net.
`java.lang.String` | `createCustomReport(NodeList nodeList, java.lang.String template, java.lang.String options)` Creates a text (possibly HTML, RTF, TXT, etc.) report on this net, which is completely customizable using a text template, and can include a wide variety of information on the net, its nodes, links, probability tables, current findings, beliefs, decisions, sensitivity, junction tree, etc.
`void` | `delete()` Deprecated. use `finalize` instead.
`NodeList` | `duplicateNodes(NodeList nodeList)` Deprecated. use `copyNodes` instead.
`Net` | `expandTimeSeries(int dimension, double resultTime, double burnTime, java.lang.String options)` Expands this dynamic Bayes net (DBN) to create one with time slices in the same way Netica Application does.
`void` | `finalize()` Removes this net from the system, and releases all resources it uses (e.g., frees memory), including all its substructures (e.g., nodes).
`int` | `generateRandomCase(NodeList nodeList, int method, double timeout, RandomGenerator randGen)` Generate a random case by simulation.
`static java.util.Vector` | `getAllNets(Environ env)` Retrieves from the given env a collection of all the Nets defined in that Environ.
`java.lang.String` | `getAllNodesets(boolean includeSystem)` Returns a string which is a list of all node-sets defined for this net, separated by commas, in priority order, with highest priority first.
`int` | `getAutoUpdate()` Returns this net's current auto-updating value.
`static java.lang.String` | `getConstructorClass()` Retrieves the classname of the class that Netica-J uses when automatically constructing new Nets.
`NodeList` | `getElimOrder()` Returns a list of the nodes of this net in their "elimination order" (which is used for triangulation in the compilation of this net), or null if there is no order currently associated with this net.
`java.lang.String` | `getFileName()` Returns the name of the file (including full path) that this net was last written to or read from.
`double` | `getFindingsProbability()` Returns the joint probability of the findings entered into net so far (including any negative or likelihood findings).
`double` | `getJointProbability(NodeList nodeList, int[] nodeStates)` Returns the joint probability that each node in nodeList is in the corresponding state of nodeStates, given the findings currently entered in the Bayes net.
`int[]` | `getMostProbableConfig(NodeList nodeList)` Finds the most probable configuration, also known as the most probable explanation (MPE), for all the nodes in the net.
`Node` | `getNode(java.lang.String nodeName)` Returns the node of this net which has a name exactly matching name (case sensitive comparison).
`Node` | `getNodeAtTime(java.lang.String nodeName, double[] time)`
`NodeList` | `getNodes()` Returns a list of all the nodes in this net.
`NodeList` | `getNodes(java.lang.String options)` Returns a list of all the nodes in this net.
`java.awt.Color` | `getNodesetColor(java.lang.String nodeset)` Retrieves the color of nodeset in this net.
`void` | `getRelatedNodes(NodeList relatedNodes, java.lang.String relation, NodeList nodeList)` Finds all the Nodes that bear the relationship relation with any member of nodeList and puts them in relatedNodes.
`void` | `readCase(long[] casePosn, Streamer file, NodeList nodeList, long[] idNum, double[] freq)` Deprecated. use `readFindings` instead.
`void` | `readFindings(long[] casePosn, Streamer file, boolean add, NodeList nodeList, long[] idNum, double[] freq)` Reads a set of findings (i.e., a case) from a file containing one or more cases.
`void` | `readFindings(long[] casePosn, Streamer file, NodeList nodeList, long[] idNum, double[] freq)` Deprecated.
`int` | `redoOperation(double toWhen)` Call this to redo an operation that was undone by undoLastOperation.
`void` | `reorderNodesets(java.lang.String nodesetOrder)` This rearranges the priority order of the node-sets of this net.
`java.lang.String` | `reportJunctionTree()` Deprecated. use @link #createCustomReport() instead.
`void` | `retractFindings()` Retracts all findings (i.e., the current case) from all the nodes in this net, except "constant" nodes (use Node.finding().clear() for that).
`void` | `reviseCPTsByCaseFile(Streamer file, NodeList nodeList, double degree)` Revises the CPTs of these nodes, to account for the cases in the given file.
`void` | `reviseCPTsByFindings(NodeList nodeList, double degree)` Revises the CPTs of these nodes, to account for the currently entered case.
`void` | `setAutoUpdate(int autoupdate)` Turns auto-updating on or off.
`static void` | `setConstructorClass(java.lang.String netClassNm)` Deprecated. use `env.setNetClass(class)` instead.
`void` | `setElimOrder(NodeList elimOrder)` Sets an "Elimination order" of all the nodes in this net, used to guide compiling to find an efficient junction tree.
`void` | `setNodesetColor(java.lang.String nodeset, java.awt.Color color)` This sets the color of nodeset to color.
`void` | `setNumUndosKept(int countLimit, double memoryLimit, java.lang.String options)`
`void` | `setRandomGenerator(RandomGenerator randomGenerator, boolean isPrivate)` Associates a random generator randomGenerator with this net, so that all operations on this net that require randomness will use randomGenerator (unless overridden by another generator, as described in documentation for the particular function being used).
`double` | `sizeCompiled()` Returns the total size of the internal structure created by compiling a net (i.e., the junction tree, including sepsets), considering the findings currently entered.
`void` | `uncompile()` Releases the resources (e.g., memory) used by a compiled net.
`int` | `undoLastOperation(double toWhen)` Undoes the last operation done to this net (or any node in it), leaving the net in the same state as it was before the operation was done.
`void` | `write(Streamer outStream)` Writes this net to a stream specified by outStream.
`long` | `writeCase(NodeList nodeList, Streamer file, long idNum, double freq)` Deprecated. use `writeFindings` instead. Note that the order of the parameters has changed to be consistent with that for `readFindings`.
`long` | `writeFindings(Streamer file, NodeList nodeList, long idNum, double freq)` Saves in file the set of findings currently entered in nodeList, so that later they can be read back with readFindings.

Methods inherited from class norsys.netica.General
`addListener, eventOccurred, getComment, getEnviron, getLabel, getLabel, getName, getTitle, removeListener, setComment, setName, setTitle, toString, user`

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

Field Detail

public static final int BELIEF_UPDATE

  A form of autoUpdate. See setAutoUpdate.

public static final long FIRST_CASE

  Pass this to read the first case. See readFindings.

public static final long NEXT_CASE

  Pass this to read the case following the last case read. See readFindings.

public static final long NO_MORE_CASES

  Returned by Netica when trying to read past the last case. See readFindings.

public static final int DEFAULT_SAMPLING

  A sampling method used by generateRandomCase.

public static final int JOIN_TREE_SAMPLING

  A sampling method used by generateRandomCase.

public static final int FORWARD_SAMPLING

  A sampling method used by generateRandomCase.

Constructor Detail

public Net ( |
Environ | env
| ) throws NeticaException

  Creates and returns a new net, initially having no nodes. If just nature nodes are added to this net, it will be a Bayes net, while if any decision nodes are also added, it will be a decision net.

  A default name of "Unnamed_#" will be assigned to the net, where '#' is an integer beginning from 1. It is suggested you later change the name using `setName`.
  Parameters:

  Environ |  | env |  | The Environ in which this new net will be placed.

  Version:
  In the C Version of the API, this function is named NewNet_bn.
  See Also:

  finalize |  | (reverse operation) Frees the memory used by a net
  Net() |  | Creates the net in the default Environ
  Net(Streamer) |  | Create a net, by reading it from a stream
  getAllNets |  | Retrieve all nets created so far
  `setName` |  | Set the name
  Node |  | Add nodes to the new net
  setAutoUpdate |  | Good to set this immediately after creating net, since the default value varies between Netica versions

public Net ( ) throws NeticaException

  Creates and returns a new net, initially having no nodes, and places it in the current default Environ (see getDefaultEnviron). A convenience constructor, otherwise identical to Net(Environ). See that constructor for further documentation.
  See Also:

  Net(Environ) |  | Same, but for any environment

public Net ( |
Streamer | inStream
| ) throws NeticaException

  Reads a net from inStream, and returns the new net read, or throws a Netica Exception, if reading was impossible. Even if this constructor succeeds, you should check if it generated any warnings (with getWarnings), since it may report on a problem but return the best net it can. For an example of retrieving warnings that may be generated when the net is read, see `NeticaError.getWarnings`.

  If there were findings entered when the net was written to file, they will be present after reading, so you may want to do a retractFindings right after reading the net.

  The Net will be created in the same Environ as inStream is in.
  Parameters:

  Streamer |  | inStream |  | The stream to read from

  Version:
  This method is available in all versions. Versions previous to 2.27 could not read files in .neta format.
  In the C Version of the API, this function is named ReadNet_bn.
  See Also:

  write |  | Saves a net to file in a format understood by this constructor
  getFileName |  | Later retrieve the name of the file that net was read from

  Example:

      See write

public Net ( |
Net | net,
String | newName,
Environ | newEnv,
String | options
| ) throws NeticaException

  Net copy-constructor.

  Duplicates net, giving the new net the name newName and placing it in the environment newEnv. Returns the new net.

  The name of the new net will be newName. It must be a legal IDname, which means it must have NAME_MAX (30) or fewer characters, all of which are letters, digits or underscores, and it must start with a letter.

  options allows you to control what gets copied. It can be any combination of the following strings, separated by commas: "no_nodes", "no_links", "no_tables", and "no_visual". Including "no_nodes" means that only background informatin (such as nodeset names/coloring, visual formatting, etc.) will be copied. Including "no_links" means that each node's links (and therefore tables) won't get duplicated. Including "no_tables" means that each node's tables (CPTs, functional, experience) won't get duplicated. Including "no_visual" means that visual information (such as node position, style) for the nodes or nets won't get duplicated.

  The user fields of net and its nodes will be copied to the new net (see `User.setBytes`, `User.setNumber`, etc.), but the user data of the new net and new nodes in that net will be set to null (see `User.setReference`).

  When you are done with the new net, you should pass it to finalize.

  If you just wish to duplicate one or more nodes, see copyNodes. For other, more fine-grained control over the copying process, you may want to write your own duplicating function, in which case the NetEx.duplicate method may be a useful model.
  Parameters:

  Net |  | net |  |
  String |  | newName |  |
  Environ |  | newEnv |  |
  String |  | options |  |

  Version:
  In version 3.05 and later.NetEx has a similar method called duplicate.
  In the C Version of the API, this function is named CopyNet_bn.
  See Also:

  copyNodes |  | Just duplicate some of the nodes in the net.

  Example:

        // This will duplicate net1's structure, but will not copy its CPT, functional,
        // or experience tables.

        Net net2 = new Net ( net1, "net2", env, "no_tables" );

Method Detail

public void absorbNodes ( |
NodeList | nodeList
| ) throws NeticaException

  Absorbs the passed nodes, so that they are removed from the net, but the net's overall joint probability distribution for the remaining nodes is unchanged.

  Absorbs all of nodeList from their net. This removes and deletes (frees) the nodes while maintaining the global relationship (i.e., joint distribution) of the remaining nodes. In the probabilistic literature this is often referred to as "summing out" variables (or "maxing out" when they are decision nodes).

  In order to maintain the joint distribution, Netica may have to add links. Absorbing a nature node which has no finding will only add links from the parents of the removed node and its children's parents, to the removed node's children. However, if it has a finding, many links between the ancestors of the removed node may be added (possibly resulting in very large CPT tables leading to slow behavior or an out-of-memory condition). Absorbing nodes with likelihood findings or negative findings is the worst. When a decision node is absorbed, links will be added from its parents to its children. No links are added when a utility node is absorbed. Added links never created a directed cycle, when there wasn't one to begin with.

  The order of the nodes in nodeList doesn't matter. The order in which the absorptions are done will be chosen to minimize intermediate calculations (and if decision nodes are involved, it will be similar to that described in Shachter86).

  If it is not possible to absorb all of nodeList, as many as possible will be absorbed, and then an exception will be thrown explaining why the next node couldn't be absorbed. Reasons it may not be possible to continue are: nodes are missing CPTs, presence of disconnected links, more than one link from a node to another, presence of directed cycles, unacceptable structure between decision and utility nodes, or multiple utility nodes.

  WARNING: This method will leave nodeList empty.
  Parameters:

  NodeList |  | nodeList |  | The list of nodes to be absorbed.

  Version:
  This method is available in all versions.
  In the C Version of the API, this function is named AbsorbNodes_bn.
  See Also:

  `Node.delete` |  | Removes a node without maintaining joint distribution
  setMemoryUsageLimit |  | In case this method is consuming too much memory
  `NodeList.NodeList` |  | Make the required list of nodes

  Example:

        /**
         *  Handy method to absorb a single node.
         *  @param node the node to be removed from its net
         */
        public static void absorbNode (Node node) throws NeticaException {
            Net net = node.getNet();
            NodeList nodes = new NodeList (net);
            nodes.add (node);
            net.absorbNodes (nodes);
        }

public void absorb ( |
NodeList | nodeList
| ) throws NeticaException

  Deprecated. renamed to use `absorbNodes` for clarity.

public void compile ( ) throws NeticaException

  Compiles this net for fast belief updating (i.e., junction tree propagation).

  If the net is an auto-update net (see setAutoUpdate) then belief updating will be done immediately afterwards, but if it isn't, then updating won't be done until you request a belief (e.g., with getBeliefs).

  When the net is compiled, first an "elimination ordering" is determined, which is a list giving all the nodes of the net in some order, and using that list a "junction tree" of cliques is formed. The efficiency of the junction tree may depend greatly on the elimination ordering used, so it is important to find a good elimination ordering. You can determine the elimination ordering used by calling getElimOrder, and you can control it by calling setElimOrder before calling compile.

  Calling compile after the net is already compiled has no effect, unless the net or its elimination ordering has been changed, in which case the net will be recompiled.
  Version:

  This method is available in all versions.
  In the C Version of the API, this function is named CompileNet_bn.
  See Also:

  uncompile |  | (reverse operation) Releases memory used by a compiled net
  getBeliefs |  | Use the compiled net to find new beliefs given findings
  sizeCompiled |  | Size and speed of the junction tree formed during compiling
  setElimOrder |  | Set the elimination ordering to use when compiling the net
  getElimOrder |  | Obtain the elimination ordering used to compile the net
  reportJunctionTree |  | Print out the junction tree formed during compiling
  setAutoUpdate |  | Have compiled net automatically find new beliefs when findings entered
  setMemoryUsageLimit |  | In case this method is consuming too much memory

public String controlCaching ( |
String | command,
String | value,
NodeList | nodeList
| ) throws NeticaException

  Contact Norsys for information on this function.
  Parameters:

  String |  | command |  | The caching control parameter whose value is to be set.
  String |  | value |  | The value of the supplied command.
  NodeList |  | nodeList |  |

  Version:
  Versions 5.02 and greater have this method.
  In the C Version of the API, this function is named ControlNetCaching_bn.

public NodeList copyNodes ( |
NodeList | nodeList
| ) throws NeticaException

  Duplicates the nodes in nodeList, and puts the duplicates in this net. The nodes in nodeList may be from this net, or another net, but they must all be from the same net.

  A new list of the duplicated nodes will be returned. The order of the new list will correspond with the order of the old list. The old list, and the nodes it refers to, will not be modified.

  options allows you to control what gets copied. It can be any combination of the following strings, separated by commas: "no_links", "no_tables". Including "no_links" means that each node's links (and therefore tables) won't get duplicated. Including "no_tables" means that each node's tables (CPTs, functional, experience) won't get duplicated.

  All connectivity strictly between the duplicated nodes will be maintained during the duplication. Parents of duplicated nodes that aren't also being duplicated will result in disconnected links, if the nodes are being duplicated into a different net.

  The user fields (`User.setBytes`, `User.setNumber`, etc.) of each node in nodeList will be copied to the corresponding newly created nodes, but the user data (`User.setReference`) will not.

  If a duplicated node has the same name as a node already in this net, then the name of the duplicated node will be modified by adding a numeric suffix to its name (or changing its numeric suffix if it already has one).

  If you wish to duplicate a single node, see the "NodeEx.duplicate" example below. If you wish to duplicate a whole net, see the Net copy-constructor.
  Parameters:

  NodeList |  | nodeList |  | A list of nodes to duplicate.

  Version:
  In version 3.05 and later. Versions 2.20 to 3.04 had an identical method called duplicateNodes.
  In the C Version of the API, this function is named CopyNodes_bn.
  See Also:

  NodeList(NodeList) |  | Just duplicates the list, but not the nodes
  Node |  | Creates a new node in a net
  `Node.delete` |  | Removes a node from its net and frees it
  `Net.Net` |  | Duplicates the entire net

  Example #1:

      The following method is available in NodeListEx.java:
        /**
         *  This transfers nodes from the net they are in to newNet,
         *  and returns a new list of the new nodes in the same order as they
         *  appeared in nodes.
         *
         *  In the process, each node in nodes is deleted, and a new one created,
         *  so don't try and use any of the old nodes ( if you do, a NeticaException
         *  will be thrown.)
         *  @param nodes  the nodes to be deleted
         *  @param newNet  the net to receive copies of the nodes to be deleted
         */
        public static NodeList transferNodes (NodeList nodes, Net newNet) throws NeticaException {
            NodeList newNodes = newNet.copyNodes (nodes);
            while (nodes.size() > 0){
                Node node = (Node) nodes.remove(0);
                node.delete();
            }
            return newNodes;
        }

  Example #2:

        The following method is available in NodeEx.java:
        /**
         *  Make a copy of ourself and place it in newNet.
         *  @param newNet  the net where the newly constructed node will be placed.
         */
        public Node duplicate (Net newNet) throws NeticaException {
            NodeList nodes = new NodeList (getNet());
            nodes.add (this);
            NodeList newNodes = Net.copyNodes (nodes, newNet);
            return (Node) newNodes.get(0);
        }

        The following will duplicate a node within the same net.  It is available in NodeEx.java:
        /**
         *  Make a copy of the current node in its own net.
         */
        public Node duplicate() throws NeticaException {
            return  duplicate ((Net)this.getNet());
        }

public String createCustomReport ( |
NodeList | nodeList,
String | template,
String | options
| ) throws NeticaException

  Creates a text (possibly HTML, RTF, TXT, etc.) report on this net, which is completely customizable using a text template, and can include a wide variety of information on the net, its nodes, links, probability tables, current findings, beliefs, decisions, sensitivity, junction tree, etc.

  Pass a list of "selected" nodes as argument selectedNodes.

  template is a text template for the report to be generated. For information on how to form template, see the documentation for the Netica-Web product, chapter "Generating User Reports".

  Pass null for options, it is for future expansion.
  Parameters:

  NodeList |  | selectedNodes |  |
  String |  | template |  | The report template to be transformed by net information.
  String |  | options |  |

  Version:
  Versions 5.02 and greater have this method.
  In the C Version of the API, this function is named CreateCustomReport_bn.

public Net expandTimeSeries ( |
int | dimension,
double | resultTime,
double | burnTime,
String | options
| ) throws NeticaException

  Expands this dynamic Bayes net (DBN) to create one with time slices in the same way Netica Application does.

  dimn must be 0 with this version of Netica.

  resultTime gives the amount of "time" the expansion is over. If all the delay links have a delay of 1, then it will be the number of time-slices produced.

  burnTime is like resultTime but it is the amount of time that would appear before the first node of the expanded net that Netica uses to calculate the probability distribution of the initial nodes. Making it larger means Netica finds an initial distribution closer to the steady-state one, but requires more computation time.

  Pass null for options; it is only for future expansion.
  Parameters:

  int |  | dimn |  | Must be 0 with this version of Netica.
  double |  | resultTime |  | The time the expansion is over.
  double |  | burnTime |  | The tamount of time that would appear before the first node of the expanded net.
  String |  | options |  | Controls the expansion. Leave null for now.

  Version:
  Versions 5.02 and greater have this method.
  In the C Version of the API, this function is named ExpandNet_bn.
  See Also:

  setInputDelay |  | Set the link delays before expansion
  compile |  | To compile after expanding

public void finalize ( ) throws NeticaException

  Removes this net from the system, and releases all resources it uses (e.g., frees memory), including all its substructures (e.g., nodes).

  Called by the garbage collector, when this net can no longer be referenced. However, you may wish to call it directly to ensure or hasten the freeing of native resources.
  Version:

  In the C Version of the API, this function is named DeleteNet_bn.
  See Also:

  Net |  | Creates a new net
  `Node.delete` |  | Removes a node from a net, and releases the memory it uses

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

public int generateRandomCase ( |
NodeList | nodeList,
int | method,
double | timeout,
RandomGenerator | randGen
| ) throws NeticaException

  Generate a random case by simulation.

  Generates a random case for nodeList (i.e., positive findings for each of them), by sampling from a probability distribution matching that of the net containing nodeList, and conditioned on all findings already entered in the net. If nodeList is null, then all the nodes in the net will be included in the random case. That is, supplying null for nodeList has the same result as supplying net.getNodes(). Returns 0 or greater if it was successful, otherwise negative.

  If method is JOIN_TREE_SAMPLING, then the net must be compiled, and the junction tree is used to do very fast sampling with no rejections (i.e., findings don't slow it down).

  If method is FORWARD_SAMPLING, then forward sampling is used. This evaluates equations directly if they are available, rather than just using CPT entries (which may just approximate the equation). However, it uses a rejection method, so it may be very slow if the findings currently entered are improbable.

  If method is DEFAULT_SAMPLING (the recommended value), then the default method is used. Currently this is method FORWARD_SAMPLING if rejections won't be a problem or the net is uncompiled, otherwise method JOIN_TREE_SAMPLING.

  timeout indicates how much time to allocate for the task (in relative units). If it cannot finish in time, it will return a negative quantity (no Netica exception will be thrown). If method is JOIN_TREE_SAMPLING, or no findings are entered, then it always returns successfully, and within a fixed amount of time, so then timeout is ignored.

  For randomGenerator you can pass an object created by RandomGenerator to control the pseudo-random number sequence. It has the same effect effect as associating randomGenerator to the net with setRandomGenerator; see that method for more info.

  Uses the RandomGenerator randomGenerator passed to it to generate the case. If null is passed, it uses the RandomGenerator associated with the net by `Net.setRandomGenerator`. If there is no RandomGenerator associated with the net, it uses Netica's internal global RandomGenerator (which is slightly slower due to the required mutex protection).

  WARNING:: Be sure to remove unwanted findings first (e.g., with retractFindings), otherwise it will take them into account. For example, if you call this function multiple times without retracting between, the node findings will not change.
  Parameters:

  NodeList |  | nodeList |  | The nodes to include for the random case. You may supply null to specify that all nodes in the net be included in the random case.
  int |  | method |  | The method to use in generating the case; one of DEFAULT_SAMPLING, JOIN_TREE_SAMPLING, or FORWARD_SAMPLING.
  double |  | timeout |  | The time to allocate to the generation task, in relative units.
  RandomGenerator |  | randomGenerator |  | A random number generator.

  Version:
  In versions previous to 1.07, this method always used forward sampling.
  In the C Version of the API, this function is named GenerateRandomCase_bn.
  See Also:

  getFinding |  | Retrieve the random value generated
  GetNodeValueEntered |  | Retrieve the random value generated for a continuous node
  `NodeList.NodeList` |  | Create the node list
  retractFindings |  | Probably want to call this first
  RandomGenerator |  | To control the sequence of cases produced

  Example:

      See RandomGenerator

public static Vector getAllNets ( |
Environ | env
| ) throws NeticaException

  Retrieves from the given env a collection of all the Nets defined in that Environ.
  Parameters:

  Environ |  | env |  | the Environ whose nets we seek

  Version:
  Versions 2.12 and later have this method.
  Example:

      The following method is available in NetEx.java:
        /**
         *  Find a net in the given Environ by it's name. Comparison must be an exact match and
         *  is case sensitive.  Returns the first net that matches, or null, if there was no match.
         *  @param  name The name of the net sought.
         *  @param  env  The Environ to search within.
         *  @returns The net with that name, or null, if not found.
         */
        public static Net getNetNamed (String name, Environ env) throws NeticaException {
            Vector nets = Net.getAllNets (env);
            Enumeration enum = nets.elements();
            while (enum.hasMoreElements()) {
                Net net = (Net) enum.nextElement();
                if (net.getName().equals (name)) {
                    return net;
                }
            }
            return null;
        }

public String getAllNodesets ( |
boolean | includeSystem
| ) throws NeticaException

  Returns a string which is a list of all node-sets defined for this net, separated by commas, in priority order, with highest priority first.

  If includeSystem is true, then the returned list will also contain nodesets internally defined by Netica, otherwise it will just contain user-defined ones. Each internally defined node-set will have a colon (":") preceeding its name.
  Parameters:

  boolean |  | includeSystem |  | whether or not to include the nodesets internally defined by Netica

  Version:
  Versions 3.22 and later have this method.
  In the C Version of the API, this function is named GetAllNodesets_bn.
  See Also:

  `Node.addToNodeset` |  | Creates the user-defined node-sets that appear in the list
  `Node.isInNodeset` |  | Determines if a node is in a node-set
  getNodesetColor |  | How the node-set is displayed in Netica Application
  reorderNodesets |  | To change the priority order of a net's node-sets

public int getAutoUpdate ( ) throws NeticaException

  Returns this net's current auto-updating value.

  Returns BELIEF_UPDATE, or greater, if belief updating will be done automatically whenever some finding (positive, likelihood or value) is entered for a node in this net, otherwise it returns 0. The returned value can later be passed to setAutoUpdate to restore the current condition.
  Version:

  This method is available in all versions.
  In versions previous to 2.11, the documentation for this method only specified that a value greater than 0 was returned if auto belief updating was turned on (and in fact 1 was returned).
  In the C Version of the API, this function is named GetNetAutoUpdate_bn.
  See Also:

  setAutoUpdate |  | Sets value

  Example:

      See enterFindingNot for an example of saving and restoring auto-update.

public static String getConstructorClass ( )

  Retrieves the classname of the class that Netica-J uses when automatically constructing new Nets. See setConstructorClass for more information.
  Version:
  This method is available in all versions.
  See Also:

  setConstructorClass |  | Set the className to be used for this purpose

public NodeList getElimOrder ( ) throws NeticaException

  Returns a list of the nodes of this net in their "elimination order" (which is used for triangulation in the compilation of this net), or null if there is no order currently associated with this net.

  Compiling a net, or using setElimOrder, can add an elimination ordering to a net, while changing the net structure, or using setElimOrder, can remove an ordering from the net.

  Only appropriate nodes will be included in the list returned (for example, nodes of kind CONSTANT_NODE won't be).
  Version:

  This method is available in all versions.
  In the C Version of the API, this function is named GetNetElimOrder_bn.
  See Also:

  setElimOrder |  | Sets it
  sizeCompiled |  | See how good the ordering is
  reportJunctionTree |  | Analyze the effect of the order

public String getFileName ( ) throws NeticaException

  Returns the name of the file (including full path) that this net was last written to or read from.

  If this net was not read from a file, and has not yet been written to a file, null is returned.
  Version:

  Versions 2.09 and later have this method.
  In the C Version of the API, this function is named GetNetFileName_bn.
  See Also:

  `getName` |  | The actual internal name of the net
  `getTitle` |  | A descriptive title for the net
  Net(Streamer) |  | Initializes net's filename with the name of the file read, if the input stream was a file
  write |  | Sets or changes net's filename
  `Streamer.getFileName` |  |

public double getFindingsProbability ( ) throws NeticaException

  Returns the joint probability of the findings entered into net so far (including any negative or likelihood findings).

  If the computations for belief updating haven't been done since the last findings were entered, or the last net modifications made, they will be done before this method returns, which can be quite time consuming.

  WARNING: The number will not be valid if likelihood findings were entered.
  Version:

  This method is available in all versions.
  In the C Version of the API, this function is named FindingsProbability_bn.
  See Also:

  getJointProbability |  | Explore probability of case without entering findings
  isBeliefUpdated |  | Indicates if getFindingsProbability will trigger belief updating
  getBeliefs |  | Finds the marginal probability for each of the nodes

public double getJointProbability ( |
NodeList | nodeList,
int[ ] | nodeStates
| ) throws NeticaException

  Returns the joint probability that each node in nodeList is in the corresponding state of nodeStates, given the findings currently entered in the Bayes net. The nodeStates array must provide a state for each node of nodeList. If nodeList is null, then the joint probability will be for all the nodes in the net; that is, null has the same result as supplying net.getNodes().

  This method is designed to work fast when retrieving many joint probabilities from nodes that were put in the same clique (see below) during net compilation. The first time it is called it will take longer to return, but on subsequent calls it will return very fast if these conditions are met:

  1. nodeList is the same list for each call.
  2. No calls to it with a different nodeList list were made in between.
  3. No new findings have been entered or retracted.
  4. No change was made to the net requiring re-compilation.
  5. Each node of nodeList was placed in the same clique during compiling.

  If conditions 1 or 2 are violated, it will still be much faster than doing a new belief updating, but not as fast as if they aren't violated. If the other conditions are violated, then it will take the same time as 1 or 2 belief updatings.

  All of nodeList must come from the same Bayes net.

  None of nodeList should have a likelihood finding (but they may have other types of findings, and other nodes in the net may have likelihood findings).

  You can be sure a set of nodes will be placed in the same clique if there is some "family" in the Bayes net which contains all of them.

  A family consists of a node and its parents. The method formCliqueWith (in the example below and in NetEx.java) can be used to ensure that all of nodeList will be put in the same clique during the next compile.
  Parameters:

  NodeList |  | nodeList |  | collection of nodes for which the joint probability is sought. You may supply null if you want the joint probability for all the nodes in the net.
  int[] |  | nodeStates |  | states of the nodes in nodeList, one state per node.

  Version:
  Versions 1.18 and later have this method.
  In the C Version of the API, this function is named JointProbability_bn.
  See Also:

  getFindingsProbability |  | Joint probability for current findings
  getBeliefs |  | Posterior probability for a single node
  getCPTable |  | Gets CPT entries of a node

  Example:

      The following function is available in NeticaEx.c:
        // Ensures that at the next compile all of nodes will be put in the same clique.
        // It is useful for the getJointProbability method.
        // It works by adding a dummy node with 1 state, and returning that node (or null if it
        //    wasn't necessary to add one).
        // Its effects can be completely undone by calling delete on the node it returns.
        //
        static Node formCliqueWith (NodeList nodes){
            Net net;
            Node newNode;
            int numNodes = nodes.size();
            if (numNodes <= 1)  return NULL;
            net = nodes.getNet();
            newNode = new Node (null, 1, net);
            for (int i = 0;  i < numNodes;  ++i){
                Node node = (Node) nodes.get (i);
                newNode.addLink (node);
            }
            return newNode;
        }

public int[ ] getMostProbableConfig ( |
NodeList | nodeList
| ) throws NeticaException

  Finds the most probable configuration, also known as the most probable explanation (MPE), for all the nodes in the net. This is the setting for each of the nodes with the highest overall joint probability, given the currently entered findings. Of course it is consistent with the findings.

  For nodeList, pass either null or, equivalently, pass a list returned by net.getNodes. The current algorithm can only compute the most probable explanation for all the nodes of the network.

  The returned array will contain the configuration of highest joint probability given the currently entered findings. Each element of the returned array is the state for the corresponding node of nodeList (i.e., they are in the same order, and have the same length).

  The net must be compiled before calling this method.

  After finding the most probable configuration, you can use getJointProbability to find its probability (see example below).

  You can mix calls to this method with calls to getBeliefs (which finds posterior probabilities).

  This method does not work when likelihood findings are entered. In that case you must make child nodes corresponding to the observations, whose CPTs are the likelihoods, and enter a positive finding for them.

  If you must have the MPE of a smaller set of nodes than all the nodes in the net, you can use absorbNodes to remove the other nodes first.

  Keep in mind that in the MPE, some nodes may be assigned states that are quite unlikely (i.e., the state won't be the one with the highest probability as returned by getBeliefs). That may be necessary in order to achieve the highest overall joint probability, considering the assignment of states to the other nodes. Before using this method, consider carefully whether you really want the MPE, or rather just a list of the most probable state for each of the nodes.

  The algorithm Netica uses to find the MPE is known as a "max propagation" in the junction tree.
  Parameters:

  NodeList |  | nodeList |  | currently, this must be all the nodes in this net. You can call getNodes to create this list, or, equivalently, simply pass null.

  Version:
  Versions 1.07 and later have this method.
  In the C Version of the API, this function is named MostProbableConfig_bn.
  See Also:

  getJointProbability |  | Find the actual joint probability of a configuration
  getBeliefs |  | Can find the most probable state for a single node only
  getNodes |  | Get the list of nodes

  Example:

        // The following puts the most probable configuration in config,
        // and its probability in maxprob.
        //
        net.compile();
        int[] config = net.getMostProbableConfig (null);
        double maxprob = net.getJointProbability (null, config);
        // ... use config and maxprob ...

public Node getNode ( |
String | nodeName
| ) throws NeticaException

  Returns the node of this net which has a name exactly matching name (case sensitive comparison). If there is no such node, it will return null (without generating an error).

  name can be any string; it need not be a legal IDname (of course if is not legal, null will be returned).

  To search a node list for a node with a given name, see the FindNodeNamed example below.
  Parameters:

  String |  | name |  | The name of the node sought.

  Version:
  This method is available in all versions.
  In the C Version of the API, this function is named GetNodeNamed_bn.
  See Also:

  `getName` |  | (inverse method) Returns the name of the node

  Example #1:

      The following method is available in NetEx.java which extends Net.java:
        /**
         *  Find a node by name.  Like getNode(String nodeName), except that
         *  throws a NeticaException if the name doesn't exist.
         *  @param  name The name of the node sought
         *  @returns The node with that name
         */
        public Node getExistingNode (String nodeName) throws NeticaException {
            Node node = getNode (nodeName);
            if (node == null){
               throw new NeticaException ("There is no node named " + nodeName +
        		                       " in net " + getName());
            }
            return node;
        }

  Example #2:

        The following method is available in NodeListEx.java which extends NodeList.java:
        /**
         *  Returns the index of the node identified by name within this list of nodes,
         *  or -1, if it doesn't appear.
         *  @param name  the name of the node sought
         *  @returns the index of the node with that name, or -1 if there isn't one
         */
        public int findNodeNamed (String name) throws NeticaException {
            Net net = getNet();
            Node node = net.getNode (name);
            if (node == null)  return -1;
            return indexOf (node);
        }

public Node getNodeAtTime ( |
String | nodeName,
double[ ] | time
| ) throws NeticaException

public NodeList getNodes ( |
String | options
| ) throws NeticaException

  Returns a list of all the nodes in this net.

  If this net has no directed cycles, the list will be in topological order (i.e., a parent will always appear before its children).

  To obtain the number of nodes in the net, use the length of the returned list (it will not contain duplicates or null entries), e.g., getNodes().size(); .

  Consecutive calls to this method may yield lists in different orders.
  Version:

  This method is available in all versions.
  In the C Version of the API, this function is named GetNetNodes_bn.
  See Also:

  `Node.delete` |  | Removes a node from the net

  Example:

      The following method is available in NetEx.java:
        /**
         *  Returns a list of all the nodes in this net, with the exception
         *  of those nodes that are of kind: Node.CONSTANT_NODE.
         */
        public NodeList getNonConstantNodes() throws NeticaException {
            NodeList nodes = getNodes();
            NodeList nc_nodes = new NodeList (this);

            Enumeration enum = nodes.elements();
            while (enum.hasMoreElements()) {
                Node node = (Node) enum.nextElement();
                if (node.getKind() != Node.CONSTANT_NODE) {
                    nc_nodes.add (node);
                }
            }
            return nc_nodes;
        }

public NodeList getNodes ( ) throws NeticaException

  Returns a list of all the nodes in this net.

  If this net has no directed cycles, the list will be in topological order (i.e., a parent will always appear before its children).

  To obtain the number of nodes in the net, use the length of the returned list (it will not contain duplicates or null entries), e.g., getNodes().size(); .

  Consecutive calls to this method may yield lists in different orders.
  Version:

  This method is available in all versions.
  In the C Version of the API, this function is named GetNetNodes_bn.
  See Also:

  `Node.delete` |  | Removes a node from the net

  Example:

      The following method is available in NetEx.java:
        /**
         *  Returns a list of all the nodes in this net, with the exception
         *  of those nodes that are of kind: Node.CONSTANT_NODE.
         */
        public NodeList getNonConstantNodes() throws NeticaException {
            NodeList nodes = getNodes();
            NodeList nc_nodes = new NodeList (this);

            Enumeration enum = nodes.elements();
            while (enum.hasMoreElements()) {
                Node node = (Node) enum.nextElement();
                if (node.getKind() != Node.CONSTANT_NODE) {
                    nc_nodes.add (node);
                }
            }
            return nc_nodes;
        }

public java.awt.Color getNodesetColor ( |
String | nodeset
| ) throws NeticaException

  Retrieves the color of nodeset in this net.

  The purpose of color is only for display purposes in Netica Application.
  Parameters:

  String |  | nodeset |  | A nodeset name.

  Version:
  Versions 3.22 and later have this method.
  See Also:

  `Net.setNodesetColor` |  | Sets it
  setNodesetColor |  | Sets it
  `Node.addToNodeset` |  | To create node-sets, and add nodes to them
  `Node.isInNodeset` |  | Determines if a node is in a node-set
  reorderNodesets |  | To change the priority order of a net's node-sets
  getAllNodesets |  | Returns string listing all node-sets defined

public void getRelatedNodes ( |
NodeList | relatedNodes,
String | relation,
NodeList | nodeList
| ) throws NeticaException

  Finds all the Nodes that bear the relationship relation with any member of nodeList and puts them in relatedNodes.

  Otherwise it works the same as `Node.getRelatedNodes`; see that method for more information.

  Note: It is okay if relatedNodes = nodeList (i.e., the list gets modified in-place).

  On entry, nodeList must not contain duplicates (but relatedNodes may).

  Tip: A handy and efficient way to remove the duplicates from any node list is to call this function with the node list as relatedNodes, an empty list for nodeList, and "parents,union" as the relation.
  Parameters:

  NodeList |  | relatedNodes |  | a list to append the results to
  String |  | relation |  | the relationship to search for
  NodeList |  | nodeList |  | the nodes whose relatives are sought

  Version:
  Versions 3.05 and later have this method.
  In the C Version of the API, this function is named GetRelatedNodesMult_bn.
  See Also:

  `Node.getRelatedNodes` |  | Same, but for a single node
  `Node.isRelated` |  | Tests relationship of two nodes
  getNodes |  | Get all nodes in the net

  Example #1:

        //find all the parents of all the children of a node
        NodeList children = node.getChildren();
        NodeList parentsOfChildren = new NodeList (node.getNet());
        net.getRelatedNodes (parentsOfChildren, "parents", children);

  Example #2:

        //find all the descendants of the children of a node, excluding the children themselves.
        //I.e., find grand-children, great-grandchildren, great-great-grandchildren, ...
        NodeList children = node.getChildren();
        NodeList descendants = new NodeList (node.getNet());
        net.getRelatedNodes (descendants, "descendants,exclude_self", children);

public void readFindings ( |
long[ ] | casePosn,
Streamer | file,
NodeList | nodeList,
long[ ] | idNum,
double[ ] | freq
| ) throws NeticaException

  Deprecated.

public void readFindings ( |
long[ ] | casePosn,
Streamer | file,
boolean | add,
NodeList | nodeList,
long[ ] | idNum,
double[ ] | freq
| ) throws NeticaException

  Reads a set of findings (i.e., a case) from a file containing one or more cases.

  The case file is an ascii text file with each case on one row, and the first row being the list of nodes as column headings. Each entry is separated by a comma, space or tab. Such a format is quite common; it can be produced by a spreadsheet program like Excel, or by the Netica method writeFindings.

  It only reads findings into the nodes listed in nodeList. Other nodes in the net will not have any new findings entered or retracted, even if findings for them appear in the file. If nodes is null, it means to operate on all the nodes mentioned in the file. It is okay if nodeList contains some nodes not mentioned in the file. If nodeList is empty, no new findings will be entered. If nodeList is null, then all nodes will be read; that is, null has the same result as supplying the result of net.getNodes().

  If add is false, then it will first retract findings for all the nodes in nodeList. If add is true, then it will add these findings to the existing findings for the nodes in nodeList. In either case, it will generate errors if the new findings are inconsistent with any remaining findings in the net.

  In general it reads from file the case at casePosn[0], or if casePosn[0] is NEXT_CASE it reads the next case after the last one read from file, and sets casePosn[0] to the position of the case it just read. In detail:

  | Called with: |  | File condition: |  | Action taken:
  | casePosn = null |  | - file has no cases |  | generates error
  |  |  | - file has 1 or more cases |  | reads first case
  | casePosn[0] = FIRST_CASE |  | - file has no cases |  | returns with casePosn[0] = NO_MORE_CASES
  |  |  | - otherwise |  | reads first case & sets casePosn[0] to it
  | casePosn[0] = NEXT_CASE |  | - all cases read |  | returns with casePosn[0] = NO_MORE_CASES
  |  |  | - otherwise |  | reads next case & sets casePosn[0] to it
  | casePosn[0] = NO_MORE_CASES |  |  |  | generates error
  | casePosn[0] = case |  | - indicated case is in file |  | reads indicated case
  |  |  | - indicated case isn't in file |  | generates error

  Make sure casePosn[0] is initialized on entry. If you want to read cases by random access, casePosn[0] should be set to a value previously returned by writeFindings or readFindings (not the case idNum).

  When reading multiple sequential cases from the same file using NEXT_CASE, the Streamer object keeps track of the current file position. So different parts of your program, or different threads, can read from the same file in an interleaved way without interference, provided they each have their own Streamer. But each sequential series of reads must use a single Streamer (so the example below wouldn't work if the readFindings call was replaced with: readFindings (..., Streamer (filename, env), ...); because that would make a new Streamer each time it was called).

  If idNum is non-null, then on return idNum[0] will be set to the ID number of the case, or -1 if it doesn't have one. If freq[0] is non-null, then on return freq[0] will be set to the frequency (i.e., multiplicity) of the case stored with that case, or 1.0 if it doesn't have one.
  Parameters:

  long[] |  | casePosn |  | Array of one element allowing you to control which case is to be read and, upon return, informing you which case was read.
  Streamer |  | file |  | The case file to be read.
  boolean |  | add |  | If true, simply add these findings to the existing findings; if this results in an inconsistency, then an exception will be thrown. If false, then replace the existing findings witht these ones.
  NodeList |  | nodeList |  | The set of nodes defining what subset of case data will be read in to affect the net. You may supply null to specify allnodes in the net.
  long[] |  | idNum |  | Array of one element which upon return will be set to the ID number of the case read, or -1, if that case did not have one.
  double[] |  | freq |  | Array of one element which upon return will be set to the multiplicity of the case read, or 1.0, if that case did not have one.

  Version:
  This method is available in all versions.
  In versions previous to 2.26, this method was named readCase.
  In versions previous to 4.15, this method did not have the add parameter.
  In the C Version of the API, this function is named ReadNetFindings2_bn.
  See Also:

  writeFindings |  | Save it so that readFindings can read it back
  retractFindings |  | You may want to call this before reading a case
  getNodes |  | Usually use this for the nodes argument
  Streamer |  | To create the Streamer for the file argument

  Example #1:

        // Usage of net.readFindings() usually follows a pattern like that below.
        //
        // This example is meant as a template for methods that scan through
        // a case file.
        //
        Streamer caseFile = new Streamer (filename);     // create fresh local Streamer
        long[] casePosn = new long[1];
        casePosn[0] = Net.FIRST_CASE;
        while (true) {
          net.readFindings(casePosn, caseFile, false, null, null, null);
          if (caseposn[0] == Net.NO_MORE_CASES)  break;
            //  ... do stuff with the case now entered ...
          caseposn[0] = Net.NEXT_CASE;
        }
        caseFile.close();

  Example #2:

        // Save findings:
        NodeList nodes = net.getNodes();
        Streamer caseFile = new Streamer (filename);
        net.writeFindings (caseFile, nodes, -1L, -1.0);
        //...
        // Later, read them back in:  (or read from any case file)
        net.retractFindings();
        Streamer caseFile2 = new Streamer (filename);
        net.readFindings(null, caseFile2, false, nodes, null, null);

public int redoOperation ( |
double | toWhen
| ) throws NeticaException

  Call this to redo an operation that was undone by undoLastOperation.

  After N calls of undoLastOperation and then N calls of redoOperation, the net will be in the same state as it was before the calls.

  Returns 0 or greater if it succeeded, otherwise negative. The most common reason for failing is that all the operation that were undone have already been redone.

  Pass -1 for toWhen; it is only for future expansion.
  Parameters:

  double |  | toWhen |  |

  Version:
  Versions 3.22 and later have this method.
  In the C Version of the API, this function is named RedoNetOper_bn.
  See Also:

  undoLastOperation |  | Call this first

public void reorderNodesets ( |
String | nodesetOrder
| ) throws NeticaException

  This rearranges the priority order of the node-sets of this net.

  Any node-sets contained in the comma-separated string nodesetOrder will become the highest priority, with the nodes earlier in that list being higher priority. The priority of nodes not mentioned in nodesetOrder will not be modified.

  The purpose of the node-set priority order is just to determine which node-set to use for coloring a node in Netica Application.
  Parameters:

  String |  | nodesetOrder |  | A comma-separated string of node-set names.

  Version:
  Versions 3.22 and later have this method.
  In the C Version of the API, this function is named ReorderNodesets_bn.
  See Also:

  `Node.addToNodeset` |  | To create node-sets
  getNodesetColor |  | How the node-set is displayed in Netica Application
  getAllNodesets |  | Returns string listing all node-sets defined

public String reportJunctionTree ( ) throws NeticaException

  Deprecated. use @link #createCustomReport() instead.

public void retractFindings ( ) throws NeticaException

  Retracts all findings (i.e., the current case) from all the nodes in this net, except "constant" nodes (use Node.finding().clear() for that).

  This includes positive findings (state and real value), negative findings, and likelihood findings.

  If this net does not have any findings, calling this will have no effect.

  If the net is an auto-update net (see setAutoUpdate), then a belief updating will be done to reflect the removal of findings, before this method returns (otherwise it will just be done when needed).
  Version:

  In the C Version of the API, this function is named RetractNetFindings_bn.
  See Also:

  Node.finding().clear() |  | To remove the findings for just one node

public void reviseCPTsByCaseFile ( |
Streamer | file,
NodeList | nodeList,
double | degree
| ) throws NeticaException

  Revises the CPTs of these nodes, to account for the cases in the given file. Reads a file of cases from file and uses them to revise the experience and conditional probability tables (CPT) of each node in nodeList. This method does the same thing as reviseCPTsByFindings, for each of the cases in file, but is more efficient than multiple calls to reviseCPTsByFindings. See the description of reviseCPTsByFindings for more information on the arguments passed, and how this method revises the probabilities.

  If nodeList is null, then all nodes will be read; that is, null has the same result as supplying the result of net.getNodes().

  It is okay if the case file has missing data, or has data on nodes not included in nodeList, or even has data on nodes not in the net containing nodeList. However the probabilities of a node are only modified by cases supplying a value for the node and for all of its parents.

  NOTE: If there are nodes without CPTs in nodeList for which there are no findings (or there is no information on one of their parents), they will not be modified, so no CPT table will be built, so a later call to getCPTable could return null unexpectedly.
  Parameters:

  Streamer |  | file |  | The file of cases.
  NodeList |  | nodeList |  | a list of the nodes whose CPTs you want revised. You may supply null to specify all nodes in the net.
  double |  | degree |  | how the case should be weighted (usually 1.0).

  Version:
  In the C Version of the API, this function is named ReviseCPTsByCaseFile_bn.
  See Also:

  reviseCPTsByFindings |  | Revise probabilities with a single case
  `Learner.learnCPTs` |  | Revise probabilities with a Caseset
  Streamer |  | Create the stream
  NodeList |  | Create the node list

public void reviseCPTsByFindings ( |
NodeList | nodeList,
double | degree
| ) throws NeticaException

  Revises the CPTs of these nodes, to account for the currently entered case.

  The current case (i.e., findings entered) is used to revise each node's conditional probabilities. This is different from belief updating, which finds the beliefs for nodes (i.e., posterior probabilities), given conditional probability relations between them and the findings that have been entered. Instead, revising the probabilities changes the conditional probability tables (CPTs) between the nodes to account for the current case.

  The first few times this is called for a node, the probabilities will change considerably, because the node has little experience, but after many cases have been entered, each new case will result in only a small change.

  If nodeList is null, then all nodes will be read; that is, null has the same result as supplying the result of net.getNodes().

  degree indicates how the case should be weighted. The normal value for degree is 1. If a positive integer n is passed, it will have the same effect as calling this method n times to tally up n identical cases. If degree is 0, the call will have no effect. If the case is learned by calling with degree = 1, it can later be "unlearned" by calling with degree = -1.

  In general, if it is called with degree = d at one point in time, and then with the same case and degree = c at another time, the overall effect will be the same as a single call with degree = d + c, even if there were many intervening calls with other cases and other degrees, and even if d or c or both are negative. If a call to fadeCPTable was made in between, then d will be weighted by the degree passed to fadeCPTable.

  The order in which cases are presented has no effect.

  If a node already has CPT and experience tables, this method uses the experience table to provide a "confidence" for each of the probabilities in the CPT table. The higher the experience of a probability, the less it will be altered. It is okay if a node starts with no CPT or experience tables, since then Netica will start it off with a uniform distribution having the minimum experience. However, when calling this method, a node cannot have a CPT table and no experience table, since then Netica will not know what confidence to assign the existing probabilities of the CPT table, and an exception will be thrown.

  NOTE: If there are nodes without CPTs in nodeList for which there are no findings (or there is no information on one of their parents), they will not be modified, so no CPT table will be built, so a later call to getCPTable could return null unexpectedly.
  Parameters:

  NodeList |  | nodeList |  | a list of the nodes whose CPTs you want revised. You may supply null to specify all nodes in the net.
  double |  | degree |  | how the case should be weighted (usually 1.0).

  Version:
  In the C Version of the API, this function is named ReviseCPTsByFindings_bn.
  See Also:

  reviseCPTsByCaseFile |  | Batch version, more efficient than one at a time
  fadeCPTable |  | Use between calls to reviseCPTsByFindings when the world is changing during learning
  NodeList |  | Create the node list

public void setAutoUpdate ( |
int | autoupdate
| ) throws NeticaException

  Turns auto-updating on or off.

  Pass BELIEF_UPDATE for autoupdate to have the new beliefs of a compiled net calculated immediately whenever new findings are entered, or 0 to inhibit this (in which case they will be calculated when needed, e.g., by getBeliefs).

  A reason for inhibiting automatic updating is because updating (also known as "propagation") is time and memory consuming, and you may want to enter many findings before doing it. However, an advantage to having updating done after each finding is entered, is that each new finding will be checked for consistency with the findings already entered.

  If you are going to be retracting a finding for a node, and then entering a new one, sometimes very significant performance gains can be made by ensuring auto-updating is turned off during the retraction (see example of enterFindingNot).

  If the net is auto-updating, and you make a call to a single Netica method which enters findings for several nodes at once (e.g., reading a case), then Netica will use just a single updating to account for them all.

  If you are turning auto-updating on, and the net is compiled but not updated, then updating will be done before this method returns, which may be time consuming.

  It is best to always set auto-updating one way or the other after creating a new net, since the default value may vary between Netica versions.

  When a net is written to file, the auto-update value is included.
  Parameters:

  int |  | autoupdate |  | The new auto-updating value.

  Version:
  This method is available in all versions.
  Versions previous to 2.11 expected the autoupdate argument to be 1 instead of BELIEF_UPDATE.
  In the C Version of the API, this function is named SetNetAutoUpdate_bn.
  See Also:

  getAutoUpdate |  | Retrieves value
  compile |  | Auto-updating doesn't occur until net is compiled
  getBeliefs |  | Forces a belief update if one is required

  Example:

      See enterFindingNot for an example of saving and restoring auto-update.

public static void setConstructorClass ( |
String | netClassNm
| ) throws NeticaException

  Deprecated. use `env.setNetClass(class)` instead.

public void setElimOrder ( |
NodeList | elimOrder
| ) throws NeticaException

  Sets an "Elimination order" of all the nodes in this net, used to guide compiling to find an efficient junction tree.

  Associates the list of nodes elimOrder with this net to be used as its "elimination order" the next time this net is compiled.

  elimOrder must include all the nodes of this net without any duplication (except it should not include any nodes whose kind is UTILITY_NODE or CONSTANT_NODE). Alternately, elimOrder can be null, in which case any elimination order currently associated with this net will be removed.

  The elimination order guides the process of triangulation during the compilation of this net, and can effect both the time and memory efficiency of belief updating considerably.

  If no elimination order is supplied, Netica finds one automatically as the first step of compiling. When a net is written to file, the elimination order is included. Whenever the structure of a net changes, Netica removes the existing elimination order.

  Calling this method has no effect on the current compilation; it only takes action during the next compilation. It doesn't matter if the net is compiled or not when this method is called.
  Parameters:

  NodeList |  | elimOrder |  | The nodes arranged in the desired elimination order.

  Version:
  This method is available in all versions.
  In the C Version of the API, this function is named SetNetElimOrder_bn.
  See Also:

  getElimOrder |  | Retrieves the elimination order currently being used
  compile |  | Do or redo the compilation to use the new elimination order
  sizeCompiled |  | See how good the current ordering is
  reportJunctionTree |  | Analyze the effect of the current order

public void setNodesetColor ( |
String | nodeset,
java.awt.Color | color
| ) throws NeticaException

  This sets the color of nodeset to color.

  To indicate that nodes should not be colored based on this node-set, but rather to go on to the next lower priority node-set to determine the color, pass -2 for color.

  The purpose of color is only for display purposes in Netica Application. If the color display is not as you expect, perhaps it is due to the node-set `priority order`.
  Parameters:

  String |  | nodeset |  | A nodeset name.
  Color |  | color |  | A nodeset name.

  Version:
  Versions 3.22 and later have this method.
  In the C Version of the API, this function is named SetNodesetColor_bn.
  See Also:

  getNodesetColor |  | Retrieves it
  `Node.addToNodeset` |  | To create node-sets, and add nodes to them
  `Node.isInNodeset` |  | Determines if a node is in a node-set
  reorderNodesets |  | To change the priority order of a net's node-sets
  getAllNodesets |  | Returns string listing all node-sets defined

public void setNumUndosKept ( |
int | countLimit,
double | memoryLimit,
String | options
| ) throws NeticaException

public void setRandomGenerator ( |
RandomGenerator | randomGenerator,
boolean | isPrivate
| ) throws NeticaException

  Associates a random generator randomGenerator with this net, so that all operations on this net that require randomness will use randomGenerator (unless overridden by another generator, as described in documentation for the particular function being used).

  The methods affected are: generateRandomCase, learnCPTs and equationToTable. It only affects learnCPTs when doing EM or gradient learning, but it may also slightly affect counting learning in the rare case of extremely large data sets that require stochastic overflow rounding. It affects equationToTable when it is necessary to do stochastic numerical integration over cell regions. It can also affect the inference functions, such as getBeliefs or getFindingsProbability, but only if you have set them to do approximate inference by sampling.

  After associating a random generator with a Bayes net, you can anytime call setRandomGenerator again to change the association to a new random generator, or to no random generator (by passing null).

  If isPrivate is true, then you are giving the net this RandomGenerator for its exclusive use; you must not use it for anything else, and it will be destroyed automatically when the net is. If isPrivate is false, then the net will use the RandomGenerator, but you may use it for whatever other purposes you wish as well. It will not be destroyed automatically when the net is; you must do that with finalize, but you must not destroy it until after the net is destroyed (or the net has been assigned a different or no RandomGenerator using setRandomGenerator).
  Parameters:

  RandomGenerator |  | randomGenerator |  | The RandomGenerator to be associated with this net.
  boolean |  | isPrivate |  | whether you are reserving this RandomGenerator for the net's exclusive use.

  Version:
  Versions 5.02 and greater have this method.
  In the C Version of the API, this function is named SetNetRandomGen_bn.
  See Also:

  RandomGenerator |  | To create a new RandomGenerator.

  Example:

      See RandomGenerator.

public double sizeCompiled ( ) throws NeticaException

  Returns the total size of the internal structure created by compiling a net (i.e., the junction tree, including sepsets), considering the findings currently entered. The size is measured as the number of state space entries (i.e., the number of probabilities that must be stored).

  The net must already be compiled before calling this (see compile).

  Maximum inference time for belief updating, and memory required for compiling and updating, are both linearly related to the quantity returned (the number of bytes required is 4 times the number returned). They are maximum, providing this net does not have any positive findings entered which are later removed.

  The value returned will be at its maximum before any findings are entered, and with each new positive finding entered, it will decrease or remain constant. Any likelihood or negative findings entered will not alter the value returned, unless they are equivalent to a positive finding.
  Version:

  Versions 2.06 and later have this method.
  In the C Version of the API, this function is named SizeCompiledNet_bn.
  See Also:

  reportJunctionTree |  | Provides more information on junction tree
  compile |  | Need to compile the net first
  setElimOrder |  | Elimination order can have a major effect on the compiled size

public void uncompile ( ) throws NeticaException

  Releases the resources (e.g., memory) used by a compiled net.

  It doesn't change the elimination ordering.

  Calling uncompile when the net is not compiled has no effect.

  sizeCompiled can be used to determine how much memory will be released.
  Version:

  Versions 2.09 and later have this method.
  In the C Version of the API, this function is named UncompileNet_bn.
  See Also:

  compile |  | (reverse operation)
  sizeCompiled |  | To determine how much memory will be released
  finalize |  | Discard the whole net

public int undoLastOperation ( |
double | toWhen
| ) throws NeticaException

  Undoes the last operation done to this net (or any node in it), leaving the net in the same state as it was before the operation was done.

  It may be called repeatedly to undo multiple operations.

  Returns 0 or greater if it succeeded, otherwise negative. The most common reason for failing is that there were no (more) operations to undo.

  Pass -1 for toWhen; it is only for future expansion.
  Parameters:

  double |  | toWhen |  |

  Version:
  Versions 3.22 and later have this method.
  In the C Version of the API, this function is named UndoNetLastOper_bn.
  See Also:

  redoOperation |  | Re-does the operation just undone

public void write ( |
Streamer | outStream
| ) throws NeticaException

  Writes this net to a stream specified by outStream.

  (Note, the word 'file' is used loosely in the following to mean either a file-system file or the block of data sent via the stream.)

  The file format that the net is written in depends on the file extension (i.e., the ending of the file name passed to Streamer or NewMemoryStreamer). If the extension is ".neta", a binary format producing much smaller files and allowing for encryption is used. Otherwise the DNET file format is used, which is a text file format that may be useful in examining/editing the files produced, or exporting them to another program (for more information, see http://www.norsys.com/dl/DNET_File_Format.txt). It is advised to end the file names with either ".neta" or ".dne", so that way they can be more easily identified by other people and other programs, such as Netica Application.

  All versions of Netica API and Netica Application can read/write ".dne" files (which are the same as ".dnet" files), and all versions of them after 2.27 can read/write ".neta" files.

  If outStream is attached to a file, and it already exists, it is overwritten. The net is always saved using a "safe-save", which writes it to a new file, and then if there was no problem, it deletes the old file and changes the name of the new file to that of the old. That way there is no risk of data loss in case of an interruption due to a software error or hardware failure.

  If there are findings entered in this net, you may want to retract them with retractFindings before writing this net, since otherwise they will be saved in the file.

  If the file size is very large, it may be because of large tables (such as CPTs). If these are defined by equations, it may be worthwhile to delete them with deleteTables before writing the net to file, and restoring them with equationToTable after reading the net back in.
  Parameters:

  Streamer |  | outStream |  | The stream where the net will be written.

  Version:
  This method is available in all versions. Versions previous to 2.27 could not read/write files in .neta format.
  In the C Version of the API, this function is named WriteNet_bn.
  See Also:

  Streamer |  | Generates the required Streamer
  Net(Streamer) |  | Reads back the net saved
  retractFindings |  | May want to retract findings before saving net
  writeFindings |  | Just save the findings currently entered as a case
  getFileName |  | Later retrieve the name of the file written to

  Example #1:

        net.write (new Streamer ("..nets/temp.dne"));

  Example #2:

      For an example of writing to a byte array using ByteArrayOutputStream, see Streamer(OutputStream,String,Environ).

public long writeFindings ( |
Streamer | file,
NodeList | nodeList,
long | idNum,
double | freq
| ) throws NeticaException

  Saves in file the set of findings currently entered in nodeList, so that later they can be read back with readFindings.

  It saves findings of discrete nodes and values of continuous nodes, but not likelihood findings, or negative findings (i.e., findings which say that a node is not in some state).

  If file already exists, this will add the case to it (unless it is not a case file, in which case an exception will be thrown). If you wish to write over the existing file, delete it before calling this.

  The first case determines what columns will be included in the file. Each node in nodeList will become one column.

  If nodeList is null, then all nodes will be read; that is, null has the same result as supplying the result of net.getNodes().

  Pass -1 for idNum and/or freq if you do not want columns for them to appear in the case file. If any cases will need them, they must be included in the first case written to the file.

  It returns the file position of the new case (which can later be passed to readFindings).

  It only saves findings from the nodes of nodeList, and if the file already exists, it won't save findings from any of nodeList that were not included in the node list used to first construct the file.

  It is advised to give case files the extension ".cas" (i.e., the file name passed to Streamer ends with ".cas"). That way they can be more easily identified by the Netica Application program.

  You can control the characters Netica uses to separate findings, and to indicate a finding is absent, with the methods setCaseFileDelimChar and setMissingDataChar, respectively.
  Parameters:

  Streamer |  | file |  | File to write.
  NodeList |  | nodeList |  | The nodes to use for creating the case. You may supply null to specify all nodes in the net.
  long |  | idNum |  |
  double |  | freq |  |

  Version:
  This method is available in all versions.
  In versions previous to 2.26, this method was named writeCase.
  In the C Version of the API, this function is named WriteNetFindings_bn.
  See Also:

  readFindings |  | Reads back the case that writeFindings saves
  write |  | Saves the whole net, including findings
  setCaseFileDelimChar |  | Controls which character Netica uses to separate findings
  setMissingDataChar |  | Controls which character Netica uses to indicate a node has no finding
  NodeList |  | Creates the node list

  Example:

      See readFindings

public void delete ( ) throws NeticaException

  Deprecated. use `finalize` instead.

public NodeList duplicateNodes ( |
NodeList | nodeList
| ) throws NeticaException

  Deprecated. use `copyNodes` instead.

public void readCase ( |
long[ ] | casePosn,
Streamer | file,
NodeList | nodeList,
long[ ] | idNum,
double[ ] | freq
| ) throws NeticaException

  Deprecated. use `readFindings` instead.

public long writeCase ( |
NodeList | nodeList,
Streamer | file,
long | idNum,
double | freq
| ) throws NeticaException

  Deprecated. use `writeFindings` instead. Note that the order of the parameters has changed to be consistent with that for `readFindings`.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD