Usage: ./matrix [ [ [ [ [ [ [ [ [ [ [ [ [ [ ]]]]]]]]]]]]]] except for inputfile, others are optional. 1 to be verbose. 0 to be quiet (default is 1). 1 to run the dynamic programming version. 2 to run guessorders local search (default is 0 for B&B). 1 to use AIC score. 0 to use BIC score (default is 0). real number to specify the score of the initial known solution (-1e100 by default). (useful if a local search was run before and a good solution is already known, because it reduces the search space.) name of the file that receives the results. Note that the file will be overwritten! integer that defines a stopping rule based on the number of iterations integer that defines a stopping rule based on the number of minutes integer that defines the maximum amount of memory (in MB) that may be spent by the search-tree (note that the actual amount of memory used by the program will be slightly more.) integer (in %) defines a stopping rule based on the acceptable percentage of error of the current best solution maximum number of data to use, even if the file contains more 1 if to ignore all constraints (default 0). is the number of the node to build the cache. Only used if rundynprog==3 (see comments below) if given, the cache is not built but read from the file Comments about the arguments: - If you set verb to 2, even more information is printed in the standard error. - There are three implemented algorithms: a dynamic programming idea (which uses 2^n time and space), a guessorders which guesses an ordering for the variables and then perform the structure learning over the fixed order (because of the ordering, no cycles appear and the best structure is quickly achieved, but the question is that there are n! possible orderings), and a B&B search over the arcs (with worst-case 2^(2n), but it is an any-time in the sense of providing a solution if stopped earlier, and also a certificate of the maximum distance to the global optimum, as done by any branch-and-bound method; depending on the search space, many parts might be pruned and the search might be much faster than the worst-case). - aic is a flag to define which score function to use. A value of 1 indicates the AIC score. A value of zero implies in BIC score. A negative value implies in the BDeu score, with ESS (equiv. sample size) equal to -aic. For instance, -10 means the BDeu with ESS=10, while -2.3 means ESS=2.3, and so on. - best is an initial solution value, which means that any solution that has a value worse than this value is ignored (not considered). This may be used to improve the B&B search by giving to it the value of an initial guess found with some other method. Note that the current implementation of the B&B search already performs a simple guess ordering before starting the search, because a good initial solution may strongly reduces the search space to be evaluated. - maxmem is a hard constraint that makes the dynamic programming stop if such amount of memory is reached. However, for the B&B search, it isnot a hard constraint in the sense of stopping the B&B, but it in fact changes the behavior of the search. When the memory limit is reached, the B&B becomes a DFS (deep-first search) that does not use additional memory. As soon as there is room for the B&B to continue, the DFS becomes B&B again. So the actual results is that a DFS and a B&B are constantly interchanged in this case. A negative entry is ignored and no limit is set. - mingap is used only by the B&B search. When a solution is found such that the gap of the B&B search guarantees a worst-case error of less than mingap, the search is stopped. A negative value is ignored and no limit is set. - maxdata is a parameter to restricted the methods to use only part of the available data set for learning. This is useful to test the algorithms in the presence of scarce data, for example. A negative value is ignored and no limit is set. - ignconstraints is a flag that tells the algorithms to ignore the constraints, and it is mainly useful to test the difference between using them or not. - maxparents is a global constraint to the maximum number of parents per variable. It is just a shortcut way to specify such a constraint, because it would be possible to write it inside the input file. A negative value is ignored and no limit is set. - there is a way to build the cache in parallel by calling the program separately for each variable. This is done by the use of the flag "which", which indicates the number of the variable the cache should be built. At the same time, the argument rundynprog must be set to 3. The cache filename must be given in the outputfile argument, and it must be set equally among distinct calls of the program that are going to build the cache of the variables of the same input file. For example, take the test2.txt available here, which contains 8 variables. It is possible to run 8 parallel executions (e.g. in a computer cluster or grid) as follows: ./matrix test2.txt test2.cache 0 3 0 -1e100 1000000 120 2000 -1 -1 0 0 ./matrix test2.txt test2.cache 0 3 0 -1e100 1000000 120 2000 -1 -1 0 1 ./matrix test2.txt test2.cache 0 3 0 -1e100 1000000 120 2000 -1 -1 0 2 ./matrix test2.txt test2.cache 0 3 0 -1e100 1000000 120 2000 -1 -1 0 3 ./matrix test2.txt test2.cache 0 3 0 -1e100 1000000 120 2000 -1 -1 0 4 ./matrix test2.txt test2.cache 0 3 0 -1e100 1000000 120 2000 -1 -1 0 5 ./matrix test2.txt test2.cache 0 3 0 -1e100 1000000 120 2000 -1 -1 0 6 ./matrix test2.txt test2.cache 0 3 0 -1e100 1000000 120 2000 -1 -1 0 7 Of course you need to call them in parallel to have any benefit (e.g. using the qsub command of some clusters). This will create a test2.cache file with meta data and files test2.cache.nodeXX, where XX is the the cache of that given node. Be advised that the cache files that are created are machine dependant and might not be portable between different architectures. To use the created cache files, it is necessary to use the argument cachefile in the execution line. In this case, the program will read the cache from the files and start to run the desired structure search promptly. An example is ./matrix test2.txt test2.out 0 0 0 -1e100 1000000 120 2000 -1 -1 0 -1 test2.cache - the code also works for incomplete data if the sufficient statistics is given, that is, it does not perform the expectation part of an EM like method, but it is suitable for the maximization part. In practical terms, instead of an entry number in the data set of the input file, one may give a tuple with the sufficient statistics (roughly meaning the probability of each one of the states for that sample). For example, if we have two ternary variables, the data set could contain the following lines: 0 2 1 0 [0.3,0.3,0.4] 1 [0,0.5,0.5] 2 1 [0.7,0.1,0.2] The last three lines contain one observed value and the sufficient statistics for the other. The format is [V1,V2,V3,...], where Vi is the probability of the state i of the corresponding variable in that sample. Still, it is up to an external code to perform the expectation part to obtain a fully operational structural EM code.