|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectRBNLearning.GradientGraph
public class GradientGraph
Main class for RBN parameter learning. The Gradient Graph is a representation of the likelihood function given data consisting of pairs of relational input domains (objects of type RelStruc), and observed values of the probabilistic relations (given as objects of type Instantiation). Each pair may contain a different input domain, or there may be multiple observations of the probabilistic relations for one input domain. Nodes in the gradient graph correspond to ground probability formulas obtained from recursively evaluating the probability formulas corresponding to the ground atoms in the Instantiations. Identical ground (sub-) formulas obtained from the evaluation of different instantiated ground atoms are included only once in the GradientGraph. For this purpose a hashtable allNodes for the nodes is maintained. The keys for the nodes are constructed as strings consisting of a concatentation of the index of the data case with the string representation of the ground probability formula. Example: the probabilistic relation r(x,y) is defined by F(x,y) = (s(x,y):t(y),0.6). In both the first and the second data pair the ground atom r(4,7) is observed to be true. Then two nodes will be constructed, one with key 1.(s(4,7):t(7),0.6), and one with key 2.(s(4,7):t(7),0.6). Since the sub-formulas s(4,7) and t(7) may evaluate differently in the two data pairs, these formulas have to be distinguished. If, for example, s(4,7) is observed to be true in the first data pair, and false in the second, then a further nodes with key 1.t(7) will be constructed, but no node 2.t(7).
Constructor Summary | |
---|---|
GradientGraph(Primula mypr,
RelData data,
LearnModule mylm)
|
Method Summary | |
---|---|
protected void |
addToIndicators(GradientGraphIndicatorNode ggin)
|
protected double |
computeCombFunc(int cf,
double[] args)
|
double[] |
computeLikelihood(LearnThread mythread)
Computes the likelihood value given the current parameter setting by Gibbs sampling. |
double[] |
currentLikelihood()
|
double[] |
currentParameters()
|
void |
evaluateBounds()
|
void |
evaluateLikelihoodAndPartDerivs(boolean likelihoodonly)
Computes the empirical likelihood and empirical partial derivatives of the current sample. |
double[] |
getParameters()
|
void |
gibbsSample(int windowindex,
LearnThread mythread)
Performs one round of Gibbs sampling. |
boolean |
initIndicators(LearnThread mythread)
|
double[] |
learnParameters(LearnThread mythread)
|
int |
numberOfEdges()
Returns the number of links in the graph |
int |
numberOfIndicators()
Returns the number of indicator nodes in the graph |
int |
numberOfNodes()
Returns the number of nodes in the graph |
int |
numberOfParameters()
|
java.lang.String |
parameterAt(int i)
|
java.lang.String[] |
parameters()
|
void |
resetBounds()
Resets to [-1,-1] the bounds in all nodes |
void |
resetValues(boolean valueonly)
|
void |
setParameters(double[] thetas)
Sets the parameter values to thetas. |
void |
setParametersRandom()
|
void |
setParametersUniform()
|
void |
setTruthVals(int sno)
Sets the truthval fields in the ProbFormNodes corresponding to unobserved atoms to the truthvalues in the sno's sample If sno<0 do nothing! |
void |
showAllLikelihoods(double incr)
Prints a list of likelihood values for all possible parameter settings obtained by varying each parameter from 0.0 to 1.0 using a stepsize of incr |
void |
showAllNodes(int verbose,
RelStruc A)
|
java.lang.String |
showGraphInfo(int verbose,
RelStruc A)
|
void |
showLikelihoodNode(RelStruc A)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GradientGraph(Primula mypr, RelData data, LearnModule mylm) throws RBNCompatibilityException
RBNCompatibilityException
Method Detail |
---|
protected void addToIndicators(GradientGraphIndicatorNode ggin)
protected double computeCombFunc(int cf, double[] args)
public double[] currentLikelihood()
public double[] currentParameters()
public int numberOfParameters()
public java.lang.String[] parameters()
public java.lang.String parameterAt(int i)
public void evaluateLikelihoodAndPartDerivs(boolean likelihoodonly)
public void evaluateBounds()
public void resetValues(boolean valueonly)
public void resetBounds()
public boolean initIndicators(LearnThread mythread)
public void gibbsSample(int windowindex, LearnThread mythread)
public void setTruthVals(int sno)
public void showLikelihoodNode(RelStruc A)
public void showAllNodes(int verbose, RelStruc A)
public double[] learnParameters(LearnThread mythread)
public void setParameters(double[] thetas)
public double[] getParameters()
public void setParametersRandom()
public void setParametersUniform()
public java.lang.String showGraphInfo(int verbose, RelStruc A)
public void showAllLikelihoods(double incr)
public int numberOfNodes()
public int numberOfIndicators()
public int numberOfEdges()
public double[] computeLikelihood(LearnThread mythread)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |