亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nposs.c

?? Programs to induce a naive possibilistic classifier (a possibilistic analog of the naive Bayes class
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*----------------------------------------------------------------------  File    : nposs.c  Contents: Naive possibilistic classifier management  Author  : Christian Borgelt  History : 07.02.2001 file created from file nbayes.c            09.02.2001 first version of standalone module completed            15.07.2001 parser improved (global variables removed)            17.07.2001 adapted to modified module scan            12.08.2004 adapted to new module parse----------------------------------------------------------------------*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <assert.h>#ifndef TAB_OPC#define TAB_OPC#endif#include "nposs.h"#ifdef STORAGE#include "storage.h"#endif/*----------------------------------------------------------------------  Type Definitions----------------------------------------------------------------------*/typedef struct {                /* --- selectable attribute --- */  int    attid;                 /* attribute identifier */  double errs;                  /* number of misclassifications */} SELATT;                       /* (selectable attribute) *//*----------------------------------------------------------------------  Auxiliary Functions----------------------------------------------------------------------*/#ifdef NPC_INDUCEstatic int _induce (NPC *npc, TABLE *table){                               /* --- induce a poss. classifier */  int    i, k, n;               /* loop variables, buffer */  int    clsid;                 /* index of the class attribute */  int    cls;                   /* value of the class attribute */  TABLE  *opc;                  /* table of one point coverages */  ATTSET *sel;                  /* current selection of attributes */  TUPLE  *tpl;                  /* to traverse the tuples */  DVEC   *dvec;                 /* to traverse the distrib. vectors */  POSSD  *dist;                 /* to traverse the distributions */  double *p;                    /* to traverse the poss. degrees */  float  wgt;                   /* buffer for tuple weight */  assert(npc && table);         /* check the function arguments */  /* --- determine one point coverages --- */  sel = as_create("opc", att_delete);  if (!sel) return -1;          /* create a table for the */  opc = tab_create("opc", sel, tpl_delete);  /* one point */  if (!opc) { as_delete(sel); return -1; }   /* coverages */  if (tab_colcopy(opc, table, TAB_MARKED) != 0) {    tab_delete(opc, 1); return -1; }  tab_reduce(opc);              /* determine one point coverages */  if (tab_opc(opc, TAB_COND) != 0) {      /* for the subspace of */    tab_delete(opc, 1); return -1; }      /* the sel. attributes */  for (clsid = as_attcnt(sel); --clsid >= 0; )    if (att_getmark(as_att(sel, clsid)) == npc->clsid)      break;                    /* find the index of the class */  assert(clsid >= 0);           /* attribute in the o.p.c. table */  /* --- build the classifier --- */  npc_clear(npc);               /* clear the classifier */  npc->total = tab_getwgt(table, 0, INT_MAX);  for (n = tab_tplcnt(opc); --n >= 0; ) {    tpl = tab_tpl(opc, n);      /* traverse the one point coverages */    cls = tpl_colval(tpl, clsid)->i;    if (cls < 0) continue;      /* skip tuples with an unknown class */    assert(cls < npc->clscnt);  /* check the class value */    wgt = tpl_getwgt(tpl);      /* get the tuple weight */    for (i = as_attcnt(sel); --i >= 0; ) {      if (i == clsid) {         /* traverse all attributes */        p = npc->frqs +cls;     /* if this is the class attribute, */        if (wgt > *p) *p = wgt; /* update the maximum projection */        continue;               /* and continue with the next att. */      }      dvec = npc->dvecs +att_getmark(as_att(sel, i));      dist = dvec->possds +cls; /* get the class spec. distribution */      k = tpl_colval(tpl,i)->i; /* get the current attribute's value */      assert(k < dvec->valcnt); /* and check it */      if (k >= 0) {             /* if the attribute value is known, */        p = dist->frqs +k;      /* process this value */        if (wgt > *p) *p = wgt; }      else {                    /* otherwise traverse all values */        for (p = dist->frqs +(k = dvec->valcnt); --k >= 0; )          if (wgt > *--p) *p = wgt;      }                         /* (update the maximum projection */    }                           /* to the subspace scaffolded by */  }                             /* the class and the attribute) */  /* --- clean up --- */  tab_delete(opc, 1);           /* delete the one point coverages */  return 0;                     /* return `ok' */}  /* _induce() *//*--------------------------------------------------------------------*/static int _eval (NPC *npc, TABLE *table, int mode,                  SELATT *savec, int cnt){                               /* --- evaluate selectable attributes */  int    i, k;                  /* loop variables */  int    cls;                   /* predicted class */  ATT    *att;                  /* to traverse the attributes */  SELATT *sa;                   /* to traverse the selectable atts. */  TUPLE  *tpl;                  /* to traverse the tuples */  assert(npc && table && savec  /* check the function arguments */     && (cnt > 0) && (mode & (NPC_ADD|NPC_REMOVE)));  for (sa = savec +(i = cnt); --i >= 0; ) {    --sa;                       /* traverse the selectable attributes */    npc->dvecs[sa->attid].mark = k = (mode & NPC_ADD) ? sa->attid : -1;    att = as_att(npc->attset, sa->attid);    att_setmark(att, k);        /* mark/unmark the next attribute */    if (_induce(npc, table) != 0)      return -1;                /* induce a possibilistic classifier */    npc_setup(npc);             /* and set it up for execution */    for (k = tab_tplcnt(table); --k >= 0; ) {      tpl = tab_tpl(table, k);  /* traverse the original tuples */      cls = tpl_colval(tpl, npc->clsid)->i;      if (cls < 0) continue;    /* skip tuples with an unknown class */      if (npc_exec(npc, tpl, NULL) != cls)        sa->errs += tpl_getwgt(tpl);    }                           /* count the number of misclassific. */    npc->dvecs[sa->attid].mark = k = (mode & NPC_ADD) ? -1 : sa->attid;    att_setmark(att, k);        /* restore the attribute mark */  }                             /* (restore old set of attributes) */  return 0;                     /* return 'ok' */}  /* _eval() */#endif/*----------------------------------------------------------------------  Functions----------------------------------------------------------------------*/NPC* npc_create (ATTSET *attset, int clsid){                               /* --- create a naive poss. class. */  int    i, k, n;               /* loop variables */  NPC    *npc;                  /* created possibilistic classifier */  ATT    *att;                  /* to traverse the attributes */  DVEC   *dvec;                 /* to traverse the distrib. vectors */  POSSD  *pd;                   /* to traverse the poss. distribs. */  double *frq;                  /* to traverse the frequency vectors */  assert(attset && (clsid >= 0) /* check the function arguments */      && (clsid < as_attcnt(attset))      && (att_type(as_att(attset, clsid)) == AT_SYM));  i   = as_attcnt(attset);      /* get the number of attributes */  npc = (NPC*)malloc(sizeof(NPC) +(i-1) *sizeof(DVEC));  if (!npc) return NULL;        /* allocate the classifier body */  for (dvec = npc->dvecs +(k = i); --k >= 0; )    (--dvec)->possds = NULL;    /* clear the distribution vectors */  npc->attset = attset;         /* (for a proper clean up on error) */  npc->attcnt = i;              /* and initialize the other fields */  npc->clsid  = clsid;  npc->clscnt = att_valcnt(as_att(attset, clsid));  npc->total  = 0;  if (npc->clscnt <= 0) {       /* if there are no classes, */    npc->frqs   =               /* no class vectors are needed */    npc->priors = npc->posts = npc->buf = NULL; }  else {                        /* if there are classes, */    npc->frqs =                 /* allocate class vectors */    frq = (double*)malloc(npc->clscnt *4 *sizeof(double));    if (!frq) { npc_delete(npc, 0); return NULL; }    npc->priors = frq         +npc->clscnt;    npc->posts  = npc->priors +npc->clscnt;    npc->buf    = npc->posts  +npc->clscnt;    for (frq += k = npc->clscnt; --k >= 0; )      *--frq = 0;               /* traverse the frequency vector */  }                             /* and init. the class frequencies */  for (dvec = npc->dvecs +(i = npc->attcnt); --i >= 0; ) {    (--dvec)->mark = -1;        /* traverse and unmark all attributes */    if (i == clsid) {           /* if this is the class attribute, */      dvec->type = 0; continue;}/* clear the type for easier recogn. */    att = as_att(attset, i);    /* get the next attribute */    dvec->type = att_type(att); /* and its type */    if (dvec->type != AT_SYM)   /* skip all attributes */      continue;                 /* that are not symbolic */    dvec->valcnt = att_valcnt(att);    if (npc->clscnt <= 0)       /* if there are no classes, */      continue;                 /* there is nothing else to do */    dvec->possds =              /* create a vector of poss. distribs. */    pd = (POSSD*)calloc(npc->clscnt, sizeof(POSSD));    if (!pd) { npc_delete(npc, 0); return NULL; }    if (dvec->valcnt <= 0)      /* if the attribute has no values, */      continue;                 /* there is nothing else to do */    for (pd += k = npc->clscnt; --k >= 0; ) {      (--pd)->frqs =            /* create a value frequency vector */      frq = (double*)malloc(dvec->valcnt *2 *sizeof(double));      pd->poss = frq +dvec->valcnt;      for (frq += n = dvec->valcnt; --n >= 0; )        *--frq = 0;             /* traverse the frequency vectors */    }                           /* and init. the value frequencies */  }  return npc;                   /* return the created classifier */}  /* npc_create() *//*--------------------------------------------------------------------*/NPC* npc_dup (NPC *npc, int dupas){                               /* --- duplicate a naive poss. class. */  NPC    *dup;                  /* created classifier duplicate */  ATTSET *attset;               /* duplicate of attribute set */  int    i, k, n;               /* loop variables */  DVEC   *dv; const DVEC   *sv; /* to traverse the distrib. vectors */  POSSD  *dd; const POSSD  *sd; /* to traverse the poss. distribs. */  double *df; const double *sf; /* to traverse the frequency vectors */  assert(npc);                  /* check the function argument */  /* --- copy the classifier body --- */  attset = npc->attset;         /* get the attribute set */  if (dupas) {                  /* if the corresp. flag is set, */    attset = as_dup(attset);    /* duplicate the attribute set */    if (!attset) return NULL;   /* of the original classifier, */  }                             /* and then create a classifier */  dup = (NPC*)malloc(sizeof(NPC) +(npc->attcnt-1) *sizeof(DVEC));  if (!dup) { if (dupas) as_delete(attset); return NULL; }  for (dv = dup->dvecs +(i = dup->attcnt); --i >= 0; )    (--dv)->possds = NULL;      /* clear the distribution vectors */  dup->attset = attset;         /* (for a proper clean up on error) */  dup->attcnt = npc->attcnt;    /* and copy the other fields */  dup->clsid  = npc->clsid;  dup->clscnt = npc->clscnt;  dup->total  = npc->total;  /* --- copy the class distributions --- */  if (npc->clscnt <= 0)         /* if there are no classes, */    dup->frqs   =               /* no class vectors are needed */    dup->priors = dup->posts = dup->buf = NULL;  else {                        /* if there are classes, */    dup->frqs =                 /* allocate class vectors */    df = (double*)malloc(dup->clscnt *4 *sizeof(double));    if (!df) { npc_delete(dup, dupas); return NULL; }    dup->priors = dup->frqs   +dup->clscnt;    dup->posts  = dup->priors +dup->clscnt;    dup->buf    = dup->posts  +dup->clscnt;    sf = npc->frqs +2 *dup->clscnt;    for (df += k = 2 *dup->clscnt; --k >= 0; )      *--df = *--sf;            /* traverse the frequency vector */  }                             /* and copy the class frequencies */  sv = npc->dvecs +npc->attcnt; /* get pointers to the */  dv = dup->dvecs +npc->attcnt; /* distribution vectors */  for (i = npc->attcnt; --i >= 0; ) {    --sv; (--dv)->mark = -1;    /* traverse the distribution vectors */    dv->mark   = sv->mark;      /* copy the attribute mark, */    dv->type   = sv->type;      /* the attribute type, */    dv->valcnt = sv->valcnt;    /* the number of attribute values */    if ((sv->type != AT_SYM)    /* if the attribute is not symbolic */    ||  (npc->clscnt <= 0))     /* or if there are no classes, */      continue;                 /* there is nothing else to do */    dv->possds =                /* create a vector of poss. dists. */    dd = (POSSD*)calloc(dup->clscnt, sizeof(POSSD));    if (!dd) { npc_delete(dup, dupas); return NULL; }    if (sv->valcnt <= 0)        /* if the attribute has no values, */      continue;                 /* there is nothing else to do */    sd = sv->possds +npc->clscnt;    for (dd += (k = npc->clscnt); --k >= 0; ) {      --dd; --sd;               /* traverse the poss. distributions */      dd->frqs =                /* create a value frequency vector */      df = (double*)malloc(dv->valcnt *2 *sizeof(double));      if (!df) { npc_delete(dup, dupas); return NULL; }      dd->poss = df +dv->valcnt;      sf = sd->frqs +2 *dv->valcnt;      for (df += n = 2 *dv->valcnt; --n >= 0; )        *--df = *--sf;          /* traverse the frequency vectors */    }                           /* and copy the value frequencies */  }  return dup;                   /* return the created duplicate */}  /* npc_dup() *//*--------------------------------------------------------------------*/void npc_delete (NPC *npc, int delas){                               /* --- delete a naive poss. class. */  int   i, k;                   /* loop variables */  DVEC  *dvec;                  /* to traverse the distrib. vectors */  POSSD *pd;                    /* to traverse the poss. distribs. */  assert(npc);                  /* check the function argument */  for (dvec = npc->dvecs +(i = npc->attcnt); --i >= 0; ) {    if (!(--dvec)->possds)      /* traverse all */      continue;                 /* symbolic attributes */    for (pd = dvec->possds +(k = npc->clscnt); --k >= 0; )      if ((--pd)->frqs) free(pd->frqs);    free(dvec->possds);         /* delete all frequency vectors */  }                             /* and the distribution vectors */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区成人| 大白屁股一区二区视频| 激情伊人五月天久久综合| 99久久777色| 久久综合色婷婷| 丝袜美腿一区二区三区| 99久久国产综合精品女不卡| 欧美一区二区成人| 亚洲一区二区三区小说| 成人aaaa免费全部观看| wwwwww.欧美系列| 日韩电影免费在线看| 91久久精品一区二区| 中文子幕无线码一区tr| 国产原创一区二区| 精品日韩欧美一区二区| 午夜精品福利久久久| 色综合久久久网| 国产精品国产三级国产普通话99| 美美哒免费高清在线观看视频一区二区| www.爱久久.com| 亚洲国产精品v| 国产精品系列在线播放| 欧美一级搡bbbb搡bbbb| 调教+趴+乳夹+国产+精品| 色婷婷激情综合| 亚洲卡通动漫在线| 91福利国产精品| 亚洲一区在线视频| 色噜噜狠狠色综合欧洲selulu| 中文字幕精品一区| 成年人网站91| 亚洲欧洲另类国产综合| www.色综合.com| 亚洲色图欧美偷拍| 在线精品国精品国产尤物884a| 亚洲精品久久久蜜桃| 色婷婷综合久久久中文字幕| 亚洲欧洲精品天堂一级| 99国产精品久久久久久久久久| 中文字幕一区二| 色婷婷一区二区| 日日夜夜精品视频天天综合网| 欧美日韩高清不卡| 开心九九激情九九欧美日韩精美视频电影| 777久久久精品| 国内成人自拍视频| 亚洲国产高清在线| 91久久精品一区二区三| 日韩福利电影在线观看| 精品国内片67194| 不卡一区中文字幕| 亚洲成人tv网| 久久久一区二区三区| 91网站在线播放| 青青草国产精品97视觉盛宴| 久久久久久久久岛国免费| 91在线视频观看| 日韩高清不卡一区二区| 欧美—级在线免费片| 91美女福利视频| 久久99精品一区二区三区 | 中文字幕在线视频一区| 色综合天天天天做夜夜夜夜做| 美女免费视频一区二区| 国产精品久久久久影院老司| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 精品一区二区免费看| 中文一区在线播放| 91精品国产一区二区三区香蕉 | 亚洲www啪成人一区二区麻豆| 日韩欧美aaaaaa| 日本韩国欧美三级| 国产原创一区二区| 亚洲一卡二卡三卡四卡| 久久先锋影音av鲁色资源| 91在线云播放| 国产一区二区三区四区五区美女| 一区二区三区色| 欧美激情一区二区三区不卡| 4438亚洲最大| 日本韩国一区二区| 成人中文字幕合集| 精品一区二区免费看| 亚洲成人免费电影| 《视频一区视频二区| 精品国产伦理网| 欧美日韩成人综合在线一区二区| 懂色av一区二区三区免费观看| 丝袜a∨在线一区二区三区不卡| 中文在线资源观看网站视频免费不卡 | 国产原创一区二区| 日韩精品成人一区二区在线| 亚洲另类春色国产| 亚洲视频资源在线| 国产精品视频免费看| 亚洲精品在线三区| 日韩精品一区二区三区视频播放| 欧美无乱码久久久免费午夜一区 | 久久精品国产99国产| 亚洲一区二区三区四区五区黄| 国产精品夫妻自拍| 日本一区二区三级电影在线观看| 精品国内片67194| 日韩精品影音先锋| 欧美成人一区二区三区在线观看| 欧美精品vⅰdeose4hd| 欧美色图天堂网| 91麻豆免费视频| 91黄色免费看| 在线看日本不卡| 欧美日韩情趣电影| 欧美日韩一二区| 欧美乱熟臀69xxxxxx| 欧美人妇做爰xxxⅹ性高电影| 欧美综合久久久| 欧美男男青年gay1069videost| 在线观看国产精品网站| 欧美性色欧美a在线播放| 色视频欧美一区二区三区| 色综合久久综合网| 欧美日韩色一区| 欧美一区二区大片| 亚洲精品在线网站| 亚洲国产高清在线| 亚洲欧美在线高清| 亚洲自拍偷拍九九九| 性欧美大战久久久久久久久| 日韩不卡在线观看日韩不卡视频| 欧美aaa在线| 国产一区二区毛片| av不卡一区二区三区| 欧美在线制服丝袜| 欧美一区二区精美| 国产欧美视频在线观看| 中文字幕一区二区三区四区| 亚洲尤物视频在线| 久久99久久99小草精品免视看| 国产高清亚洲一区| 色综合久久天天综合网| 91麻豆精品国产自产在线| 久久婷婷国产综合国色天香| 国产精品久久久久桃色tv| 亚洲国产欧美另类丝袜| 久久er99热精品一区二区| 国产电影精品久久禁18| 在线精品观看国产| 久久久久久综合| 亚洲另类一区二区| 精品一区二区三区视频在线观看| 成人av在线观| 日韩精品专区在线影院重磅| 中文字幕电影一区| 日韩不卡一区二区三区| 成人黄色综合网站| 日韩一区二区精品葵司在线| 国产精品女主播av| 日韩精品免费专区| eeuss鲁片一区二区三区在线观看| 欧美日韩情趣电影| 国产精品福利一区| 精品一区二区三区视频在线观看| 色www精品视频在线观看| 久久一日本道色综合| 亚洲国产精品人人做人人爽| 国产成人免费视频网站高清观看视频| 色女孩综合影院| 久久久久9999亚洲精品| 亚洲成av人片在线观看| caoporn国产一区二区| 日韩一区二区三区观看| 一区二区在线免费| 国产宾馆实践打屁股91| 日韩精品一区在线| 日韩精品免费专区| 色婷婷综合五月| 国产精品久久久久9999吃药| 激情综合网av| 日韩一级黄色大片| 亚洲va国产天堂va久久en| thepron国产精品| 久久五月婷婷丁香社区| 蜜臀av性久久久久蜜臀aⅴ四虎| 色系网站成人免费| 日韩久久一区二区| jiyouzz国产精品久久| 国产调教视频一区| 精品在线亚洲视频| 精品国产一二三| 久久机这里只有精品| 91精品国模一区二区三区| 亚洲成年人网站在线观看| 欧洲人成人精品| 亚洲一区二区三区四区不卡| 色婷婷国产精品| 亚洲一区av在线| 欧美美女bb生活片| 日韩高清不卡一区二区| 91麻豆精品国产91久久久久| 丝瓜av网站精品一区二区 |