00001 /* Author: Andrew I. Schein -*- c++ -*- */ 00002 00003 #ifndef PERC_H 00004 #define PERC_H 00005 00006 #include "../hash/nps_vocab.h" 00007 #include "../imat/InstMatLoL.h" 00008 #include "../error/error.h" 00009 #include "../bio/bio.h" 00010 00011 /* perc_model_t: the trained model */ 00012 typedef struct { 00013 long nCat; 00014 long nFeat; 00015 bio_t *cat; /* log p(c) */ 00016 bio_t *cat_feat; /* log p(w|c), but with opposite indexing */ 00017 } perc_model_t; 00018 00019 00020 extern const struct Nps_PercModel *Nps_PercModel ; 00021 extern long perc_model_new(long,long); 00022 extern void perc_model_del(perc_model_t *); 00023 extern long perc_classify(perc_model_t *, s8_t *, double *, long); 00024 extern double perc_model_train_pass(struct Nps_PercModel *o, nps_error_t *e,struct nps_InstMatLoL *mat); 00025 extern int perc_model_save(struct Nps_PercModel *,const char*, nps_error_t *err); 00026 // extern perc_model_t* perc_model_load(perc_model_t **, NPS_VOC_T **, 00027 // NPS_VOC_T ** ,const char *, nps_error_t *err); 00028 00029 00030 #endif