codesimian
Class ContinuousBayesNode

java.lang.Object
  extended by codesimian.CS
      extended by codesimian.DefaultCS
          extended by codesimian.BayesNode
              extended by codesimian.ContinuousBayesNode
All Implemented Interfaces:
CodeSimian, java.io.Serializable

public class ContinuousBayesNode
extends BayesNode

continuousBayesNode(list(childs...) list(probabilities...))

If P(2) exists, it is the LEARNING SPEED, which ranges 0 - 1. Closer to 0 is best. If not, the default learning speed is used, approximately .05

CHANGE THE JAVADOC: Instead of predicting the last child, the FIRST child is predicted.

EXTERNAL TRAINING VS SELF TRAINING:
Similar to BayesNode, but modifies its own probability list (P(1)) by slowly averaging in child values. Every time this ContinuousBayesNode executes, it gets the values of its childs and slightly updates the probabilities. ContinuousBayesNode returns the PREDICTED value of the last child (P(1).P(P(1).countP()-1))

LIST SIZES:
Unlike a normal BayesNode, probability list's size must be 2^(child lists's size). A normal bayesnode has a probability list has size 2^(child lists's size + 1) because the normal bayesnode's probability is included as a child, but a continuousBayesNode does not predict its own value. Instead it predicts the value of its last child. This means it uses UNSUPERVISED LEARNING, but its really the last child unknowingly being the supervisor.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class codesimian.BayesNode
BayesNode.VerifyCountP
 
Field Summary
 
Fields inherited from class codesimian.BayesNode
TYPE
 
Fields inherited from class codesimian.CS
DESCRIPTION, END, EXECPROXY, FUEL, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER
 
Constructor Summary
ContinuousBayesNode()
           
 
Method Summary
static void copyArrayToCS(double[] array, CS list)
           
 java.lang.String description()
          a short description of this CS, shorter than the javadoc, but long enough to tell what the params are for.
 double DForProxy()
          returns this node's CHANCE (0.0 to 1) based on the DForProxy()s/chances of param0's params and the conditional-probabilities in param1.
 java.lang.String keyword()
          For the CodeSimian language as a String.
CodeSimian language keyword, like "+" "*" "max" ">" etc.

Override this function if you want to specify a keyword other than how I derive them from the class name, like + for Add.

Some CSs might never be intended to be used in the language by their keyword.
The best example (4/05) is Num, because it is used in the language like "3.4" instead of "num()".
 int maxP()
          Maximum quantity of Params
 int minP()
          For DForProxy().
Minimum number of parameters in param[] needed to call DForProxy().
Defines which indexs of param[] DForProxy() can use.
Functions with a different number of parameters must override this.
OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS.
Default is 1.
 CS PType(int index)
          WARNING: since type type of P(1) depends on the type of P(0) and the reverse, if you always check types before adding CSs, none can ever be added.
 boolean setD(double execValue)
          Removes all child bayes-nodes and all conditional-probabilities.
 
Methods inherited from class codesimian.BayesNode
addToHistory, adjustBitChance, bitChance, childCountForCondProbSize, cost, makeArraySumTo1, sum
 
Methods inherited from class codesimian.DefaultCS
B, C, countP, decrementMyFuel, deleteP, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, javaCode, LForProxy, LForProxy, myFuel, name, newInstance, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, S, setB, setC, setCountP, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL, setL1, setMyFuel, setName, setObject, setP, setPrevExec, setS, setZ, start, toString, V, Z
 
Methods inherited from class codesimian.CS
addP, addP, addP, addP, addP, BForProxy, CForProxy, clone, D, deleteP, FForProxy, IForProxy, isIllusion, javaCode, JForProxy, L, L, L, L, L, maxD, minD, overwrites, parent, parsePriority, PB, PC, PD, PF, PI, PJ, PL, prevB, prevC, prevF, prevI, prevJ, prevS, prevZ, proxyOf, PS, PZ, reflect, reflect, setB, setC, setCost, setDescription, setF, setHeap, setI, setJ, setL, setL, setParent, setParsePriority, setProxyOf, setPType, setS, setTester, setZ, SForProxy, tester, VForProxy, voidReflect, ZForProxy
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContinuousBayesNode

public ContinuousBayesNode()
Method Detail

DForProxy

public double DForProxy()
Description copied from class: BayesNode
returns this node's CHANCE (0.0 to 1) based on the DForProxy()s/chances of param0's params and the conditional-probabilities in param1. DOES NOT DO THIS ANYMORE (7/05)... If there is a param2, then param2 is a history list, and DForProxy() saves DForProxy()'s returned value at the end of it.

Overrides:
DForProxy in class BayesNode

minP

public int minP()
Description copied from class: DefaultCS
For DForProxy().
Minimum number of parameters in param[] needed to call DForProxy().
Defines which indexs of param[] DForProxy() can use.
Functions with a different number of parameters must override this.
OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS.
Default is 1.

Overrides:
minP in class BayesNode

maxP

public int maxP()
Description copied from class: CS
Maximum quantity of Params

Overrides:
maxP in class BayesNode

keyword

public java.lang.String keyword()
Description copied from class: DefaultCS
For the CodeSimian language as a String.
CodeSimian language keyword, like "+" "*" "max" ">" etc.

Override this function if you want to specify a keyword other than how I derive them from the class name, like + for Add.

Some CSs might never be intended to be used in the language by their keyword.
The best example (4/05) is Num, because it is used in the language like "3.4" instead of "num()".
Default: Returns class name, minus package name (and its dots), and change the first letter to lowercase.

For example, CS.MaxParams does not override keyword(), which returns "maxP".

Overrides:
keyword in class BayesNode
See Also:
CS.parent(), CS.newInstance(), CS.name()

description

public java.lang.String description()
Description copied from class: CS
a short description of this CS, shorter than the javadoc, but long enough to tell what the params are for. Example use: in automatically generated webpages for CodeSimian. Example: "returns sum of all params" for Add.

Overrides:
description in class BayesNode

setD

public boolean setD(double execValue)
Description copied from class: BayesNode
Removes all child bayes-nodes and all conditional-probabilities. Adds 2 conditional-probabilities. The normal bayes algorithm makes DForProxy() return the second value.

I PLAN TO DO THIS LATER, BUT ITS NOT YET IMPLEMENTED: Executes this BayesNode to determine its current value. Then adjusts the conditional-probabilities in param1 to make this node's DForProxy() return execShouldReturnThisValue (without damaging the other ratios). WARNING: executing this BayesNode could cause infinite loops because the caller might not know this function executes it and therefore did not setMyFuel(to some small number) yet.

Overrides:
setD in class BayesNode

PType

public CS PType(int index)
WARNING: since type type of P(1) depends on the type of P(0) and the reverse, if you always check types before adding CSs, none can ever be added. Types are only consistent if all other types are first consistent.

Overrides:
PType in class BayesNode

copyArrayToCS

public static void copyArrayToCS(double[] array,
                                 CS list)