LibB for Windows/Linux Programs


License for academic use

LibB for Windows/Linux 2.1 Copyright (C) Nir Friedman and Gal Elidan

LibB executables are freely available for academic use only. For purposes other then academic research you should contact:

galel@cs.huji.ac.il or
nir@cs.huji.ac.il.


The following programs are now available for Windows 2000/NT/XP/Linux

Here is an example of a names file, a net file, and an instance file (? denoting missing values) all of the Alarm monitoring system network.

GenInstance

GenInstance  generates samples from a network file. Here is the usage info:

Usage:
GenInstance <BNFile> [-# <INum>] [-i <IFile>] [-n <NFile>] [<Stub>]

Download: GenInstance.exe (Linux version)
 
<BNFile>   name of the Bayesian network file.
 <INum>  number of instances to generate (default 100)
 <IFile>  name of file in which to store instances.
<NFile>  name of file in which to store field information.
<Stub>  name of instance stub. Store instances in <Stub>.data and fields information in <Stub>.names
 -o <num> number of observable variables.
 -s <num> set seed (useful for regenerating the same dataset several times)

LearnBayes


LearnBayes learns a Bayesnet. The usage info is :

Usage:
LearnBayes <options> [-i <IFile>] [-n <NFile>] [<Stub>]

where <NFile>, <IFile> and <Stub> are the same as for GenInstance

Download: LearnBayes.exe (Linux version)

LearnBayes has more options than one can remember. The option structure was built in a long evolution and there are more than one form for specifying things. In the future I might get a uniform interface for options, but right now this is whats out there.

Here is the summary of the most relevant options organized according to aspects of the program that the options effect.

General options:

-o <netfile> writes the final networks learned to <netfile>
-s <netfile> specifies the starting network for the search
-N <n> <file> dumps the <n> best scoring networks in <file> (this depends on the search method employed)
-x saves intermediate results. If the output file is specified, then whenever a new best-scoring network is found, it is written to the output file (and overwrite the previous network written then)
-y <sec> sets maximum running time to <sec> seconds. This does not work for perieds longer than 1/2 hour. The best scoring network is dumped to the output file at the end of the specified time
-S <seed> set seed for random number generator

Score related options:

-t I sets score to be BIC (e.g., MDL)
-t L use likelihood score
-t B sets score to be BDe (note this will crash unless you set prior).
In case of learning structure with SEM there are several variants. The default "-t B" learns with covariance estimates among counts (see the paper) and can be a bit slow. A faster version that works quite well can be invoked with "-t Bn"
-P<n> sets uniform BDe prior with equivalent sample size n (The program can deal with more complex prior, but I did not give the mechanism for specifying them yet...)

Type of networks learned:

 
-D learn defaults instead of full CPTs
-T learn trees instead of full CPTs. In these trees splits are "full variable splits", e.g., each test splits on all possible values of a variable
-Tb learn binary trees instead of full CPTs. These trees splits on binary tests (e.g., X == x)
-F learn with fixed structure
-t N <v> learn naive-Bayes with <v> as the class variable
-t F <n> learn TAN with <v> as the class variable
-t T learn CL tree

Search related options

 
+g set greedy hill climbing (default)
+g<k> set greedy hill climbing with random restarts. <k> is the number of random steps in each restart. (Use +# to set number of restarts)
+gt<k> sets the TABU-list size for greedy hill climbing to be <k>
+b sets best-first search
+B<k> do beam search with beam size = k
+#<num> set maximum number of steps (counted differently by different search procedures) Note that in greedy hill consider each random restart a step for this count
+q<num> set maximum number of steps without improvement
+s<k> set sparse search with candidate size = k (See Friedman, Nachman & Pe'er, UAI99)
+sc direct sparse search to generate statistics for variable + all candidates at the beginning of iteration. This can reduce the total number of statistics computed (useful within SEM) but dies when the number of candidates is too large
+sI  direct sparse search to use mutual info (or KL to BN predictions) to select candidate parents (called "divergence" in the paper)
+sS direct sparse search to use score to select candidate parents (called "score" in the paper)
+s<searchopt> give options for search within each iteration of the sparse search (e.g., +sg tells sparse search to do greedy HC)
+m MCMC search over structures (not tested recently)
+S Simulated annealing (as described in Heckerman, Geiger & Chikering MLJ 95) use +Sa<alpha> +Sb<beta> +Sc<gamma> +Sd<delta> to set the parameters described there.(Default are 400,200,0.95,120, respectively.)
+a<k> stochastic first-ascent search. Try random moves from the current candidate and apply the first one that leads to improvement in score. Stop when <k> random moves do not lead to improvement.

Incomplete data & Hidden variables

 
-H <no>,<card> add <no> variables of cardinality <card>. These variables are initialized to be the parents of all other variables in the .names file in the initial network
-Hc <no>,<card> Same as -H, except that the hidden variables are also connected among themselves in the initial network
-M p use partial counts to deal with hidden variables. This means that whenever the statistics for X,Y,Z is collected, instances in which one of these variables is missing are ignored. This is a reasonable hack if the data is missing at random, and there are fairly small number of missing values. It fails completely when we consider hidden variables!
-M i iterative EM. Do search, and use EM for each candidate to evaluate it. Very slow!
-M e use SEM for search (See options below)
-M S s<n> use search over candidates, where each candidate is developed by SEM, applies <n> successors to each candidate
-M S r<n> use search over candidates, where each candidate is developed by SEM, applies <n> restatrs of SEM for each candidate

SEM related options

-M I b  use bucket elim in SEM inference (greedy order selection)
-M I B use bucket elim in SEM inference (greedy + search order selection)
-M I o use "infer" library for SEM inference (greedy order selection)
-M I c use "clique" library for SEM inference (greedy order selection)
-M +<opt> pass options for search strategy within SEM
-E C initialize SEM with random chain
-E T initialize SEM with random tree
-E R set hiddens as root in initial structure
-E F initialize SEM with given structure & param (start network or ..
-E P initialize SEM with given structure but randomize parameters (default)
-E M <n> set  maximum SEM iterations
-E A use Alternating Parameteric & Structure steps in SEM (default)
-E S use only structure steps in SEM
-E Q use structure only but do "burn in" for parameters
-E O use score to stop SEM iterations (default uses change in structure)
-E I <n> number of parameteric EM steps within each SEM parameteric phase
-E P <k> number of parallel parameteric EM tried in each parameteric phase
-e Disable "CliqueEM" which precomputes some of the sufficient statistics

Constraints:

-c <constraintfile> specifies a file that specifies constraints on then learned networks

The constraint file consists of a list of constraint. Each constrain is a lisp-like statements. The recognized constraints are:
 
(freeze <Var>) do not change the parents of <Var> and do not include the score of this family in the score of the learned network 
(maxparents <k> <Var>)  <Var> has at most <k> parents
(maxchildren <k> <Var>) <Var> has at most <k> children
(root <Var>) <Var> is a root (has no parents) -- equal to (maxparents 0 <Var>)
(leaf <Var>) <Var> is a leaf (has no children) -- equal to (maxchildren 0 <Var>)
(before <Var1> <Var2>) <Var1> is earlier in the ordering than <Var2>. Disallow chains from <Var2> to <Var1>
(poss-parents <Var> <Par1> ... <ParN>) the parents of <Var> must be a subset of the listed variables

ScoreNet

Score a nework on the instance file

Usage:
ScoreNet <NetFile> <IFile>

Download: ScoreNet.exe (Linux version)

-MDL MDL scoring metric
-LogProb Log probability of the data given the network
-I Instance by instance log-loss
-X cross entropy from data frequency to net

ComputeBootEst

ComputeBootEst computes the confidence in various features given the output of the bootstrap (see Friedman, Goldszmidt & Wyner, UAI99)

Usage:
ComputeBootEst <option>

Download: ComputeBootEst.exe (Linux version)

The program reads from the standard input a stream of networks (e.g. one can use "type *.net | ComputeBootEst" to compute bootstrap confidence from all the networks in the current directory). The options are:
 
-E compute confidence in (partially directed) edges (default)
-M compute confidence in markov neighborhoods
-O compute confidence in ordering relations in PDAGs
-b assume Bayesian bookstrap. In this case, each network in input is assumed to have a (score <Score>) statement before the actual network. Networks are reweighted according to the score (after equivalent networks are eliminated)