⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frqtab.h

📁 it is tree Dtree algorithm. so see it. it is in c++
💻 H
字号:
/*----------------------------------------------------------------------  File    : frqtab.h  Contents: frequency table management  Author  : Christian Borgelt  History : 23.06.1997 file created            29.07.1997 first version completed            11.08.1997 some functions changed to #define            25.08.1997 functions ft_comb, ft_uncomb, and ft_dest added            24.09.1997 function ft_alldst added            09.02.1998 order of evaluation measures changed            23.02.1999 parameter 'params' added to function ft_eval            30.03.1999 all 'float' fields/variables changed to 'double'            25.10.1999 evaluation measure FEM_WDIFF added            03.12.2000 table access optimized (concerning index -1)            06.12.2000 evaluation function made an option            21.12.2000 functions ft_xcnt and ft_ycnt added            02.03.2001 evaluation measure FEM_INFGBAL added            02.01.2002 measure FEM_SPCGBAL added, FEM_INFGBAL corrected            11.01.2002 measure FEM_CHI2NRM added            02.02.2002 FEM_K2MET etc. replaced by FEM_BDM and FEM_BDMOD            04.02.2002 quadratic information measures added----------------------------------------------------------------------*/#ifndef __FRQTAB__#define __FRQTAB__#include <float.h>/*----------------------------------------------------------------------  Preprocessor Definitions----------------------------------------------------------------------*/#ifdef FT_EVAL/* --- evaluation measures --- */#define FEM_NONE      0         /* no measure */#define FEM_INFGAIN   1         /* information gain */#define FEM_INFGBAL   2         /* balanced information gain */#define FEM_INFGR     3         /* information gain ratio */#define FEM_INFSGR1   4         /* sym. information gain ratio 1 */#define FEM_INFSGR2   5         /* sym. information gain ratio 2 */#define FEM_QIGAIN    6         /* quadratic information gain */#define FEM_QIGBAL    7         /* balanced quad. information gain */#define FEM_QIGR      8         /* quadratic information gain ratio */#define FEM_QISGR1    9         /* sym. quad. info. gain ratio */#define FEM_QISGR2   10         /* sym. quad. info. gain ratio */#define FEM_GINI     11         /* gini index */#define FEM_GINISYM  12         /* symmetric gini index */#define FEM_GINIMOD  13         /* modified gini index */#define FEM_RELIEF   14         /* relief measure */#define FEM_WDIFF    15         /* sum of weighted differences */#define FEM_CHI2     16         /* chi^2 measure */#define FEM_CHI2NRM  17         /* chi^2 measure */#define FEM_WEVID    18         /* weight of evidence */#define FEM_RELEV    19         /* relevance */#define FEM_BDM      20         /* Bayesian-Dirichlet / K2 metric */#define FEM_BDMOD    21         /* modified BD / K2 metric */#define FEM_RDLREL   22         /* red. of desc. length (rel. freq.) */#define FEM_RDLABS   23         /* red. of desc. length (abs. freq.) */#define FEM_STOCO    24         /* stochastic complexity */#define FEM_SPCGAIN  25         /* specificity gain */#define FEM_SPCGBAL  26         /* balanced specificity gain */#define FEM_SPCGR    27         /* specificity gain ratio */#define FEM_SPCSGR1  28         /* sym. specificity gain ratio 1 */#define FEM_SPCSGR2  29         /* sym. specificity gain ratio 2 */#define FEM_UNKNOWN  30         /* unknown measure *//* --- evaluation flags --- */#define FEF_WGTD     0x8000     /* weight with frac. of known values */#endif/*----------------------------------------------------------------------  Type Definitions----------------------------------------------------------------------*/typedef struct {                /* --- frequency table --- */  int    xsize, ysize;          /* size of table (columns/lines) */  int    xcnt,  ycnt;           /* current number of columns/lines */  int    *dsts;                 /* destinations of combined columns */  double *buf_x;                /* buffer for internal use */  double *buf_y;                /* ditto */  double *buf_xy;               /* ditto */  double known;                 /* number of cases with a known value */  double frq;                   /* total number of cases */  double *frq_x;                /* marginal x frequencies */  double *frq_y;                /* marginal y frequencies */  double *frq_xy[1];            /* table of joint frequencies */} FRQTAB;                       /* (frequency table) *//*----------------------------------------------------------------------  Functions----------------------------------------------------------------------*/extern FRQTAB* ft_create (int xsize, int ysize);extern void    ft_delete (FRQTAB *ftab);extern int     ft_init   (FRQTAB *ftab, int xcnt, int ycnt);extern void    ft_copy   (FRQTAB *dst, const FRQTAB *src);extern void    ft_set    (FRQTAB *ftab, int x, int y, double frq);extern void    ft_add    (FRQTAB *ftab, int x, int y, double frq);extern void    ft_marg   (FRQTAB *ftab);extern void    ft_addwm  (FRQTAB *ftab, int x, int y, double frq);extern void    ft_move   (FRQTAB *ftab, int xsrc, int xdst, int y,                          double frq);extern void    ft_comb   (FRQTAB *ftab, int xsrc, int xdst);extern void    ft_uncomb (FRQTAB *ftab, int xsrc);extern int     ft_dest   (FRQTAB *ftab, int x);extern void    ft_alldst (FRQTAB *ftab, int *dsts);extern int     ft_xcnt   (FRQTAB *ftab);extern int     ft_ycnt   (FRQTAB *ftab);extern double  ft_frq_xy (FRQTAB *ftab, int x, int y);extern double  ft_frq_x  (FRQTAB *ftab, int x);extern double  ft_frq_y  (FRQTAB *ftab, int y);extern double  ft_frq    (FRQTAB *ftab);extern double  ft_known  (FRQTAB *ftab);#ifdef FT_EVALextern double  ft_eval   (FRQTAB *ftab, int measure, double *params);extern const char* ft_mname (int measure);#endif#ifndef NDEBUGextern void    ft_show   (FRQTAB *ftab);#endif/*----------------------------------------------------------------------  Preprocessor Definitions----------------------------------------------------------------------*/#define ft_set(t,x,y,f)  ((t)->frq_xy[(x)+1][y]  = (f))#define ft_add(t,x,y,f)  ((t)->frq_xy[(x)+1][y] += (f))#define ft_xcnt(t)       ((t)->xcnt)#define ft_ycnt(t)       ((t)->ycnt)#define ft_frq_x(t,x)    ((t)->frq_x [x])#define ft_frq_y(t,y)    ((t)->frq_y [y])#define ft_frq_xy(t,x,y) ((t)->frq_xy[(x)+1][y])#define ft_frq(t)        ((t)->frq)#define ft_known(t)      ((t)->known)#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -