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

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

?? cluster.c

?? 隱馬爾科夫模型工具箱
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* Return the number of classes used by default (or currently set) */int classes_get_default(void){   return N;}/* Set the number of classes used */void classes_set_number(int numb){   if (clCnt) {      HError(17099, "classes_set_number: must be called prior to initialisation");   }   if (numb<1) {      HError(17099, "classes_set_number: number of classes must be 1 or more");   }      N = numb;}/* Initialise this module */void classes_init(int numb_words){   int i, j;   if (W>0 && W!=numb_words) {      /* Could only get here if code to do with loading classmap is broken */      HError(17098, "classes_init: internal inconsistency - number of words has changed");   }   W = numb_words;   /* Create empty storage table */   if (trace & T_MEM) {      printf("Allocating memory for %d classes\n", N);   }   class_sort = CNew(&global_stack, W * sizeof(UInt));   clSum = CNew(&global_stack, N * sizeof(int));   tmp_c1 = CNew(&global_stack, N * sizeof(int));   tmp_c2 = CNew(&global_stack, N * sizeof(int));   tmp_c3 = CNew(&global_stack, N * sizeof(int));   tmp_c4 = CNew(&global_stack, N * sizeof(int));   tmp_sum1 = CNew(&global_stack, N * sizeof(int));   tmp_sum2 = CNew(&global_stack, N * sizeof(int));   mlv = CNew(&global_stack, N * sizeof(double));   sort_uni = CNew(&global_stack, W * sizeof(int));   if (!clMemb)      clMemb = CNew(&global_stack, W * sizeof(int)); /* May have been setup by existing map */   clCnt = CNew(&global_stack, N * sizeof(int *));   for (i=0; i<N; i++) {      clCnt[i] = CNew(&global_stack, N * sizeof(int));   }   if (trace & T_MEM) {      printf("Class memory allocated\n");   }   /* Create array of bigram (w,w) pair counts (ie. word followed by itself) */   bipair = CNew(&global_stack, W * sizeof(int));   for (i=0; i<W; i++) {      bipair[i] = 0;      for (j=0; j<forward[i].size; j++) {         if (forward[i].bi[j].id == i) {            bipair[i] = forward[i].bi[j].count;            break;         }      }   }}/* See what change results when word 'w' moved to class 'g' */static void classes_change(UInt w, int g){   register int i;   /* tmp_c1[] stores the set of class counts C(G(w),*)      tmp_c2[] stores the set of class counts C(*,G(w))      tmp_c3[] stores the set of class counts C(g,*)      tmp_c4[] stores the set of class counts C(*,g)      tmp_sum1[] stores the bigram class counts C(w,*)      tmp_sum2[] stores the bigram class counts C(*,w) */      /* Loop over all classes */   for (i=0; i<N; i++) {      if (i!=curr_class && i!=g) {         if (tmp_sum1[i]) {            /* (G(w),gi) => -C(w,gi) */            tmp_c1[i] = clCnt[curr_class][i] - tmp_sum1[i];            /* (g,gi)    => +C(w,gi) */            tmp_c3[i] = clCnt[g][i] + tmp_sum1[i];         }         else {            tmp_c1[i] = clCnt[curr_class][i];            tmp_c3[i] = clCnt[g][i];         }         if (tmp_sum2[i]) {            /* (gi,G(w)) => -C(gi,w) */            tmp_c2[i] = clCnt[i][curr_class] - tmp_sum2[i];            /* (gi,g)    => +C(gi,w) */            tmp_c4[i] = clCnt[i][g] + tmp_sum2[i];         }         else {            tmp_c2[i] = clCnt[i][curr_class];            tmp_c4[i] = clCnt[i][g];         }      }   }     /* Calculate correct values for class-to-or-from-only pairs */   /* (G(w),G(w)) => -C(w,G(x)) - C(G(x),w) + C(w,w) */   GwGw =   clCnt[curr_class][curr_class]          - tmp_sum1[curr_class] - tmp_sum2[curr_class] + bipair[w];   /* (G(w),g)    => -C(w,g) + C(G(x),w) - C(w,w) */   Gwg  =   clCnt[curr_class][g]          - tmp_sum1[g] + tmp_sum2[curr_class] - bipair[w];   /* (g,G(w))    => -C(g,w) + C(w,G(x)) - C(w,w) */   gGw  =   clCnt[g][curr_class]          - tmp_sum2[g] + tmp_sum1[curr_class] - bipair[w];   /* (g,g)       => +C(w,g) + C(g,w) + C(w,w) */   gg   =   clCnt[g][g]          + tmp_sum1[g] + tmp_sum2[g] + bipair[w];}/* Decide on a class to move word 'w' to. Returns class index. */static int choose_class(UInt w){   register int i;   register int j;   double d;             /* Change in optimisation value */   int uniGx, unig;   int best_class;   double best_change;   double start_value;      best_class = curr_class;   best_change = 0;   /* Create set of forward bigram class counts, C(w,*) and C(*,w)      (for * = any class) */   for (i=0; i<N; i++) {      tmp_sum1[i] = 0;      tmp_sum2[i] = 0;   }   for (i=0; i<forward[w].size; i++) {      tmp_sum1[clMemb[forward[w].bi[i].id]] += forward[w].bi[i].count;   }   for (i=0; i<backward[w].size; i++) {      tmp_sum2[clMemb[backward[w].bi[i].id]] += backward[w].bi[i].count;   }  /* Try all classes */   for (i=start_class; i<N; i++) {      if (i==curr_class || uni[w]==0) {         /* If we have no information about this word, or its a self-move, don't            bother (self-move gives zero change) */         continue;      }      d = 0;      classes_change(w, i);      /* Word has moved to class i, so see how this would change our         optimisation equation */      uniGx = clSum[curr_class] - uni[w];      unig  = clSum[i] + uni[w];      /* Counts involving original class and a new class */      for (j=0; j<N; j++) {         if ((j!=curr_class) && (j!=i)) {            if (tmp_c1[j]) {               d += ((double)tmp_c1[j]) * log(tmp_c1[j]);            }            if (tmp_c2[j]) {               d += ((double)tmp_c2[j]) * log(tmp_c2[j]);            }            if (tmp_c3[j]) {               d += ((double)tmp_c3[j]) * log(tmp_c3[j]);            }            if (tmp_c4[j]) {               d += ((double)tmp_c4[j]) * log(tmp_c4[j]);            }         }      }      /* Unigram part of summation */      if (uniGx) {         d -= 2*(((double)uniGx)*log(uniGx));      }      if (unig) {         d -= 2*(((double)unig)*log(unig));      }      /* Exceptions */      if (GwGw) {         d += ((double)GwGw) * log(GwGw);      }      if (Gwg) {         d += ((double)Gwg) * log(Gwg);      }      if (gGw) {         d += ((double)gGw) * log(gGw);      }      if (gg) {         d += ((double)gg) * log(gg);      }      /* Now make 'd' into a difference: */      start_value = mlv[curr_class] + mlv[i];      /* Subtract off the two values we added twice by using mlv[] */      if (clCnt[curr_class][i])         start_value -= clCnt[curr_class][i]*log(clCnt[curr_class][i]);      if (clCnt[i][curr_class])         start_value -= clCnt[i][curr_class]*log(clCnt[i][curr_class]);      /* And calculate 'd': */      d = d - start_value;      if (verbose && logfile) {         fprintf(logfile, "...moving word %d to class %d from class %d gives %f change\n",                 w, i, curr_class, d);      }      if (d>best_change) {         /* Accuracy check - this is a bit of a dodgy hack for gcc 3 */         sprintf(tmp, "%f", d); /* This will flush d from the higher-precision maths register */         /* No doubt a much faster way of doing this, but never mind */         if (d>best_change) {            if (verbose && logfile) {               fprintf(logfile, "   \\- which is better than the current best\n");            }            best_change = d;            best_class = i;         }         else {            HError(-17059, "Noticed a comparison accuracy difference [you may safely ignore this warning]");         }      }   }   if (show_MLV) {      curr_MLV += best_change;   }   return best_class;}/* Define sort order for word unigrams */static int freq_sort_order(int *in1, int *in2){  return ( (uni[*in1] < uni[*in2]) | (-(uni[*in1] > uni[*in2])));}/* Perform one iteration of the clustering algorithm */static void do_one_iteration(int w_period, int start_word){   UInt w, j, w_index;   int to;   FILE *file;   Boolean pipe_status;   int total_warnings=0;   for (w=0; w<W; w++) {      sort_uni[w] = w;   }   if (sort_order == SORT_FREQ) {      qsort(sort_uni, W, sizeof(int), (int (*) (const void *, const void *)) &freq_sort_order);   }   for (w_index=start_word; w_index<W; w_index++) {      w = sort_uni[w_index];      if (w_period && w%w_period==0) {         /* Write recovery file */         export_classes(1);         sprintf(tmp, "%.150s.recovery", export_prefix);         file = FOpen(tmp, NoOFilter, &pipe_status);         check_file(file, tmp, "do_one_iteration");         fprintf(file, "Clustering automatic recovery status file\n");         fprintf(file, "Clustered up to (excluding) word: %d\n", w_index);         fprintf(file, "Clusters are stored in: %.150s.recovery.cm\n", export_prefix);         fprintf(file, "Keep unknown word token separate: %d\n", unk_sep?1:0);         fprintf(file, "Sort order: %s\n", (sort_order==SORT_WMAP)?"WMAP":"FREQ");         FClose(file, pipe_status);      }      if ((w==start_id) || (w==end_id) || (unk_sep && (w==unk_id))) {         /* We don't want to move this special token, so skip it */         continue;      }      if (uni[w]==0) {         /* Word is in wordlist but not used, so warn */         if (total_warnings<10) {            HError(-17053, "Word '%s' is in word map but not in any gram files", what_is_word(w));         }         else if (total_warnings==10) {            HError(-17053, "Suppressing further word 'x' not in gram file warnings");         }         total_warnings++;         continue;      }      if (logfile) {         if (verbose) {            fprintf(logfile, "...deciding whether/where to move word %d (of %d - %2.2f%% done) [id=%d]\n",                    w_index, W, ((float)w_index/(float)W)*100.0, w);         }         else {            fprintf(logfile, "%d [%d] (%2.2f%%):\t", w_index, w, ((float)w_index/(float)W)*100.0);         }      }      curr_class = clMemb[w]; /* Find out what class word is currently in */      to = choose_class(w);   /* Work out where to move it to */      if (curr_class != to) {         if (logfile) {            if (verbose) {               fprintf(logfile, "...moving word id %d from class %d to class %d\n", w, curr_class, to);            }            else {               fprintf(logfile, "-> %d\n", to);            }            fflush(logfile);         }         classes_change(w, to); /* Calculate new unigram and bigram values */         /* Remove influence of these two classes from MLV values */         for (j=0; j<N; j++) {            if (j!=to && j!=curr_class) {               if (clCnt[to][j])                  mlv[j] -= ((double)clCnt[to][j]) * log(clCnt[to][j]);               if (clCnt[j][to])                  mlv[j] -= ((double)clCnt[j][to]) * log(clCnt[j][to]);               if (clCnt[curr_class][j])                  mlv[j] -= ((double)clCnt[curr_class][j]) * log(clCnt[curr_class][j]);               if (clCnt[j][curr_class])                  mlv[j] -= ((double)clCnt[j][curr_class]) * log(clCnt[j][curr_class]);            }         }         /* Make change permanent */         /* Class map */         clMemb[w] = to;         /* Class unigram counts */         clSum[curr_class] -= uni[w];         clSum[to] += uni[w];         /* Class bigram counts */         for (j=0; j<N; j++) {            if ((j!=curr_class) && (j!=to)) {               /* (Gw, *) */               clCnt[curr_class][j] = tmp_c1[j];               /* (*, Gw) */               clCnt[j][curr_class] = tmp_c2[j];               /* (g, *) */               clCnt[to][j] = tmp_c3[j];               /* (*, g) */               clCnt[j][to] = tmp_c4[j];            }         }         /* Exceptions */         clCnt[curr_class][curr_class] = GwGw;         clCnt[curr_class][to] = Gwg;         clCnt[to][curr_class] = gGw;         clCnt[to][to] = gg;         /* Recalculate maximum-likelihood values involving this class */         mlv[to] = 0;         for (j=0; j<N; j++) {            if (clCnt[to][j])               mlv[to] += ((double)clCnt[to][j]) * log(clCnt[to][j]);            if (to!=j) {               if (clCnt[j][to])                  mlv[to] += ((double)clCnt[j][to]) * log(clCnt[j][to]);            }         }         if (clSum[to])            mlv[to] -= 2*(((double)clSum[to]) * log(clSum[to]));         mlv[curr_class] = 0;         for (j=0; j<N; j++) {            if (clCnt[curr_class][j])               mlv[curr_class] += ((double)clCnt[curr_class][j]) * log(clCnt[curr_class][j]);            if (curr_class!=j) {               if (clCnt[j][curr_class])                  mlv[curr_class] += ((double)clCnt[j][curr_class]) * log(clCnt[j][curr_class]);            }         }         if (clSum[curr_class])            mlv[curr_class] -= 2*(((double)clSum[curr_class]) * log(clSum[curr_class]));         /* Update MLV values for other classes */         for (j=0; j<N; j++)  {            if (j!=to && j!=curr_class) {               if (clCnt[to][j])                  mlv[j] += ((double)clCnt[to][j]) * log(clCnt[to][j]);               if (clCnt[j][to])                  mlv[j] += ((double)clCnt[j][to]) * log(clCnt[j][to]);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
18涩涩午夜精品.www| 91精品欧美综合在线观看最新| 久久久99精品久久| 国产成人精品一区二区三区四区| 久久一夜天堂av一区二区三区 | 日韩一区二区三区精品视频 | 免播放器亚洲一区| 久久综合给合久久狠狠狠97色69| 国产精品一线二线三线| 国产精品久久久久久妇女6080| 91美女片黄在线观看| 亚州成人在线电影| 26uuu欧美日本| 成人动漫一区二区三区| 亚洲一区中文日韩| 欧美成人乱码一区二区三区| 国产一区在线精品| 亚洲欧美一区二区三区国产精品 | 午夜精品国产更新| 精品国产91久久久久久久妲己| 国产激情视频一区二区三区欧美 | 欧美丰满一区二区免费视频| 久久99日本精品| 日韩理论片网站| 日韩欧美国产综合在线一区二区三区| 国产成人8x视频一区二区| 亚洲狼人国产精品| 精品国产青草久久久久福利| 色婷婷国产精品综合在线观看| 日韩av在线播放中文字幕| 国产三区在线成人av| 欧美自拍丝袜亚洲| 国产美女一区二区三区| 亚洲综合激情网| 久久久精品综合| 精品视频在线免费观看| 国产精品18久久久久久vr| 一级做a爱片久久| 国产无遮挡一区二区三区毛片日本| 91香蕉视频在线| 国产精品 日产精品 欧美精品| 亚洲h在线观看| 中文字幕一区二区三区在线播放| 欧美一卡2卡3卡4卡| 91麻豆免费在线观看| 国产毛片精品一区| 香蕉加勒比综合久久| 中文字幕中文字幕在线一区| 欧美精品一区二区三区在线| 欧美午夜免费电影| 91丝袜高跟美女视频| 国产成人亚洲综合a∨婷婷| 伦理电影国产精品| 午夜欧美视频在线观看| 亚洲精品欧美专区| 国产精品久久久久久久久免费樱桃| 日韩精品综合一本久道在线视频| 精品视频在线免费观看| 色欧美片视频在线观看| 99re8在线精品视频免费播放| 国产成人免费高清| 国产乱码字幕精品高清av| 蜜桃精品视频在线| 免费精品视频最新在线| 日韩专区中文字幕一区二区| 亚洲1区2区3区4区| 亚洲成人激情综合网| 亚洲福利一区二区三区| 亚洲h在线观看| 五月婷婷久久综合| 日韩综合小视频| 日韩精品色哟哟| 免费高清在线视频一区·| 日本v片在线高清不卡在线观看| 一区二区三区国产| 亚洲综合色网站| 亚洲欧美色一区| 亚洲免费观看在线视频| 亚洲精品视频在线看| 亚洲精品成人a在线观看| 一区二区三区在线观看动漫 | 亚洲国产视频网站| 亚洲一区中文日韩| 午夜精品爽啪视频| 日韩二区在线观看| 麻豆精品一区二区三区| 国产美女精品人人做人人爽| 国产999精品久久久久久绿帽| 高清不卡一二三区| 色综合久久中文字幕| 欧美午夜片在线看| 日韩欧美国产wwwww| 久久先锋影音av| 国产精品成人一区二区艾草| 亚洲欧美在线aaa| 亚洲乱码中文字幕综合| 日韩精品国产欧美| 精品在线播放午夜| 欧美精品第一页| 日韩亚洲欧美成人一区| 亚洲欧美另类小说视频| 亚洲精品你懂的| 亚洲欧美一区二区视频| 666欧美在线视频| 国产成人免费在线| 精品亚洲porn| 蜜桃久久av一区| 国产成人免费高清| 色综合久久66| 欧美一区二区三区影视| 蜜臀久久久99精品久久久久久| 粉嫩aⅴ一区二区三区四区| 欧美大白屁股肥臀xxxxxx| 久久亚洲一区二区三区明星换脸 | 亚洲福利视频一区二区| 久久99精品久久久久久动态图| 成人美女视频在线看| 欧美挠脚心视频网站| 久久久蜜臀国产一区二区| 亚洲综合一区二区三区| 日韩欧美成人一区二区| 亚洲高清不卡在线| 在线观看一区二区精品视频| 欧美一区二区精品久久911| 久久亚洲私人国产精品va媚药| 亚洲一区二区av在线| 国产精品18久久久久久久网站| 欧美日韩国产影片| 国产精品免费久久| 六月婷婷色综合| 在线视频观看一区| 国产欧美日韩在线视频| 免费成人性网站| 欧美亚洲日本国产| 成人免费一区二区三区视频| 激情综合网天天干| 7777女厕盗摄久久久| 亚洲欧美日韩在线| 成人激情免费视频| 精品国产凹凸成av人导航| 亚洲成人av中文| 色八戒一区二区三区| 中文字幕av不卡| 麻豆91精品视频| 欧美日韩成人在线| 一区二区三区不卡在线观看| 成人午夜看片网址| 久久亚洲一区二区三区明星换脸 | 亚洲电影中文字幕在线观看| 99久久免费视频.com| 国产拍欧美日韩视频二区| 另类欧美日韩国产在线| 91精品国产综合久久蜜臀| 亚洲卡通动漫在线| 91女厕偷拍女厕偷拍高清| 欧美极品少妇xxxxⅹ高跟鞋 | 91美女在线观看| 国产精品久久久久7777按摩| 国产精品亚洲视频| 久久综合狠狠综合久久综合88| 蜜臀av一级做a爰片久久| 欧美一区二区精品| 蜜桃久久av一区| 日韩欧美色综合网站| 国产乱色国产精品免费视频| 欧美精品一区二区三区久久久| 日本欧美一区二区三区乱码| 欧美一区二区视频在线观看| 日产国产欧美视频一区精品| 69久久夜色精品国产69蝌蚪网| 亚洲mv在线观看| 91麻豆精品国产91久久久使用方法| 亚洲综合视频在线观看| 欧美日韩国产三级| 日韩在线卡一卡二| 日韩色在线观看| 国产曰批免费观看久久久| 91福利国产精品| 91国内精品野花午夜精品| 日韩你懂的电影在线观看| 久久精品国产色蜜蜜麻豆| 久久久五月婷婷| 成人午夜电影久久影院| 亚洲色图第一区| 欧美三级乱人伦电影| 日韩不卡一二三区| 久久男人中文字幕资源站| 成人免费va视频| 亚洲国产色一区| 日韩精品一区二区三区老鸭窝 | 久久精品视频在线看| jiyouzz国产精品久久| 夜夜嗨av一区二区三区网页| 欧美精品电影在线播放| 国产一区二区网址| 一区二区三区中文字幕在线观看| 欧美人与禽zozo性伦| 国产成人在线网站| 一区二区高清免费观看影视大全| 欧美一区二区三区四区在线观看|