www.pudn.com > AdaBoost_weaklearner_1.rar > Adaboost_common.h
#if !defined(AFX_TEST_H__B678A414_54CC_480B_8068_4FAEED66F002__INCLUDED_) #define AFX_TEST_H__B678A414_54CC_480B_8068_4FAEED66F002__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 /* # define MICROSOFT */ # include# include # include # include # include # include # include # include "matrix.h" # define VERSION "V1.0" # define VERSION_DATE "11.5.03" # define CFLOAT float /* the type of float to use for caching */ /* kernel evaluations. Using float saves */ /* us some memory, but you can use double, too */ # define FNUM long /* the type used for storing feature ids */ # define FVAL float /* the type used for storing feature values */ # define LINEAR 0 /* linear kernel type */ # define POLY 1 /* polynoial kernel type */ typedef struct word { FNUM wnum; FVAL weight; } SVM_WORD; typedef struct doc { long docnum; double twonorm_sq; SVM_WORD *words; } DOC; typedef struct adaboost_parm { } ADABBOST_PARM; typedef struct adaboostResults { //long sv_num; //long at_upper_bound; //double b; DOC **supvec; //double *alpha; //long *index; /* index from docnum to position in model */ long totwords; /* number of features */ long totdoc; /* number of training documents */ //KERNEL_PARM kernel_parm; /* kernel */ /* the following values are not written to file */ //double loo_error,loo_recall,loo_precision; /* leave-one-out estimates */ //double xa_error,xa_recall,xa_precision; /* xi/alpha estimates */ //double *lin_weights; /* weights for linear case using folding */ } RESULTS; afx_msg void OnPaint (); int read_documents(char *, DOC *, long *, long, long, long *, long *); int read_train_file(char *,long,long,long, Matrix*,Matrix*); int read_test_file(char *,long,long,long,Matrix*,Matrix*); int adaBoost(Matrix*,Matrix*,long,long,int,int,Matrix*,Matrix*,Matrix*,double); int weakLearner(Matrix*, Matrix*,Matrix*,Matrix*, Matrix,long,long, int, int*, int*,int,int,double); int getError(Matrix*,Matrix*,Matrix*,Matrix*,Matrix*,Matrix*,Matrix*,Matrix*,Matrix*,long, long,int,int); int parse_dataset(char *, long *, long *, long); int parse_document(char *, DOC *, long *, long *, long); int nol_ll(char *file,long *nol,long *wol,long *ll); long get_runtime(); void *my_malloc(long); void copyright_notice(); void SetInitParam(); int isnan(double); void printe(char* str); void printm(char* str); #endif // !defined(AFX_TEST_H__B678A414_54CC_480B_8068_4FAEED66F002__INCLUDED_)