Converting CPT to NoisyMAX definitions

The engine.
Post Reply
jonnie
Posts: 41
Joined: Mon Feb 06, 2012 12:49 pm

Converting CPT to NoisyMAX definitions

Post by jonnie »

Hello, I'm wondering how to convert DSL_cpt to DSL_noisyMAX definitions.
A simple way seems to be DSL_node::ChangeType, but the parents' outcomes are not all ordered by their influence strength on the noisy node. This shouldn't be necessary anyway since a parent might have several noisy children which use the parent's outcomes in different orders.
However, DSL_node::ChangeType doesn't automatically re-order the parents' outcomes to find the best match. So what happens is a conversion to a noisy node which takes a lot of time (8 parents) and doesn't yield the proper result.
I tried creating a new DSL_noisyMAX object from the DSL_cpt and calling SetParentOutcomeStrengths and CptToCi afterwards.
I also tried calling DaddyChangedOrderOfOutcomes on the DSL_cpt and changing type to DSL_noisyMAX afterwards.
Always the same thing happens.
Does someone know which functions to use in which order to achieve the wanted result? I can't pass the wanted new outcome orders to ChangeType after all.
Greetings & thanks in advance,
Johannes
adam
Posts: 25
Joined: Thu Jan 17, 2008 11:01 pm
Location: Shrivenham, UK
Contact:

Re: Converting CPT to NoisyMAX definitions

Post by adam »

Johannes,

SMILE does not provide means to identify the optimal order of parents' states. You should do that on your own.

I'm assuming that you are aware of the functionality for assigning strengths of the influences (order of parents' states) that is implemented in the DSL_noisyMAX class (GetParentOutcomeStrengths(), etc). Note, that the functionality that allows for manipulating the ordering of states for generic nodes has nothing to do with the ordering of the influences specific to the noisy-MAX model.

You should be able to implement a simple heuristic to do that -- you need to consider pairwise relations between each parent and the child. Moreover, the problem is reduced to identifying the leak state for each parent, as the order of the rest of the parent's states does not matter.

BTW -- Don't use DaddyChangedOrderOfOutcomes -- it's an internal method that should not be called by a user.

Cheers,
Adam
jonnie
Posts: 41
Joined: Mon Feb 06, 2012 12:49 pm

Re: Converting CPT to NoisyMAX definitions

Post by jonnie »

Hello Adam,
Yes I understand the concept of ordering the strengthes of parents' states in the noisyMAX definition.
I implemented a simple heuristic (in fact, in my network it's always the first state which is the leak state) but I don't know how to use it:
If I create the noisyMAX from the CPT first and then change the ordering, Smile executes a long and pointless algorithm to try to align the CPT to noisyMAX in the first step. (Also, I didn't succeed in changing the ordering afterwards either.)
If I create a new noisyMAX definition and set the ordering first, then I don't know how to "transfer" the CPT matrix to the new definition in order to perform Smile's aligning algorithm.
So, now I've written my own algorithm for that as well (wasn't difficult because the CPD of these nodes comes from a noisy-or relationship anyway, so I used that).
However, that algorithm doesn't work in the general case, and also I guess I'm not the first one trying to convert a CPT to noisyMAX, so I thought I'd ask here how the API is actually supposed to be used.
Cheers Johannes
adam
Posts: 25
Joined: Thu Jan 17, 2008 11:01 pm
Location: Shrivenham, UK
Contact:

Re: Converting CPT to NoisyMAX definitions

Post by adam »

Johannes,

I think I may be missing something from your description. If your original distribution if noisy-OR, you can directly enter it by creating a noisy-MAX node in SMILE and simply provide noisy-OR/MAX parameters (not a full CPT!) directly using SetDefinition() from the DSL_noisyMAX class. How to do that is documented here: http://genie.sis.pitt.edu/wiki/Referenc ... L_noisyMAX .

So, if you know the noisy-OR distributions for children nodes, simply (1) create children nodes as DSL_noisyMAX (don't do DSL_Cpt and conversion, because it will invoke unnecessary conversion step); (2) set the parents' influences in the child's node; (3) set the noisy-MAX parameters for the child using DSL_noisyMAX::SetDefinition(). Should do the trick.

If you have an arbitrary CPT and you want to convert it to a noisy-MAX, contrary to what you think it is not a usual situation. Actually, you are the third person I know who attempts to do that. Assuming that you know the parent's
distinguished
states (leak states), but you don't know the noisy-MAX parameters, you can do the following.

For each child node, create a separate DSL_network that has only the child node and it's parents. (1) Make sure (using ChangeOrderOfOutcomes on parents) that the distinguished state of each parent is always the last one. (2) Set the CPT for the child node (remember that the parent states are changed). (3) Call ChangeType() on the child node to make it DSL_noisyMAX. This will invoke the conversion algorithm, but the parents' leak states should be correctly recognised. Now you have the conversion done correctly, the only step is to copy the parameters to the original network. Of course, you should do that for each noisyMAX node in your model.

Hopefully it helps.

Cheers,
Adam
Post Reply