Author Topic: Table import guidance  (Read 15446 times)

Offline MB

  • Newbie
  • *
  • Posts: 9
    • View Profile
Table import guidance
« on: September 29, 2009, 19:47:37 »
I have generated CPTs using an external program because the build-in table generators take a very long time.  I would like to import to CPTs into Hugin. 
I have saved the files as .txt files however, when I attempt to import the files into Hugin, I receive the following error: "Unable to import table from file. The file contains 0 lines (should be 10) with number of values (big number)"  I am certain the file is not empty and that it contains the correct number of values. 
Is there any guidance available on the format the .txt files should take?  I have tried to export a table and use the same format for the imported file, but with no success.
Any guidance would be greatly appreciated.
Thank you.
-MB

Offline Anders L Madsen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 2295
    • View Profile
Re: Table import guidance
« Reply #1 on: September 30, 2009, 09:47:15 »
I have generated CPTs using an external program because the build-in table generators take a very long time.  I would like to import to CPTs into Hugin. 
If the set of parents includes interval nodes, then the Table Generator will - by default - generate 25 values for each interval for each parent. This means that the number of samples generated can become very large. To reduce the number of samples you should reduce the number Samples/Interval

Quote
I have saved the files as .txt files however, when I attempt to import the files into Hugin, I receive the following error: "Unable to import table from file. The file contains 0 lines (should be 10) with number of values (big number)"  I am certain the file is not empty and that it contains the correct number of values. 


What version of HUGIN software are you using?

Quote
Is there any guidance available on the format the .txt files should take?  I have tried to export a table and use the same format for the imported file, but with no success.
This is an example of CPT taken from the Asia network (Chest Clinic) for the node Dyspnoea:
---------- Dyspnoea? ----------
CPT
0.9,0.8,0.7,0.1
0.1,0.2,0.3,0.9

Alternatively, you could consider using an API to enter the values to the CPT. If you, for instance, are using Excel to generate the values, then you can use the ActiveX Server to write a simple macro to enter the numbers.

However, I suggest to reduce Samples/Interval to increase the speed and use the Table Generator to compute the values.
HUGIN EXPERT A/S

Offline MB

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Table import guidance
« Reply #2 on: September 30, 2009, 19:35:07 »
Thank you for your quick reply. 
I will re-consider using the table generator by reducing samples. However, I am uncertain about the sampling scheme used.  Does Hugin sample from the actual parent distribution (i.e. does it re-normalize to account for the actual shape of the distribution over a particular state when a specific distribution is selected) or does it assume the distribution is uniform within each state?

I am using a 64-bit version of Hugin (for Windows), so unfortunately I don't think I can an API/Excel to input tables.

Thank you for your guidance on the form on the input files.  I was using tab/space rather than comma delimiter and that seemed to cause a problem.  Now that I have written the files as comma deliminated, I am able to import them into Hugin (though admittedly, it takes some time for the files to import due to their large size).

Offline Anders L Madsen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 2295
    • View Profile
Re: Table import guidance
« Reply #3 on: October 01, 2009, 22:49:21 »
Quote
However, I am uncertain about the sampling scheme used.  Does Hugin sample from the actual parent distribution (i.e. does it re-normalize to account for the actual shape of the distribution over a particular state when a specific distribution is selected) or does it assume the distribution is uniform within each state?
The sampling scheme is described in section 5.9 of the HUGIN C API reference manual. The basic idea is the n number of values are generated uniformly from the interval represented by the state
HUGIN EXPERT A/S