📄 fbayes.h
字号:
/*---------------------------------------------------------------------- File : fbayes.h Contents: Full Bayes classifier management Author : Christian Borgelt History : 2000.11.10 file created 2000.11.29 first version completed 2001.07.16 adapted to modified module scan 2003.04.26 function fbc_rand added 2004.08.12 adapted to new module parse 2007.03.21 function fbc_post added (posterior prob.)----------------------------------------------------------------------*/#ifndef __FBAYES__#define __FBAYES__#ifdef FBC_PARSE#include "parse.h"#ifndef MVN_PARSE#define MVN_PARSE#endif#endif#include "mvnorm.h"#include "table.h"/*---------------------------------------------------------------------- Preprocessor Definitions----------------------------------------------------------------------*//* --- induction modes --- */#define FBC_CLONE 0x0001 /* clone attribute set */#define FBC_ADD 0x0010 /* greedily add attributes */#define FBC_REMOVE 0x0020 /* greedily remove attributes *//* --- setup/induction modes --- */#define FBC_MAXLLH 0x0080 /* use max. likelihood est. of var. *//* --- description modes --- */#define FBC_TITLE 0x0001 /* print a title (as a comment) */#define FBC_REL 0x0002 /* print relative numbers *//*---------------------------------------------------------------------- Type Definitions----------------------------------------------------------------------*/typedef struct { /* --- attribute identification --- */ int id; /* attribute identifier */ int type; /* attribute type */ ATT *att; /* the attribute itself */} FBCID; /* (attribute identification) */typedef struct { /* --- full Bayes classifier --- */ ATTSET *attset; /* underlying attribute set */ int attcnt; /* number of attributes */ int numcnt; /* number of numeric attributes */ FBCID *numids; /* identifications of numeric atts. */ int clsid; /* identifier of class attribute */ int clsvsz; /* size of class dependent vectors */ int clscnt; /* number of classes */ int mode; /* estimation mode (e.g. FBC_MAXLLH) */ double lcorr; /* Laplace correction */ double total; /* total number of cases */ double *frqs; /* class frequencies */ double *priors; /* prior class probabilities */ double *posts; /* posterior class probabilities */ double *vals; /* vector of attribute values */ MVNORM **mvns; /* multivariate normal distributions */ int flags[1]; /* attribute flags */} FBC; /* (full Bayes classifier) *//*---------------------------------------------------------------------- Functions----------------------------------------------------------------------*/extern FBC* fbc_create (ATTSET *attset, int clsid);extern FBC* fbc_clone (const FBC *fbc, int cloneas);extern void fbc_delete (FBC *fbc, int delas);extern void fbc_clear (FBC *fbc);extern ATTSET* fbc_attset (const FBC *fbc);extern int fbc_attcnt (const FBC *fbc);extern int fbc_numcnt (const FBC *fbc);extern int fbc_clsid (const FBC *fbc);extern int fbc_clscnt (const FBC *fbc);extern double fbc_total (const FBC *fbc);#ifdef FBC_INDUCEextern int fbc_add (FBC *fbc, const TUPLE *tpl);extern FBC* fbc_induce (TABLE *table, int clsid, int mode, double lcorr);extern int fbc_mark (FBC *fbc);#endifextern void fbc_setup (FBC *fbc, int mode, double lcorr);extern double fbc_lcorr (const FBC *fbc);extern int fbc_mode (const FBC *fbc);extern double fbc_prior (const FBC *fbc, int clsid);extern MVNORM* fbc_mvnorm (FBC *fbc, int clsid);extern double fbc_post (const FBC *fbc, int clsid);extern int fbc_exec (FBC *fbc, const TUPLE *tpl, double *conf);extern double* fbc_rand (FBC *fbc, double drand (void));extern int fbc_desc (FBC *fbc, FILE *file, int mode, int maxlen);#ifdef FBC_PARSEextern FBC* fbc_parse (ATTSET *attset, SCAN *scan);#endif/*---------------------------------------------------------------------- Preprocessor Definitions----------------------------------------------------------------------*/#define fbc_attset(b) ((b)->attset)#define fbc_attcnt(b) ((b)->attcnt)#define fbc_numcnt(b) ((b)->numcnt)#define fbc_clsid(b) ((b)->clsid)#define fbc_clscnt(b) ((b)->clscnt)#define fbc_total(b) ((b)->total)#define fbc_lcorr(b) ((b)->lcorr)#define fbc_mode(b) ((b)->mode)#define fbc_prior(b,c) ((b)->priors[c])#define fbc_mvnorm(b,c) ((b)->mvns[c])#define fbc_post(b,c) ((b)->posts[c])#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -