DBN for different lengths of sequential data

The engine

DBN for different lengths of sequential data

Postby oscarpc » Mon Jul 16, 2012 3:05 am

Dear colleagues,

We designed a DBN with memory t=2. We would like to train this DBN with temporal sequences of variable length.
That is, do we have to set the number of time-slices before the training and learning the parameters with EM? Does the number of time-slices have to be fixed for training and/or testing?
I am a bit confused with this issue. When I read the tutorial, it seems that the number of time-slices is fixed from the beginning.

How could we do this with SMILE and SMILearn? Is there any example available that I could use?

Thank you very much in advance.

Kind regards,

Oscar PC.
oscarpc
 
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Re: DBN for different lengths of sequential data

Postby shooltz » Tue Jul 17, 2012 9:56 pm

oscarpc wrote:Does the number of time-slices have to be fixed for training and/or testing?


SMILearn's implementation of EM performs the learning on a copy of your network. When running on a DBN, this copy will have its slice count adjusted automatically to keep it in sync with the learning data. The only thing you need to do is to provide correct data/network matching; for DBN this will include proper value in the 'slice' member of DSL_datasetMatch.
shooltz
Site Admin
 
Posts: 828
Joined: Mon Nov 26, 2007 5:51 pm

Re: DBN for different lengths of sequential data

Postby oscarpc » Wed Jul 18, 2012 4:18 am

Thank you very much for your help.
Kind regards,

Oscar PC.
oscarpc
 
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Re: DBN for different lengths of sequential data

Postby oscarpc » Thu Jul 19, 2012 7:32 am

Dear colleagues,

Thank you so much for your prompt help with all my issues. As a new user, I really appreciate it. I like your software a lot.

As I continue programming, I encounter new problems. Sorry to bother you again.

Now that I have created my DBN, I have learnt its parameters with EM & set the evidences for inference, I would like to access the inference probability. That is, if I provided evidences for 4 slices, I would like to predict what is happening in the next node, the 5th.

Therefore, I need to access the probability of my last node in my DBN. How can I do that?
I read on previous posts that I have to access to the 2-dimensional DSL_Dmatrix associated with the node I want to read (DM in my case):

DSL_Dmatrix* Matrix=theNet.GetNode(handle_DM)->Value()->GetMatrix();

Once I have the matrix, I was trying to access it as Matrix[slice][outcome_index], but it doesn't work.

I also read that I can use the Matrix->operator [](), but I don't know how to use it. It says that operator accepts DSL_intArray or plain integers.
Could you please provide an example of how can I read the probabilities by using operator or what you think is more convenient to use?

In addition, I was wondering if DSL_sysCoordinates is also useful for this purpose
DSL_sysCoordinates theCoordinates(*theNet.GetNode(handle_DM)->Value());
theCoordinates.LinkTo(*theNet.GetNode(handle_DM)->Value());


Thank you so much in advance for your help.

Kind regards,
Oscar PC.
oscarpc
 
Posts: 33
Joined: Mon Jun 04, 2012 1:17 am

Re: DBN for different lengths of sequential data

Postby shooltz » Thu Jul 19, 2012 12:29 pm

To use DSL_Dmatrix with multi-dimensional coordinates, try the following:

Code: Select all
DSL_intArray coords;
coords.Add(slice);
coords.Add(outcome);
double p = (*Matrix)[coords];

The 'plain integers' option involves the use of an array of pointers to integers and doesn't have any advantages if you don't plan to map one DSL_Dmatrix onto another.

Alternatively, you can can calculate the linear index into the matrix yourself if you know the outcome count of a node:

Code: Select all
double p = (*Matrix)[outcome + slice * outcomeCount];
shooltz
Site Admin
 
Posts: 828
Joined: Mon Nov 26, 2007 5:51 pm


Return to SMILE

Who is online

Users browsing this forum: Google [Bot] and 1 guest