stochasticsampling
Class Evaluator

java.lang.Object
  |
  +--stochasticsampling.Evaluator

public class Evaluator
extends java.lang.Object

Title: Evaluator.java Description: Core Bayesian Network class Copyright: Copyright (c) 2001 Company: KSU / KDD


Field Summary
 boolean AIS
           
 boolean SIS
           
 
Constructor Summary
Evaluator(int totalsamples, BBN network, NodeManager nm, java.lang.String s, java.lang.String ev)
          Evaluator is the constructor and initializes variables
Evaluator(int totalsamples, BBN network, NodeManager nm, java.lang.String s, java.lang.String ev, AdaptiveAndSelfIS ais)
          Evaluator is the constructor and initializes variables
 
Method Summary
 void addRMSE(double d, int row, int col)
          addRMSE adds a value to the RMSE array
 double calculateSImpScore(java.util.Vector samplePoint)
          calculateSImpScore calculates the score of a given sample
 void clearFreqTable()
          clearFreqTable clears the frenquency table for each query node
 void clearFrequencies()
          clearFrequencies clears the vector of frequencies for all query nodes.
 java.util.Vector computeMPE(java.util.Vector allsamples)
          computeMPE estimates the MPE for the network
 java.util.Vector computeProbOfQueryNodesOntheFly(java.util.Vector SamplePoint, int t, double totalweight, java.lang.String sampling_method, double oneweight)
          computeProbOfQueryNodesOntheFly computes the probability of each instantiation of each query node based on the samples thus far.
 double computeRMSE_DforOneFromTwoProbs(java.util.Vector ExactProbsFromLS, java.util.Vector ApproProbsFromSampling)
          computeRMSE_DforOneFromTwoProbs computes the marginal RMSE for generated sample
 java.util.Vector getFrequencies()
          getFrequencies returns a vector of frequencies for all query nodes from samples.
 double getLikelihoodOfSample(java.util.Vector OneSample)
          getLikelihoodOfSample computes the likelihood (probability) of the currently generated sample
 void printResults()
          printResults prints the RMSE values in printingsarray
 void printResults(java.lang.String printingsFile)
          printResults prints the RMSE values in printingsarray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AIS

public boolean AIS

SIS

public boolean SIS
Constructor Detail

Evaluator

public Evaluator(int totalsamples,
                 BBN network,
                 NodeManager nm,
                 java.lang.String s,
                 java.lang.String ev)
Evaluator is the constructor and initializes variables
Parameters:
totalsamples - - the number of samples to be taken
network - - the Bayesian network
nm - - a copy of the NodeManager
s - - the type of sampling algorithm
evfile - - the evidence file name for the network

Evaluator

public Evaluator(int totalsamples,
                 BBN network,
                 NodeManager nm,
                 java.lang.String s,
                 java.lang.String ev,
                 AdaptiveAndSelfIS ais)
Evaluator is the constructor and initializes variables
Parameters:
totalsamples - - the number of samples to be taken
network - - the Bayesian network
nm - - a copy of the NodeManager
s - - the type of sampling algorithm
ev - - the evidence file name for the network
ais - - a copy of the AdaptiveAndSelfIS class
Method Detail

getFrequencies

public java.util.Vector getFrequencies()
getFrequencies returns a vector of frequencies for all query nodes from samples.
Returns:
Vector - vector of frequencies

clearFrequencies

public void clearFrequencies()
clearFrequencies clears the vector of frequencies for all query nodes.

addRMSE

public void addRMSE(double d,
                    int row,
                    int col)
addRMSE adds a value to the RMSE array
Parameters:
d - - the new RMSE value
row - - the row in the array
col - - the column in the array

printResults

public void printResults(java.lang.String printingsFile)
                  throws java.io.IOException
printResults prints the RMSE values in printingsarray
Parameters:
printingsFile - - the file to print the RMSE values to

printResults

public void printResults()
                  throws java.io.IOException
printResults prints the RMSE values in printingsarray

computeRMSE_DforOneFromTwoProbs

public double computeRMSE_DforOneFromTwoProbs(java.util.Vector ExactProbsFromLS,
                                              java.util.Vector ApproProbsFromSampling)
computeRMSE_DforOneFromTwoProbs computes the marginal RMSE for generated sample
Parameters:
ExactProbsFromLS - - a vector of the exact probabilities from LS for the query nodes in the network
ApproProbsFromSamples - - a vector of the approximate probabilities (based on samples taken) for the query nodes in the network.
Returns:
double - the RMSE value for the current sample

computeMPE

public java.util.Vector computeMPE(java.util.Vector allsamples)
computeMPE estimates the MPE for the network
Parameters:
allsamples - - m samples generated by StochasticSampling
Returns:
Vector - the MPE

calculateSImpScore

public double calculateSImpScore(java.util.Vector samplePoint)
calculateSImpScore calculates the score of a given sample
Parameters:
samplePoint - - the generated sample
Returns:
double - the calculated score

computeProbOfQueryNodesOntheFly

public java.util.Vector computeProbOfQueryNodesOntheFly(java.util.Vector SamplePoint,
                                                        int t,
                                                        double totalweight,
                                                        java.lang.String sampling_method,
                                                        double oneweight)
computeProbOfQueryNodesOntheFly computes the probability of each instantiation of each query node based on the samples thus far.
Parameters:
SamplePoint - - the current sample
t - - the number of samples that have been generated so far
totalweight - - the sum of the weights that each sample has produced so far
Returns:
Vector - the Vector of probabilities for each instantiation of each query node

clearFreqTable

public void clearFreqTable()
clearFreqTable clears the frenquency table for each query node

getLikelihoodOfSample

public double getLikelihoodOfSample(java.util.Vector OneSample)
getLikelihoodOfSample computes the likelihood (probability) of the currently generated sample
Parameters:
OneSample - - the current sample
Returns:
double - the computed likelihood of that sample