Getting Conditional probabilities for data

The engine.
Post Reply
thom
Posts: 5
Joined: Thu Sep 24, 2009 7:39 am

Getting Conditional probabilities for data

Post by thom »

Hi,

My question is very simple, however I can't seem to figure it out.
I have build a network based on a dataset and learned the parameters.

Now I want to retrieve a conditional probability of some record in the data, say P(A=6 | B=0).
I know I can do this using the probability matrix for node A:

Code: Select all

DSL_Dmatrix * m = network.GetNode(network.FindNode("A"))->Definition()->GetMatrix();
Now I should be able to get the probability for the corresponding coordinates. However, how do I translate A=6|B=0 to the right coordinates? If the values of A would range from 0...6 this would be trivial. However, this is different when A only takes values 0 and 6.

So my question is, is there a function that translates the values in the dataset to coordinates, or would I have to determine this 'by hand'?
shooltz[BayesFusion]
Site Admin
Posts: 1457
Joined: Mon Nov 26, 2007 5:51 pm

Re: Getting Conditional probabilities for data

Post by shooltz[BayesFusion] »

If the values of A would range from 0...6 this would be trivial. However, this is different when A only takes values 0 and 6.
You have to check the outcome identifiers of node A. If the dataset column contained only integers (as opposed to text tokens, like 's0' or 's6'), the outcomes of A are 'State_0' and 'State_6', assuming that you used GTT directly from SMILE. GeNIe does its own data preprocessing, and the outcome IDs will not contain underscores. It's best to check the learned network to see which naming convention was used.

If you know the outcome identifier mapped to integer value from the dataset, then you can quickly map it to outcome index, which can be later used in DSL_Dmatrix::operator[] or DSL_Dmatrix::CoordinatesToIndex:

int outcomeIndex = def->GetOutcomesNames()->FindPosition("State_6");
thom
Posts: 5
Joined: Thu Sep 24, 2009 7:39 am

Post by thom »

the outcomes of A are 'State_0' and 'State_6', assuming that you used GTT directly from SMILE
It seems that these statenames depend on the structure learner. The PC algorithm gives me statenames without underscores, GTT gives them with underscores..
Post Reply