BAYESOL(1)
๐ BAYESOL(1) โ a Bayes solution calculator for use with dbacl
okay bestie, welcome to bayesol, one of the Bayesian Classification Tools, and honestly? she's a whole vibe. get comfy, we're learning how to make optimal decisions with math. ๐งโจ
โจ SYNOPSIS โจ
bayesol [-DVNniv] -c riskspec [FILE]...
bayesol -V
๐ฆ DESCRIPTION ๐ฆ
So. bayesol is a Bayes solution calculator. Her whole job is iconic: she takes the output of dbacl(1), smooshes it together with a prior distribution and a risk specification, and then calculates the optimal Bayesian decision โ which is the decision that minimizes the posterior risk. no cap, that's the entire personality. ๐
The risk specification gets read from the text file riskspec, and it has to be written in a simple little format described further down (don't worry, we'll get there). And the dbacl(1) output? You can feed it in from FILE, or just pipe it from STDIN. either one, queen's choice. ๐
๐ฅ EXIT STATUS ๐ฅ
On success, bayesol returns a positive integer corresponding to the category with the lowest risk. periodt. ๐
In case of a problem, bayesol returns zero. (yes that's the sad trombone outcome, we don't love her but we respect her.)
๐ OPTIONS ๐
-cโ classify usingriskspec. see the RISK SPECIFICATION section below, that's where the lore lives. ๐-iโ fully internationalized mode. this forces the use of wide characters internally, which is necessary in some locales. the catch? it incurs a noticeable performance penalty. so it's giving "correct but slower" energy. ๐-nโ print risk scores for each category. each score is (approximately) 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 remaining 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 toSTDOUTthe category with minimum posterior risk. in case several categories are possible, prints the first category in the order in which they appear in the categories section ofriskpspec. ๐ฃ๏ธ-Dโ print debug output. do not use. ๐ (she said what she said.)-Vโ print the program version number and exit. short and sweet, we stan. ๐ซถ
๐ธ RISK SPECIFICATION ๐ธ
bayesol needs to read a text file riskspec containing a risk specification. 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]
}
okay so breaking that down, 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 expression. (this is not optional, bestie, it's the rules.) ๐
To construct the actual loss matrix used in the decision calculations, 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 "complexity" is recognized, and converted to the complexity for that category as reported by dbacl(1). finally, if the corresponding regular expression contains submatches delimited by parentheses, their numerical 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. comments must start with a # and extend to the end of the line. (yes, liberal spacing, conservative casing โ she contains multitudes. ๐)
๐ USAGE ๐
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
look at that pipe. beautiful. no notes. ๐ญ๐ฅ
See /nix/store/66jnbrh6haa7grpxg320a4fvkal7irv3-dbacl-1.14/share/dbacl/doc/costs.ps for a description of the algorithm used. see also /nix/store/66jnbrh6haa7grpxg320a4fvkal7irv3-dbacl-1.14/share/dbacl/doc/tutorial.html for a more detailed overview. ๐
โญ SOURCE โญ
the source code for the latest version of this program is available at the following locations:
http://www.lbreyer.com/gpl.html
http://dbacl.sourceforge.net
go off, open source legend. ๐
๐ AUTHOR ๐
Laird A. Breyer <laird@lbreyer.com>
๐ซถ SEE ALSO ๐ซถ
dbacl(1), mailcross(1), mailfoot(1), mailinspect(1), mailtoe(1), regex(7)
that's the whole page, bestie โ go forth and minimize that posterior risk ๐โจ
sign-off szn: this was Version 1.14 of the page, from Bayesian Classification Tools, and it's BAYESOL(1) all the way down. mwah. ๐
๐ฆ where this page comes from
- nixos 26.05: dbacl 1.14
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms