Start the discussion about BDe scoring module

This module implements Equation 35 of Heckerman's article in Theory & Concepts

Start the discussion about BDe scoring module

Postby cwyoo » Tue Jul 01, 2014 7:14 pm

BDe module implements equation (35) from Heckerman's article that is post here. Start registering code in git and document the implementation.
cwyoo
Site Admin
 
Posts: 379
Joined: Sun Jun 22, 2014 2:38 pm

Re: Start the discussion about BDe scoring module

Postby cwyoo » Tue Jul 08, 2014 11:29 am

I believe BDe scoring module has been checked into Git. Let me know how to check it out and how far are we on the implementation of the module. I would ask to have the following modules in implemeting the BDe scoring module:

BDeScore(BaysianNetwork bn, Dataset ds) {

for number of nodes (indexed i) {
for number of configurations of node i's parents (indexed j) {
for number of states of node i ( indexed k) {
// get Nijk, alpha_ijk from bn and ds
// we need to have a module to getNijk(i, j, k, bn, ds)
// note that Nij = getNijk(i, j, 0, bn, ds) + getNijk(i, j, 1, bn, ds) + ... + getNijk(i, j, r_i, bn, ds)
// also alpha_ijk = 1/(r_i*q_i) and alpha_ij = 1/q_i

// add log gamma functions for Nijk, alpha_ijk in equation (35)
}
// add log gamma functions for Nij, alpha_ij in equation (35)
}
}
cwyoo
Site Admin
 
Posts: 379
Joined: Sun Jun 22, 2014 2:38 pm

Re: Start the discussion about BDe scoring module

Postby cwyoo » Tue Jul 15, 2014 10:16 am

cwyoo wrote:I believe BDe scoring module has been checked into Git. Let me know how to check it out and how far are we on the implementation of the module. I would ask to have the following modules in implemeting the BDe scoring module:

BDeScore(BaysianNetwork bn, Dataset ds) {

for number of nodes (indexed i) {
for number of configurations of node i's parents (indexed j) {
for number of states of node i ( indexed k) {
// get Nijk, alpha_ijk from bn and ds
// we need to have a module to getNijk(i, j, k, bn, ds)
// note that Nij = getNijk(i, j, 0, bn, ds) + getNijk(i, j, 1, bn, ds) + ... + getNijk(i, j, r_i, bn, ds)
// also alpha_ijk = 1/(r_i*q_i) and alpha_ij = 1/q_i

// add log gamma functions for Nijk, alpha_ijk in equation (35)
}
// add log gamma functions for Nij, alpha_ij in equation (35)
}
}


Michael/Abhilash, could you update me with the status on the implemtation of this module?
cwyoo
Site Admin
 
Posts: 379
Joined: Sun Jun 22, 2014 2:38 pm

Re: Start the discussion about BDe scoring module

Postby cwyoo » Tue Jul 15, 2014 11:59 am

cwyoo wrote:
cwyoo wrote:I believe BDe scoring module has been checked into Git. Let me know how to check it out and how far are we on the implementation of the module. I would ask to have the following modules in implemeting the BDe scoring module:

BDeScore(BaysianNetwork bn, Dataset ds) {

for number of nodes (indexed i) {
for number of configurations of node i's parents (indexed j) {
for number of states of node i ( indexed k) {
// get Nijk, alpha_ijk from bn and ds
// we need to have a module to getNijk(i, j, k, bn, ds)
// note that Nij = getNijk(i, j, 0, bn, ds) + getNijk(i, j, 1, bn, ds) + ... + getNijk(i, j, r_i, bn, ds)
// also alpha_ijk = 1/(r_i*q_i) and alpha_ij = 1/q_i

// add log gamma functions for Nijk, alpha_ijk in equation (35)
}
// add log gamma functions for Nij, alpha_ij in equation (35)
}
}


Michael/Abhilash, could you update me with the status on the implemtation of this module?


I suggest we implement the BDeScoring() in the following way so we can utilize some API when we are scoring the order (see discussion about orderling score):

logNodeScore(NodeIdx i, long r_i, ParentIndices *pidxArray, ParentsNumOfStates pnumStateArray, DataSet ds) {

for number of configurations of node i's parents (indexed j) {
for number of states of node i ( indexed k) {
// get Nijk, alpha_ijk from bn and ds
// we need to have a module to getNijk(i, j, k, bn, ds)
// note that Nij = getNijk(i, j, 0, bn, ds) + getNijk(i, j, 1, bn, ds) + ... + getNijk(i, j, r_i, bn, ds)
// also alpha_ijk = 1/(r_i*q_i) and alpha_ij = 1/q_i

// add log gamma functions for Nijk, alpha_ijk in equation (35)
}
// add log gamma functions for Nij, alpha_ij in equation (35)
}
// return the score
}


logBDeScore(BaysianNetwork bn, Dataset ds) {

for number of nodes in bn (indexed i) {
// 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)
}
// return the summed score
}
cwyoo
Site Admin
 
Posts: 379
Joined: Sun Jun 22, 2014 2:38 pm

Re: Start the discussion about BDe scoring module

Postby M Charles » Wed Jul 16, 2014 1:29 pm

I am still working on coding up this scoring module and will be changing it to be closer to your recommended pseudocode (with some changes based on SMILE's API).

My current code uses a "refcounted_dataset" class (which contains the DSL_dataset object). Inside this class I have member functions for scoring networks, nodes, etc. Later on, derived classes can be made that will override the Nijk function (for tree-based, hash-based, etc).

On another note, I have a question on precision. Is there a large enough risk of underflow/overflow so that I should use a long double (18-decimal digits of precision on our server) rather than a double (15-decimal digits)? This changes the exponents from -308/+308 to -4932/+4932, but will increase computation time by some amount.
M Charles
 
Posts: 23
Joined: Sun Jun 22, 2014 5:00 pm

Re: Start the discussion about BDe scoring module

Postby cwyoo » Wed Jul 16, 2014 8:28 pm

Michael Cho wrote:I am still working on coding up this scoring module and will be changing it to be closer to your recommended pseudocode (with some changes based on SMILE's API).

My current code uses a "refcounted_dataset" class (which contains the DSL_dataset object). Inside this class I have member functions for scoring networks, nodes, etc. Later on, derived classes can be made that will override the Nijk function (for tree-based, hash-based, etc).

On another note, I have a question on precision. Is there a large enough risk of underflow/overflow so that I should use a long double (18-decimal digits of precision on our server) rather than a double (15-decimal digits)? This changes the exponents from -308/+308 to -4932/+4932, but will increase computation time by some amount.


For now, double will be fine.
cwyoo
Site Admin
 
Posts: 379
Joined: Sun Jun 22, 2014 2:38 pm

Re: Start the discussion about BDe scoring module

Postby cwyoo » Wed Aug 06, 2014 11:07 am

Michael, please post your progress here by today. Also please update the documentation sections accordingly so we can start the discussions. Note that post whatever you have upto today. We will revise and update from there.
cwyoo
Site Admin
 
Posts: 379
Joined: Sun Jun 22, 2014 2:38 pm

Re: Start the discussion about BDe scoring module

Postby qja0428 » Mon Nov 21, 2016 1:02 pm

The attachment is all the plots with bde score from my implementation and r, the two cde scores are not exactly the same, but they are close, I think my implementation is fine, we can move on to next: bde score with tree structure.
Attachments
plot.pdf
(21.94 KiB) Downloaded 150 times
qja0428
 
Posts: 18
Joined: Wed Jan 21, 2015 4:13 pm

Re: Start the discussion about BDe scoring module

Postby cwyoo » Thu Nov 24, 2016 6:16 pm

qja0428 wrote:The attachment is all the plots with bde score from my implementation and r, the two cde scores are not exactly the same, but they are close, I think my implementation is fine, we can move on to next: bde score with tree structure.


Great. Please post your implementation in Git with e.s.s. as an user input (default = 1.0)
cwyoo
Site Admin
 
Posts: 379
Joined: Sun Jun 22, 2014 2:38 pm

Re: Start the discussion about BDe scoring module

Postby lsand039 » Mon Nov 28, 2016 10:33 am

Here are some dot file examples.
Attachments
trainingR365.graph.2016.11.16.09.05.05.txt
Small structure: 8 variables
(469 Bytes) Downloaded 147 times
11275.8graph.2016.09.14.09.04.22.txt
Large structure: 11275 variables
(417.98 KiB) Downloaded 153 times
lsand039
 
Posts: 237
Joined: Thu Jan 14, 2016 12:17 pm

Next

Return to BDe Scoring Module

Who is online

Users browsing this forum: No registered users and 1 guest

cron