codesimian
Class SimpleFastContinuousBayesNet

java.lang.Object
  extended by codesimian.CS<CSGeneric>
      extended by codesimian.DefaultCS
          extended by codesimian.BayesNode
              extended by codesimian.ContinuousBayesNode
                  extended by codesimian.SimpleFastContinuousBayesNet
All Implemented Interfaces:
CodeSimian

public class SimpleFastContinuousBayesNet
extends ContinuousBayesNode

Same as continuousBayesNode, but contains many of them. It can have many more parameters without the exponential cost that a single bayes node has.

This is meant to be a FAST bayes calculation, fast enough for audio, so quantity of nodes should be less than approximately 5 times the input quantity.

P(0) is list of inputs (childs).

P(1) is not yet used but is reserved for numbers that describe things in P(0).

P(2) is learning speed, range 0 to 1, and should stay near 0.


Nested Class Summary
 
Nested classes/interfaces inherited from class codesimian.BayesNode
BayesNode.VerifyCountP
 
Field Summary
 
Fields inherited from class codesimian.ContinuousBayesNode
defaultAverageErrorStart, defaultLearningSpeed
 
Fields inherited from class codesimian.BayesNode
TYPE
 
Fields inherited from class codesimian.CS
DESCRIPTION, END, EXECPROXY, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS
 
Constructor Summary
SimpleFastContinuousBayesNet()
           
 
Method Summary
 double averageError()
          range 0 (perfect) to 1 (correct answer is always 0 or 1 and try to answer incorrectly).
 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.util.List<ContinuousBayesNode> getAllNodesThatHaveNoParents()
          these are the only nodes you can remove without damaging the network
 ContinuousBayesNode[] getNodesThatPredict(CS inputToPredict)
          ordered: those at lower index predict better.
 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()".
static ContinuousBayesNode newNode(CS[] oneOutputThenInputs, double learningSpeed)
          If oneOutputThenInputs.length is large, a new instance of this class is returned.
 boolean setD(double d)
          Removes all child bayes-nodes and all conditional-probabilities.
 
Methods inherited from class codesimian.ContinuousBayesNode
copyArrayToCS, description, maxP, minP
 
Methods inherited from class codesimian.BayesNode
addToHistory, adjustBitChance, bitChance, childCountForCondProbSize, cost, makeArraySumTo1, PType, 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, setPType, setS, setZ, start, toString, V, Z
 
Methods inherited from class codesimian.CS
addB, addC, addD, addF, addI, addJ, addL, addP, addP, addP, addP, addP, addS, addZ, BForProxy, CForProxy, clone, D, deleteP, FForProxy, GETB, GETC, GETD, GETF, GETI, GETJ, GETL, GETS, GETZ, IForProxy, isIllusion, 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, reflect6, setB, SETB, setC, SETC, setCost, SETD, setDescription, setF, SETF, setHeap, setI, SETI, setJ, SETJ, SETL, setL, setL, setParent, setParsePriority, setProxyOf, setS, SETS, setTester, setZ, SETZ, SForProxy, tester, toJavaCode, VForProxy, voidReflect, ZForProxy
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleFastContinuousBayesNet

public SimpleFastContinuousBayesNet()
Method Detail

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 ContinuousBayesNode
See Also:
CS.parent(), CS.newInstance(), CS.name()

averageError

public double averageError()
range 0 (perfect) to 1 (correct answer is always 0 or 1 and try to answer incorrectly). A good ContinuousBayesNode should get around .05 average error.

Overrides:
averageError in class ContinuousBayesNode

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 ContinuousBayesNode

getNodesThatPredict

public ContinuousBayesNode[] getNodesThatPredict(CS inputToPredict)
ordered: those at lower index predict better. For each returned node, node.P(0).P(0) is inputToPredict.


getAllNodesThatHaveNoParents

public java.util.List<ContinuousBayesNode> getAllNodesThatHaveNoParents()
these are the only nodes you can remove without damaging the network


newNode

public static ContinuousBayesNode newNode(CS[] oneOutputThenInputs,
                                          double learningSpeed)
If oneOutputThenInputs.length is large, a new instance of this class is returned. It will be efficient for any size.


setD

public boolean setD(double d)
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 ContinuousBayesNode