RBNinference
Class PFNetwork

java.lang.Object
  extended by RBNinference.PFNetwork

public class PFNetwork
extends java.lang.Object


Constructor Summary
PFNetwork()
           
PFNetwork(Primula pr, java.util.Vector an, RelStruc A, Instantiation inst)
           
 
Method Summary
 int allnodesSize()
           
 double[] allsampleweight()
           
 Atom atomAt(int i)
           
 int instValAt(int i)
           
 void prepareForSampling(int sampleordmode, int adaptivemode, boolean[] samplelogmode, int numpar, AtomList queryatoms, int num_subsamples_minmax, int num_subsamples_adapt, java.io.BufferedWriter logwriter)
           
 void propagateDeterministic(java.util.Vector instnodes, RelStruc A, boolean usesampleinst)
           
 Rel relAt(int i)
           
 double[] sampleInst(int subsind, boolean verbose)
          Sample one instantiation; set instantiated field of the nodes accordingly
 int sampleValAt(int i)
           
 void setSampleProbs(SampleProbs sps, int num_subsamples, java.io.BufferedWriter logwriter)
           
 void showNodes()
           
 void showSampleOrd(RelStruc A, java.io.BufferedWriter lwr)
           
 double[] trueSampleWeightAt(int i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PFNetwork

public PFNetwork()

PFNetwork

public PFNetwork(Primula pr,
                 java.util.Vector an,
                 RelStruc A,
                 Instantiation inst)
Method Detail

allnodesSize

public int allnodesSize()

allsampleweight

public double[] allsampleweight()

atomAt

public Atom atomAt(int i)

instValAt

public int instValAt(int i)

prepareForSampling

public void prepareForSampling(int sampleordmode,
                               int adaptivemode,
                               boolean[] samplelogmode,
                               int numpar,
                               AtomList queryatoms,
                               int num_subsamples_minmax,
                               int num_subsamples_adapt,
                               java.io.BufferedWriter logwriter)
                        throws RBNCompatibilityException,
                               RBNInconsistentEvidenceException,
                               java.io.IOException
Throws:
RBNCompatibilityException
RBNInconsistentEvidenceException
java.io.IOException

propagateDeterministic

public void propagateDeterministic(java.util.Vector instnodes,
                                   RelStruc A,
                                   boolean usesampleinst)
                            throws RBNCompatibilityException,
                                   RBNInconsistentEvidenceException
Throws:
RBNCompatibilityException
RBNInconsistentEvidenceException

relAt

public Rel relAt(int i)

sampleValAt

public int sampleValAt(int i)

trueSampleWeightAt

public double[] trueSampleWeightAt(int i)

showNodes

public void showNodes()

showSampleOrd

public void showSampleOrd(RelStruc A,
                          java.io.BufferedWriter lwr)
                   throws java.io.IOException
Throws:
java.io.IOException

sampleInst

public double[] sampleInst(int subsind,
                           boolean verbose)
                    throws RBNCompatibilityException,
                           RBNInconsistentEvidenceException
Sample one instantiation; set instantiated field of the nodes accordingly

If inst is nonempty, then do importance sampling of the conditional distribution given inst, and return the weight of the sample

Instantiated nodes that become isolated prob zero nodes will not contribute to the weight -- this is no problem, because their weight is constant for all samples

subsind is the index of the subsample for this instantiation

Throws:
RBNCompatibilityException
RBNInconsistentEvidenceException

setSampleProbs

public void setSampleProbs(SampleProbs sps,
                           int num_subsamples,
                           java.io.BufferedWriter logwriter)
                    throws java.io.IOException
Throws:
java.io.IOException