📄 nposs.h
字号:
/*---------------------------------------------------------------------- File : nposs.h Contents: Naive possibilistic classifier management Author : Christian Borgelt History : 07.02.2001 file created from file nbayes.h 17.07.2001 adapted to modified module scan 12.08.2004 adapted to new module parse----------------------------------------------------------------------*/#ifndef __NPOSS__#define __NPOSS__#ifdef NPC_PARSE#include "parse.h"#endif#include "table.h"/*---------------------------------------------------------------------- Preprocessor Definitions----------------------------------------------------------------------*//* --- induction modes --- */#define NPC_DUPAS 0x0002 /* duplicate attribute set */#define NPC_ADD 0x0004 /* greedily add attributes */#define NPC_REMOVE 0x0008 /* greedily remove attributes *//* --- description modes --- */#define NPC_TITLE 0x0001 /* print a title (as a comment) */#define NPC_POSS 0x0002 /* print degrees of possibility *//*---------------------------------------------------------------------- Type Definitions----------------------------------------------------------------------*/typedef struct { /* --- possibility distribution --- */ double *frqs; /* value frequency vector */ double *poss; /* value possibility vector */} POSSD; /* (possibility distribution) */typedef struct { /* --- distribution vector --- */ int mark; /* whether read or to be processed */ int type; /* attribute type (0: class) */ int valcnt; /* number of attribute values */ POSSD *possds; /* vector of poss. distributions */} DVEC; /* (distribution vector) */typedef struct { /* --- naive poss. classifier --- */ ATTSET *attset; /* underlying attribute set */ int attcnt; /* number of attributes */ int clsid; /* identifier of class attribute */ int clscnt; /* number of classes */ double total; /* total number of cases */ double *frqs; /* class frequency vector */ double *priors; /* prior class possibilities */ double *posts; /* posterior class possibilities */ double *buf; /* buffer (for internal use) */ DVEC dvecs[1]; /* vector of distribution vectors */} NPC; /* (naive possibilistic classifier) *//*---------------------------------------------------------------------- Functions----------------------------------------------------------------------*/extern NPC* npc_create (ATTSET *attset, int clsid);extern NPC* npc_dup (NPC *npc, int dupas);extern void npc_delete (NPC *npc, int delas);extern void npc_clear (NPC *npc);extern ATTSET* npc_attset (const NPC *npc);extern int npc_attcnt (const NPC *npc);extern int npc_valcnt (const NPC *npc, int attid);extern int npc_clsid (const NPC *npc);extern int npc_clscnt (const NPC *npc);extern double npc_total (const NPC *npc);#ifdef NPC_INDUCEextern int npc_add (NPC *npc, const TUPLE *tpl);extern NPC* npc_induce (TABLE *table, int clsid, int mode);extern int npc_mark (NPC *npc);#endifextern void npc_setup (NPC *npc);extern double npc_prior (const NPC *npc, int clsid);extern double npc_poss (const NPC *npc, int clsid, int attid, int valid);extern int npc_exec (const NPC *npc, const TUPLE *tpl, double *conf);extern int npc_desc (const NPC *npc, FILE *file, int mode, int maxlen);#ifdef NPC_PARSEextern NPC* npc_parse (ATTSET *attset, SCAN *scan);#endif/*---------------------------------------------------------------------- Preprocessor Definitions----------------------------------------------------------------------*/#define npc_attset(p) ((p)->attset)#define npc_attcnt(p) ((p)->attcnt)#define npc_valcnt(p,a) ((p)->dvecs[a].valcnt)#define npc_clsid(p) ((p)->clsid)#define npc_clscnt(p) ((p)->clscnt)#define npc_clsfrq(p,c) ((p)->frqs[c])#define npc_total(p) ((p)->total)#define npc_prior(p,c) ((p)->priors[c])#define npc_prob(p,c,a,v) ((p)->dvecs[a].possds[c].probs[v])#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -