File: bayesol.h

package info (click to toggle)
dbacl 1.12-2.2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 3,740 kB
  • sloc: ansic: 16,594; sh: 7,963; makefile: 244; yacc: 167; lex: 78; awk: 24; xml: 17; perl: 8
file content (85 lines) | stat: -rw-r--r-- 2,021 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* 
 * Copyright (C) 2002 Laird Breyer
 *  
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 * 
 * Author:   Laird Breyer <laird@lbreyer.com>
 */

#ifndef BAYESOL_H
#define BAYESOL_H

#ifdef HAVE_CONFIG_H
#undef HAVE_CONFIG_H
#include "config.h"
#endif

#include <sys/types.h>
#include <regex.h>

#include "dbacl.h"

typedef double real_value_t;
typedef u_int8_t submatch_order_t;

#define BUFLEN ((charbuf_len_t)1024)

/* options */
#define OPTION_RISKSPEC     1
#define OPTION_SCORES       4
#define OPTION_VERBOSE      5
#define INPUT_FROM_CMDLINE  6
#define OPTION_FILTER       10
#define OPTION_DEBUG        15
#define OPTION_I18N         16
#define OPTION_SCORES_EX    17

/* when the ratio of complexities is below this value, flag a problem */
#define MEANINGLESS_THRESHOLD 0.9

/* macros */

/* data structures */

typedef struct lvec {
  char *re;
  char *ve;
  bool_t found;
  struct lvec *next;
  real_value_t sm[MAX_SUBMATCH];
} LossVector;

typedef struct regm {
  regex_t reg;

  LossVector *lv;
  struct regm *next;
} RegMatch;

typedef struct {
  category_count_t num_cats;
  category_count_t num_priors;
  char* catname[MAX_CAT];
  real_value_t prior[MAX_CAT];
  LossVector* loss_list[MAX_CAT];
  RegMatch *regs;
  real_value_t cross_entropy[MAX_CAT];
  real_value_t complexity[MAX_CAT];
  real_value_t loss_matrix[MAX_CAT][MAX_CAT];
} Spec;



#endif