Page 1 of 1

Order Scoring Module

PostPosted: Tue Jul 15, 2014 12:13 pm
by cwyoo
This is a high level code for Order Scoring Module:

logOrderScore(Order *od, Dataset ds, long maxNumberOfParents) {

for all variables(nodes) in od (indexed by i) {
for all possible parents of node i in od limited by maxNumberOfParents #1{
// create an array of index for node i's parents and store in ParentIndices *pidxArray
// sum up the returns of logNodeScore(NodeIdx i, long r_i, ParentIndices *pidxArray, ParentsNumOfStates pnumStateArray, DataSet ds)#2 using double lnXpluslnY (double first, double second) module
}
// sum up the score
}
// return the summed score
}

#1Odometer class will be helpful in implementing this loop. Odometer class is avaialable in Git repository at cheeti-code/LIM/Odometer.h
#2logNodeScore() module was introduced when describing the logBDeScore() module
#3lnXpluslnY() module is avaialable in Git repository at cheeti-code/LIM/utility_basic.[h, cpp]

Michael/Abhilash please document all the modules, classes under Manuscripts & Documentation > Implemented Classes/Modules Documentation as you create/modify/use them.

Re: Order Scoring Module

PostPosted: Fri Aug 08, 2014 9:27 am
by cwyoo
Michael, please post the high level code for MCMCReverseOrderingSearch(). I will also ask you to implement a version that does not apply the "Reverse" order operation (let's call that MCMCOrderingSearch()). In both MCMCReverseOrderingSearch() and MCMCOrderingSearch(), I will ask you to keep the scores for all pairwise relationships logscores, i.e., log (P(D | X_i -> X_j)), log (P(D | X_i <- X_j)), and log (P(D | X_i X_j)) for all i and j where D is the dataset.

These log scores can be updated as you are calculating the ordering score. All you need to do is adding the appropriate BDe score to the matching pairwise relationships that are being added while you are calculating the ordering score. At the end, you should normalize the three score, i.e., calculate P(X_i -> X_j | D), P(X_i <- X_j | D), and P(X_i X_j | D) and note that P(X_i -> X_j | D) + P(X_i <- X_j | D) + P(X_i X_j | D) = 1.0 we assume P(X_i -> X_j) + P(X_i <- X_j) + P(X_i X_j) = 1/3.

Re: Order Scoring Module

PostPosted: Fri Aug 08, 2014 9:42 am
by cwyoo
cwyoo wrote:Michael, please post the high level code for MCMCReverseOrderingSearch(). I will also ask you to implement a version that does not apply the "Reverse" order operation (let's call that MCMCOrderingSearch()). In both MCMCReverseOrderingSearch() and MCMCOrderingSearch(), I will ask you to keep the scores for all pairwise relationships logscores, i.e., log (P(D | X_i -> X_j)), log (P(D | X_i <- X_j)), and log (P(D | X_i X_j)) for all i and j where D is the dataset.

These log scores can be updated as you are calculating the ordering score. All you need to do is adding the appropriate BDe score to the matching pairwise relationships that are being added while you are calculating the ordering score. At the end, you should normalize the three score, i.e., calculate P(X_i -> X_j | D), P(X_i <- X_j | D), and P(X_i X_j | D) and note that P(X_i -> X_j | D) + P(X_i <- X_j | D) + P(X_i X_j | D) = 1.0 we assume P(X_i -> X_j) + P(X_i <- X_j) + P(X_i X_j) = 1/3.


As it was described in the Friedman's ordering article, I will ask to only use "Swapping" operation for MCMCReverseOrderingSearch() and MCMCOrderingSearch() (we will not use "Cutting the Deck" operation.) The article discuss about tricks of speeding up the ordering score calculation when you swap the order position of i and j.