~ubuntu-branches/ubuntu/dapper/dbacl/dapper

« back to all changes in this revision

Viewing changes to man/bayesol.1in

  • Committer: Bazaar Package Importer
  • Author(s): Clint Adams
  • Date: 2005-05-07 12:59:53 UTC
  • Revision ID: james.westby@ubuntu.com-20050507125953-xzy2bwkb2qamglwm
Tags: upstream-1.9
ImportĀ upstreamĀ versionĀ 1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\" t
 
2
.TH BAYESOL 1 "Bayesian Classification Tools" "Version @VERSION@" ""
 
3
.SH NAME
 
4
bayesol \- a Bayes solution calculator for use with dbacl.
 
5
.SH SYNOPSIS
 
6
.HP
 
7
.B bayesol
 
8
[-DVNniv] -c 
 
9
.I riskspec
 
10
[FILE]...
 
11
.HP
 
12
.B bayesol
 
13
-V
 
14
.SH DESCRIPTION
 
15
.PP
 
16
.B bayesol
 
17
is a Bayes solution calculator designed to combine the output of 
 
18
.BR dbacl (1) 
 
19
with a prior distribution and a risk specification, and
 
20
calculate the optimal Bayesian decision (which minimizes the posterior
 
21
risk). 
 
22
.PP
 
23
The risk specification is read from the text file 
 
24
.I riskspec 
 
25
and must be written in a simple format described below. The 
 
26
.BR dbacl (1) 
 
27
output can either be read from FILE or from STDIN. 
 
28
.SH EXIT STATUS
 
29
On success, 
 
30
.B bayesol
 
31
returns a positive integer corresponding to the category with the lowest risk.
 
32
In case of a problem, 
 
33
.B bayesol
 
34
returns zero.
 
35
.SH OPTIONS
 
36
.IP -c
 
37
Classify using 
 
38
.IR riskspec . 
 
39
See the section RISK SPECIFICATION.
 
40
.IP -i
 
41
Fully internationalized mode. Forces the use of wide characters internally,
 
42
which is necessary in some locales. This incurs a noticeable performance penalty.
 
43
.IP -n
 
44
Print risk scores for each 
 
45
.IR category . 
 
46
Each score is (approximately) the logarithm of the expected risk under that category. The lowest score (ie closest to -infinity) is best, etc.
 
47
.IP -N
 
48
Print recursive risk scores for each 
 
49
.IR category . 
 
50
Each score is (approximately) the logarithm of the best score based on
 
51
the remaining categories, after the previously best scoring categories
 
52
have been removed, and a normalizing factor was added. A full
 
53
description is given in the technical report listed at the end of this
 
54
manpange. The largest score (ie closest to +infinity) is best, etc.
 
55
.IP -v
 
56
Verbose mode. Prints to STDOUT the category with minimum posterior risk.
 
57
In case several categories are possible, 
 
58
prints the first category in the order in which they appear
 
59
in the categories section of 
 
60
.IR riskpspec .
 
61
.IP -D
 
62
Print debug output. Do not use.
 
63
.IP -V
 
64
Print the program version number and exit. 
 
65
.SH RISK SPECIFICATION
 
66
.B bayesol
 
67
needs to read a text file 
 
68
.I riskspec
 
69
containing a risk specification. The format of this text file is as follows
 
70
.IP
 
71
.na
 
72
categories { 
 
73
.IR cat1 , 
 
74
.IR cat2 , "" ..., 
 
75
.IR catN }
 
76
.br
 
77
prior { 
 
78
.IR p1 , 
 
79
.IR p2 , "" ..., 
 
80
.IR pN }
 
81
.br
 
82
loss_matrix {
 
83
.br
 
84
"\fIregex1\fR" \fIc1\fR [ 
 
85
.IR formula11 ,
 
86
.IR formula12 , "" ...,
 
87
.IR formula1N ]
 
88
.br
 
89
"\fIregex2\fR" \fIc2\fR [ 
 
90
.IR formula21 ,
 
91
.IR formula22 , "" ...,
 
92
.IR formula2N ]
 
93
.br 
 
94
 .
 
95
.br
 
96
 .
 
97
.br
 
98
"\fIregexM\fR" \fIcM\fR [ 
 
99
.IR formulaM1 , 
 
100
.IR formulaM2 , "" ..., 
 
101
.IR formulaMN ]
 
102
.br
 
103
}
 
104
.br
 
105
.ad
 
106
.PP
 
107
In the above, 
 
108
.IR cat1 ,
 
109
.IR cat2 , "" ..., 
 
110
.IR catN , 
 
111
are category names, 
 
112
.IR p1 ,
 
113
.IR p2 , "" ...,
 
114
.IR pN ,
 
115
are non-negative numbers, 
 
116
.IR regex1 ,
 
117
.IR regex2 , "" ...,
 
118
.IR regexM ,
 
119
are (possibly empty) regular expression strings, 
 
120
.IR c1 ,  
 
121
.IR c2 , "" ...,
 
122
.IR cM ,
 
123
are instances of the category names 
 
124
.IR cat1 ,
 
125
.IR cat2 , "" ...,
 
126
.IR catN , 
 
127
and the formulas are numbers or mathematical expressions. 
 
128
.PP
 
129
Every category which appears in the categories section must appear at least
 
130
once in the loss_matrix section, with an empty "" regular expression.
 
131
To construct the actual loss matrix used in the decision calculations, 
 
132
.B bayesol 
 
133
selects, for each category appearing in the categories section,
 
134
the first row whose regular expression is matched
 
135
within FILE or STDIN, or the first row with empty regular expression if there
 
136
are no matches.
 
137
.PP
 
138
Each formula can be either a single number, or an algebraic combination of
 
139
the operators exp(), log(), +, -, *, /, ^ and parentheses (). The string "inf"
 
140
is parsed as the value infinity. Also, the 
 
141
string "complexity" is recognized, and converted to the complexity for 
 
142
that category 
 
143
as reported by 
 
144
.BR dbacl (1).
 
145
Finally, if the 
 
146
corresponding regular expression contains submatches delimited by parentheses, 
 
147
their numerical values can be used inside the formulas as the special variables
 
148
$1, ..., $9. Note that submatches which aren't numerical are converted to the value zero.
 
149
.PP
 
150
Case is important. Spaces and newlines can be liberally inserted. Comments 
 
151
must start with a # and extend to the end of the line. 
 
152
.SH USAGE
 
153
.PP
 
154
Typically, 
 
155
.B bayesol 
 
156
is used together with 
 
157
.BR dbacl (1). 
 
158
An invocation looks like this:
 
159
.PP
 
160
.na
 
161
% dbacl -c one -c two -c three sample.txt -vna | bayesol -c toy.risk -v
 
162
.ad
 
163
.PP
 
164
See @PKGDATADIR@/doc/costs.ps for a description of the algorithm used.
 
165
See also
 
166
@PKGDATADIR@/doc/tutorial.html for a more detailed overview.
 
167
.SH SOURCE
 
168
.PP
 
169
The source code for the latest version of this program is available at the
 
170
following locations: 
 
171
.PP
 
172
.na
 
173
http://www.lbreyer.com/gpl.html
 
174
.br
 
175
http://dbacl.sourceforge.net
 
176
.ad
 
177
.SH AUTHOR
 
178
.PP
 
179
Laird A. Breyer <laird@lbreyer.com>
 
180
.SH SEE ALSO
 
181
.PP
 
182
.BR dbacl (1), 
 
183
.BR mailcross (1),
 
184
.BR mailfoot (1),
 
185
.BR mailinspect (1),
 
186
.BR mailtoe (1),
 
187
.BR regex (7)
 
188