|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectRC
public abstract class RC
This abstract class helps with removing code from the RCDgraph and RCDtree classes.
Nested Class Summary | |
---|---|
static class |
RC.RCCounters
|
static class |
RC.RCCreationException
|
static class |
RC.RCCreationParams
|
class |
RC.RCStats
|
class |
RC.RCStats_All
Handle storing and computing computational statistics based on doing All computations (on graphs it would be for all marginals, and for trees it would be the same as Pe). |
class |
RC.RCStats_Pe
Handle storing and computing computational statistics based on doing Pe computations. |
static interface |
RC.RecCondThreadListener
|
Field Summary | |
---|---|
boolean |
allowKB
|
RC.RCCounters |
counters
|
static boolean |
DEBUG_RC_CALC
|
static boolean |
DEBUG_RC_EVID
|
static double |
DOUBLE_OUTOFMEMORY
|
PrintWriter |
outputConsole
|
double |
scalar
|
static String |
STR_EXCEPTION_EVIDENCE
|
static String |
STR_OUTOFMEMORY_MSG
|
static String |
STR_STACKOVERFLOW_MSG
|
static boolean |
TODO_REMOVE_DO_EXTRA_LOOKAHEAD
|
static boolean |
TODO_REMOVE_DO_INDEX_CACHING_DURING_CREATION
This variable needs to be set during RC creation and stay the same during computations! |
static boolean |
TODO_REMOVE_DO_LEAF_CACHING_DURING_CREATION
This variable is only used during RC creation, not dynamically! |
static boolean |
TODO_REMOVE_DO_LOOKAHEAD_LOWERBOUND
|
static boolean |
TODO_REMOVE_DO_PROP_UP
|
static boolean |
TODO_REMOVE_REVERSE_ORDER
|
MappedList |
vars
|
Constructor Summary | |
---|---|
RC(RC.RCCreationParams params)
RC Object constructor. |
Method Summary | |
---|---|
double |
allContexts()
|
double |
allContextsMinusLeafs()
|
void |
allocRCCaches()
|
void |
allocRCMPE3Caches()
|
void |
allocRCMPE4Caches()
|
void |
allocRCMPECaches()
|
void |
assertLearnedPositive(int fv,
int state)
This is called if the KB learns about a variable from unit propagation, and was not told about this from the user. |
void |
assertUnLearnedPositive(int fv)
Called when transitioning from 1 possible state to two possibe states (for any variable, whether the KB learned it or was told it). |
boolean |
canComputeFamilyMarginals()
|
void |
clearKB()
|
static long |
collOfFinVarsToStateSpace(Collection col)
Will return the state space of all the variables in the collection, and if the collection is empty it will return 1. |
void |
createKB()
|
int[] |
generateNumParents(MappedList nds)
Will not change nds if it is non-null & non-empty |
abstract RCNode |
getAnyRoot()
|
Map |
getCFMap()
|
RCIterator |
getIterator()
|
RCIterator |
getIteratorParentChild()
|
abstract RCIterator |
getIteratorRoots()
|
abstract RCIteratorTraversal |
getIteratorTraversal()
|
abstract RCIterator |
getIteratorTree()
|
RCNode[] |
getRoots()
|
String |
getStatistics()
|
String |
getStatistics(boolean shortStr)
|
abstract String |
getTagName()
|
Thread |
getThreadRunning()
|
static Collection |
getVars(Collection A)
Get all the vars contained within a collection of RCNodes. |
static Collection |
getVars(Collection A,
Collection ret)
Get all the vars contained within a collection of RCNodes. |
boolean |
isRunning()
|
void |
kbCallAssertOnVar(int fv)
|
void |
kbDontCallAssertOnVar(int fv)
|
KnowledgeBase |
knowledgeBase()
|
double |
limitedContexts(boolean rtChildAsOne)
|
double |
numCacheEntries_MPE()
Number of Caches being used by this RC object. |
int |
numRoots()
|
void |
observe(FiniteVariable var,
Object value)
Add var=value to the list of observations. |
RCNode[] |
parentChildOrdering()
Guarantees a parent before a child. |
void |
pauseRecCondAsThread()
|
abstract double[] |
recCond_All()
Run Recursive conditioning P(e) for each root node (special for testing & output of timing/memory...). |
double |
recCond_MPE(Map varToValue)
Run Recursive conditioning MPE. |
double |
recCond_MPE3(double cutoff)
Run Recursive conditioning MPE3. |
double |
recCond_MPE4(double cutoff)
Run Recursive conditioning MPE4. |
Thread |
recCond_MPEAsThread(RC.RecCondThreadListener finished)
Run rEccond_Mpe In A Separate Thread, And Call Finished.Rcfinishedmpe( Double, Map) When Done. |
double |
recCond_Pe_Scaled()
Run Recursive conditioning P(e). |
void |
recCond_Pe_ScaledAsThread(RC.RecCondThreadListener finished)
Run recCond_Pe_Scaled in a separate thread, and call finished.rcFinished( double) when done. |
double |
recCond_Pe()
Run Recursive conditioning P(e). |
void |
recCond_PeAsThread(RC.RecCondThreadListener finished)
Run recCond_Pe in a separate thread, and call finished.rcFinished( double) when done. |
abstract void |
recCond_PreCompute()
Run RC for each root node to "precompute" the marginals. |
void |
resetEvidence()
Returns the evidence to the state of no observations. |
void |
resetRC()
|
void |
resetStatistics()
|
void |
resumeKB()
Warning: This function should not really be public and should not be called from outside of the package unless you are sure it will not lead to computation errors! |
void |
resumeRecCondAsThread()
|
void |
reSynchEvidWithBN(boolean resetEvid)
Should not normally be called from outside the package, usually it should be handled by the inference engine. |
RCNode |
root(int i)
|
void |
setCPT(FiniteVariable var)
|
boolean |
setInst(int indx,
int newvalue)
When using KnowledgeBase, be careful about how algorithms will react to KB making changes. |
RC.RCStats |
statsAll()
|
RC.RCStats |
statsPe()
|
void |
stopAndWaitRecCondAsThread()
Will stop any running functions and wait for them to finish. |
void |
suspendKB()
Warning: This function should not really be public and should not be called from outside of the package unless you are sure it will not lead to computation errors! |
double |
toRealPr(double in)
|
double[] |
toRealPr(double[] in)
|
void |
unobserve(FiniteVariable var)
|
void |
useKB()
|
boolean |
useKBflag()
|
Map |
varToRoot()
|
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean DEBUG_RC_CALC
public static final boolean DEBUG_RC_EVID
public static final String STR_STACKOVERFLOW_MSG
public static final String STR_OUTOFMEMORY_MSG
public static boolean TODO_REMOVE_REVERSE_ORDER
public static boolean TODO_REMOVE_DO_PROP_UP
public static boolean TODO_REMOVE_DO_EXTRA_LOOKAHEAD
public static boolean TODO_REMOVE_DO_LOOKAHEAD_LOWERBOUND
public static boolean TODO_REMOVE_DO_LEAF_CACHING_DURING_CREATION
public static boolean TODO_REMOVE_DO_INDEX_CACHING_DURING_CREATION
public PrintWriter outputConsole
public final MappedList vars
public final RC.RCCounters counters
public final double scalar
public static final double DOUBLE_OUTOFMEMORY
public static final String STR_EXCEPTION_EVIDENCE
public final boolean allowKB
Constructor Detail |
---|
public RC(RC.RCCreationParams params)
Initializes the variables
Method Detail |
---|
public boolean canComputeFamilyMarginals()
public Map varToRoot()
public Thread getThreadRunning()
public boolean isRunning()
public void resetStatistics()
public String getStatistics()
public String getStatistics(boolean shortStr)
public RCIterator getIterator()
public abstract RCIteratorTraversal getIteratorTraversal()
public abstract RCIterator getIteratorRoots()
public abstract RCIterator getIteratorTree()
public abstract RCNode getAnyRoot()
public final RCIterator getIteratorParentChild()
public void allocRCCaches()
public void allocRCMPECaches()
public void allocRCMPE3Caches()
public void allocRCMPE4Caches()
public abstract double[] recCond_All()
Note: It is possible for the returned value to be NaN if the network contains that in a cpt.
public abstract void recCond_PreCompute()
This is meant mostly for dgraphs, where the marginal is saved in the root. For a dtree, it will just fill up the caches, but not at the root node.
Note: It is possible for the returned value to be NaN if the network contains that in a cpt.
public double limitedContexts(boolean rtChildAsOne)
public double allContexts()
public double allContextsMinusLeafs()
public double numCacheEntries_MPE()
public void resetRC()
public Map getCFMap()
public final void assertLearnedPositive(int fv, int state)
KnowledgeBase.KnowledgeBaseListener
If this one is called, may not call AssertLearnedNegative for all the states.
assertLearnedPositive
in interface KnowledgeBase.KnowledgeBaseListener
public final void assertUnLearnedPositive(int fv)
KnowledgeBase.KnowledgeBaseListener
assertUnLearnedPositive
in interface KnowledgeBase.KnowledgeBaseListener
public final void kbDontCallAssertOnVar(int fv)
kbDontCallAssertOnVar
in interface KnowledgeBase.KnowledgeBaseListener
public final void kbCallAssertOnVar(int fv)
kbCallAssertOnVar
in interface KnowledgeBase.KnowledgeBaseListener
public double recCond_Pe_Scaled()
Note: It is possible for the returned value to be NaN if the network contains that in a cpt.
public double recCond_Pe()
Note: It is possible for the returned value to be NaN if the network contains that in a cpt.
public double recCond_MPE(Map varToValue)
Note: It is possible for the returned value to be NaN if the network contains that in a cpt.
public double recCond_MPE3(double cutoff)
Note: It is possible for the returned value to be NaN if the network contains that in a cpt.
public double recCond_MPE4(double cutoff)
Note: It is possible for the returned value to be NaN if the network contains that in a cpt.
public void recCond_PeAsThread(RC.RecCondThreadListener finished)
Since the only way to determine a result is through finished, if it is null nothing will be done.
public void recCond_Pe_ScaledAsThread(RC.RecCondThreadListener finished)
Since the only way to determine a result is through finished, if it is null nothing will be done.
public Thread recCond_MPEAsThread(RC.RecCondThreadListener finished)
Since The Only Way To Determine A Result Is Through Finished, If It Is Null Nothing Will Be Done.
public void pauseRecCondAsThread()
public void resumeRecCondAsThread()
public void stopAndWaitRecCondAsThread()
waitFor
- A non-Null thread (running ...AsThread) to wait for it to finishpublic void resetEvidence()
public void observe(FiniteVariable var, Object value)
public void setCPT(FiniteVariable var)
public void unobserve(FiniteVariable var)
public void reSynchEvidWithBN(boolean resetEvid)
public RC.RCStats statsPe()
public RC.RCStats statsAll()
public static final long collOfFinVarsToStateSpace(Collection col)
public double toRealPr(double in)
public double[] toRealPr(double[] in)
public final RCNode[] getRoots()
public final RCNode root(int i)
public final int numRoots()
public RCNode[] parentChildOrdering()
public int[] generateNumParents(MappedList nds)
public abstract String getTagName()
public static Collection getVars(Collection A)
public static Collection getVars(Collection A, Collection ret)
public final boolean setInst(int indx, int newvalue)
Can only fail if using the KB, otherwise it only sets the inst array.
public KnowledgeBase knowledgeBase()
public boolean useKBflag()
public void useKB()
public void createKB()
public void clearKB()
public void suspendKB()
public void resumeKB()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |