Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
BAYESOL(1)							    BAYESOL(1)

       bayesol - a Bayes solution calculator for use with dbacl.

       bayesol [-DVNniv] -c riskspec [FILE]...

       bayesol -V

       bayesol	is  a Bayes solution calculator	designed to combine the	output
       of dbacl(1) with	a prior	distribution and  a  risk  specification,  and
       calculate  the optimal Bayesian decision	(which minimizes the posterior

       The risk	specification is read from the text file riskspec and must  be
       written in a simple format described below. The dbacl(1)	output can ei-
       ther be read from FILE or from STDIN.

       On success, bayesol returns a positive  integer	corresponding  to  the
       category	 with  the lowest risk.	 In case of a problem, bayesol returns

       -c     Classify using riskspec.	See the	section	RISK SPECIFICATION.

       -i     Fully internationalized mode. Forces the use of wide  characters
	      internally,  which  is  necessary	in some	locales. This incurs a
	      noticeable performance penalty.

       -n     Print risk scores	for each category.  Each  score	 is  (approxi-
	      mately)  the logarithm of	the expected risk under	that category.
	      The lowest score (ie closest to -infinity) is best, etc.

       -N     Print recursive risk scores for each category.   Each  score  is
	      (approximately) the logarithm of the best	score based on the re-
	      maining categories, after	the previously best scoring categories
	      have  been  removed,  and	a normalizing factor was added.	A full
	      description is given in the technical report listed at  the  end
	      of this manpange.	The largest score (ie closest to +infinity) is
	      best, etc.

       -v     Verbose mode. Prints to STDOUT the category with minimum	poste-
	      rior  risk.  In case several categories are possible, prints the
	      first category in	the order in which they	appear	in  the	 cate-
	      gories section of	riskpspec.

       -D     Print debug output. Do not use.

       -V     Print the	program	version	number and exit.

       bayesol needs to	read a text file riskspec containing a risk specifica-
       tion. The format	of this	text file is as	follows

	      categories { cat1, cat2,..., catN}
	      prior { p1, p2,..., pN}
	      loss_matrix {
	      "regex1" c1 [ formula11, formula12,..., formula1N]
	      "regex2" c2 [ formula21, formula22,..., formula2N]
	      "regexM" cM [ formulaM1, formulaM2,..., formulaMN]

       In the above, cat1, cat2,..., catN, are category	names, p1, p2,..., pN,
       are  non-negative  numbers,  regex1,  regex2,..., regexM, are (possibly
       empty) regular expression strings, c1, c2,..., cM, are instances	of the
       category	 names	cat1,  cat2,..., catN, and the formulas	are numbers or
       mathematical expressions.

       Every category which appears in the categories section must  appear  at
       least once in the loss_matrix section, with an empty "" regular expres-
       sion.  To construct the actual loss matrix used in the decision	calcu-
       lations,	bayesol	selects, for each category appearing in	the categories
       section,	the first row whose regular expression is matched within  FILE
       or  STDIN,  or the first	row with empty regular expression if there are
       no matches.

       Each formula can	be either a single number, or an algebraic combination
       of  the	operators  exp(), log(), +, -, *, /, ^ and parentheses (). The
       string "inf" is parsed as the value infinity. Also,  the	 string	 "com-
       plexity"	 is recognized,	and converted to the complexity	for that cate-
       gory as reported	by dbacl(1).  Finally, if  the	corresponding  regular
       expression  contains submatches delimited by parentheses, their numeri-
       cal values can be used inside the formulas as the special variables $1,
       ...,  $9.  Note that submatches which aren't numerical are converted to
       the value zero.

       Case is important. Spaces and newlines can be liberally inserted.  Com-
       ments must start	with a # and extend to the end of the line.

       Typically, bayesol is used together with	dbacl(1).  An invocation looks
       like this:

       % dbacl -c one -c two -c	three sample.txt -vna |	bayesol	-c toy.risk -v

       See /usr/local/share/dbacl/doc/ for a description of the	 algo-
       rithm  used.   See  also	/usr/local/share/dbacl/doc/tutorial.html for a
       more detailed overview.

       The source code for the latest version of this program is available  at
       the following locations:

       Laird A.	Breyer <>

       dbacl(1),   mailcross(1),   mailfoot(1),	  mailinspect(1),  mailtoe(1),

Version	1.14.1		 Bayesian Classification Tools		    BAYESOL(1)


Want to link to this manual page? Use this URL:

home | help