📄 c45types.h
字号:
#ifndef _NEWSTAR_C45TYPES_H_1999_12_23_11_22_55_OLDMOON_
#define _NEWSTAR_C45TYPES_H_1999_12_23_11_22_55_OLDMOON_
//Patched by oldmoon,99-12-23 上午 11:23:58
/*************************************************************************/
/* */
/* Type definitions for C4.5 */
/* ------------------------- */
/* */
/*************************************************************************/
typedef char Boolean, *String, *Set;
typedef int ItemNo; /* data item number */
typedef double ItemCount; /* count of (partial) items */
typedef int ClassNo, /* class number, 0..MaxClass */
DiscrValue; /* discrete attribute value (0 = ?) */
typedef int Attribute; /* attribute number, 0..MaxAtt */
typedef union _attribute_value
{
DiscrValue _discr_val;
double _cont_val;
}AttValue, *Description;
#define CVal(Case,Attribute) Case[Attribute]._cont_val
#define DVal(Case,Attribute) Case[Attribute]._discr_val
#define Class(Case) Case[MaxAtt+1]._discr_val
#define Unknown -999 /* unknown value for continuous attribute */
#define BrDiscr 1 /* node types: branch */
#define ThreshContin 2 /* threshold cut */
#define BrSubset 3 /* subset test */
typedef struct tagTreeRec
{
int NodeType; /* 0=leaf 1=branch 2=cut 3=subset */
ClassNo Leaf; /* most frequent class at this node */
ItemCount Items, /* no of items at this node */
*ClassDist, /* class distribution of items */
Errors; /* no of errors at this node */
Attribute Tested; /* attribute referenced in test */
int Forks; /* number of branches at this node */
double Cut, /* threshold for continuous attribute */
Lower, /* lower limit of soft threshold */
Upper; /* upper limit ditto */
Set *Subset; /* subsets of discrete values */
struct tagTreeRec **Branch; /* Branch[x] = (sub)tree for outcome x */
}TreeRec,*Tree;
#define IGNORE 1 /* special attribute status: do not use */
#define DISCRETE 2 /* ditto: collect values as data read */
typedef int RuleNo; /* rule number */
typedef struct TestRec
{
int NodeType; /* test type (see tree nodes) */
Attribute Tested; /* attribute tested */
int Forks; /* possible branches */
double Cut; /* threshold (if relevant) */
Set *Subset; /* subset (if relevant) */
char Outcome; /* result of test on current item */
}*Test;
typedef struct CondRec
{
Test CondTest; /* test part of condition */
int TestValue; /* specified outcome of test */
}*Condition;
typedef struct ProdRuleRec
{
int Size; /* number of conditions */
Condition *Lhs; /* conditions themselves */
ClassNo Rhs; /* class given by rule */
double Error, /* estimated error rate */
Bits; /* bits to encode rule */
ItemNo Used, /* times rule used */
Incorrect; /* times rule incorrect */
}PR;
typedef struct RuleSetRec
{
PR *SRule; /* rules */
RuleNo SNRules, /* number of rules */
*SRuleIndex; /* ranking of rules */
ClassNo SDefaultClass; /* default class for this ruleset */
}RuleSet;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -