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

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

?? barrel.c

?? 貝葉斯學習算法分類文本。基于樸素貝葉斯分類器的文本分類的通用算法
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* Managing the connection between document-vectors (wi2dvf's) and cdocs   Copyright (C) 1997 Andrew McCallum   Written by:  Andrew Kachites McCallum <mccallum@cs.cmu.edu>   This file is part of the Bag-Of-Words Library, `libbow'.   This library is free software; you can redistribute it and/or   modify it under the terms of the GNU Library General Public License   as published by the Free Software Foundation, version 2.      This library is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   Library General Public License for more details.   You should have received a copy of the GNU Library General Public   License along with this library; if not, write to the Free Software   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */#include <bow/libbow.h>static int _bow_barrel_version = -1;#define BOW_DEFAULT_BARREL_VERSION 3/* Old, deprecated identifiers for methods. *//* Identifiers for methods */typedef enum _bow_method_id {  bow_method_id_tfidf_words,	/* TFIDF/Rocchio */  bow_method_id_tfidf_log_words,  bow_method_id_tfidf_log_occur,  bow_method_id_tfidf_prtfidf,  bow_method_id_naivebayes,	/* Naive Bayes */  bow_method_id_prind,		/* Fuhr's Probabilistic Indexing */  bow_method_id_max} bow_method_id;bow_method* _old_bow_methods[bow_method_id_max] = {  [bow_method_id_tfidf_words] = &bow_method_tfidf_words,  [bow_method_id_tfidf_log_words] = &bow_method_tfidf_log_words,  [bow_method_id_tfidf_log_occur] = &bow_method_tfidf_log_occur,  [bow_method_id_naivebayes] = &bow_method_naivebayes,  [bow_method_id_prind] = &bow_method_prind};/* Create a new, empty `bow_barrel', with cdoc's of size ENTRY_SIZE   and cdoc free function FREE_FUNC.*/bow_barrel *bow_barrel_new (int word_capacity, 		int class_capacity, int entry_size, void (*free_func)()){  bow_barrel *ret;  ret = bow_malloc (sizeof (bow_barrel));  ret->cdocs = bow_array_new (class_capacity, entry_size, free_func);  ret->wi2dvf = bow_wi2dvf_new (word_capacity);  ret->method = (bow_argp_method 		 ? : bow_method_at_name (bow_default_method_name));  return ret;}static void_bow_barrel_cdoc_free (bow_cdoc *cdoc){  if (cdoc->filename)    free ((void*)(cdoc->filename));}/* Add statistics about the document described by CDOC and WV to the   BARREL. */intbow_barrel_add_document (bow_barrel *barrel,			 bow_cdoc *cdoc,			 bow_wv *wv){  int di;  /* Add the CDOC.  (This makes a new copy of CDOC in the array.) */  di = bow_array_append (barrel->cdocs, cdoc);  /* Add the words in WV. */  bow_wi2dvf_add_di_wv (&(barrel->wi2dvf), di, wv);  return di;}/* Add statistics to the barrel BARREL by indexing all the documents   found when recursively decending directory DIRNAME.  Return the number   of additional documents indexed. */intbow_barrel_add_from_text_dir (bow_barrel *barrel, 			      const char *dirname, 			      const char *except_name,			      int class){  int text_file_count, binary_file_count;  int barrel_index_file (const char *filename, void *context)    {      FILE *fp;      bow_cdoc cdoc;      int di;			/* a document index */      /* If the filename matches the exception name, return immediately. */      if (except_name && !strcmp (filename, except_name))	return 0;      if (!(fp = fopen (filename, "r")))	bow_error ("Couldn't open file `%s' for reading.", filename);      if (bow_fp_is_text (fp))	{	  /* The file contains text; snarf the words and put them in	     the WI2DVF map. */	  cdoc.type = model;	  cdoc.class = class;	  cdoc.prior = 1.0f;	  assert (cdoc.class >= 0);	  cdoc.filename = strdup (filename);	  assert (cdoc.filename);	  /* Add the CDOC to CDOCS, and determine the "index" of this             document. */	  di = bow_array_append (barrel->cdocs, &cdoc);	  /* Add all the words in this document. */	  bow_wi2dvf_add_di_text_fp (&(barrel->wi2dvf), di, fp);	  text_file_count++;	}      else	{	  bow_verbosify (bow_progress,			 "\nFile `%s' skipped because not text\n",			 filename);	  binary_file_count++;	}      fclose (fp);      bow_verbosify (bow_progress,		     "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"		     "%6d : %6d", 		     text_file_count, bow_num_words ());      return 1;    }  bow_verbosify (bow_progress,		 "Gathering stats... files : unique-words :: "		 "                 ");  text_file_count = binary_file_count = 0;  bow_map_filenames_from_dir (barrel_index_file, 0, dirname, "");  bow_verbosify (bow_progress, "\n");  if (binary_file_count > text_file_count)    bow_verbosify (bow_quiet,		   "Found mostly binary files, which were ignored.\n");  return text_file_count;}/* Call this on a vector-per-document barrel to set the CDOC->PRIOR's   so that the CDOC->PRIOR's for all documents of the same class sum   to 1. */voidbow_barrel_set_cdoc_priors_to_class_uniform (bow_barrel *barrel){  int *ci2dc;			/* class index 2 document count */  int ci2dc_size = 100;  int ci;  int di;  bow_cdoc *cdoc;  int total_model_docs = 0;  int num_non_zero_ci2dc_entries = 0;    ci2dc = bow_malloc (sizeof (int) * ci2dc_size);  for (ci = 0; ci < ci2dc_size; ci++)    ci2dc[ci] = 0;  for (di = 0; di < barrel->cdocs->length; di++)    {      cdoc = bow_array_entry_at_index (barrel->cdocs, di);      if (cdoc->class >= ci2dc_size)	{	  /* CI2DC must grow to accommodate larger "class index" */	  int old_size = ci2dc_size;	  ci2dc_size *= 2;	  ci2dc = bow_realloc (ci2dc, sizeof (int) * ci2dc_size);	  for ( ; old_size < ci2dc_size; old_size++)	    ci2dc[old_size] = 0;	}      if (cdoc->type == model)	{	  if (ci2dc[cdoc->class] == 0)	    num_non_zero_ci2dc_entries++;	  ci2dc[cdoc->class]++;	  total_model_docs++;	}    }  for (di = 0; di < barrel->cdocs->length; di++)    {      cdoc = bow_array_entry_at_index (barrel->cdocs, di);      if (cdoc->type == model)	{	  cdoc->prior = (1.0 /			 (num_non_zero_ci2dc_entries * ci2dc[cdoc->class]));	  assert (cdoc->prior >= 0);	}    }#if 0  fprintf (stderr, "Infogain post-prior-setting\n");  bow_infogain_per_wi_print (stderr, barrel, num_non_zero_ci2dc_entries, 5);#endif  /* Do some sanity checks. */  {    float prior_total = 0;    for (di = 0; di < barrel->cdocs->length; di++)      {	cdoc = bow_array_entry_at_index (barrel->cdocs, di);	if (cdoc->type == model)	  prior_total += cdoc->prior;      }    assert (prior_total < 1.1 && prior_total > 0.9);  }  free (ci2dc);}/* Modify the BARREL by removing those entries for words that are not   in the int/str mapping MAP. */voidbow_barrel_prune_words_not_in_map (bow_barrel *barrel,				   bow_int4str *map){  int wi;  int max_wi = MIN (barrel->wi2dvf->size, bow_num_words());    assert (max_wi);  /* For each word in MAP. */  for (wi = 0; wi < max_wi; wi++)    {      if (bow_str2int_no_add (map, bow_int2word (wi)) == -1)	{	  /* Word WI is not in MAP.  Remove it from the BARREL. */	  bow_wi2dvf_remove_wi (barrel->wi2dvf, wi);	}    }}/* Modify the BARREL by removing those entries for words that are not   among the NUM_WORDS_TO_KEEP top words, by information gain.  This   function is similar to BOW_WORDS_KEEP_TOP_BY_INFOGAIN(), but this   one doesn't change the word-int mapping. */voidbow_barrel_keep_top_words_by_infogain (int num_words_to_keep, 				       bow_barrel *barrel, int num_classes){  float *wi2ig;  int wi2ig_size;  int wi, i;  struct wiig_list_entry {    float ig;    int wi;  } *wiig_list;  /* For sorting the above entries. */  int compare_wiig_list_entry (const void *e1, const void *e2)    {      if (((struct wiig_list_entry*)e1)->ig >	  ((struct wiig_list_entry*)e2)->ig)	return -1;      else if (((struct wiig_list_entry*)e1)->ig ==	  ((struct wiig_list_entry*)e2)->ig)	return 0;      else return 1;    }  if (num_words_to_keep == 0)    return;  /* Unhide "document vectors" for all WI's */  bow_wi2dvf_unhide_all_wi (barrel->wi2dvf);  /* Get the information gain of all the words. */  wi2ig = bow_infogain_per_wi_new (barrel, num_classes, &wi2ig_size);  /* Make a list of the info gain numbers paired with their WI's,     in prepartion for sorting. */  wiig_list = alloca (sizeof (struct wiig_list_entry) * wi2ig_size);  for (wi = 0; wi < wi2ig_size; wi++)    {      wiig_list[wi].wi = wi;      wiig_list[wi].ig = wi2ig[wi];    }  /* Sort the list */  qsort (wiig_list, wi2ig_size, sizeof (struct wiig_list_entry), 	 compare_wiig_list_entry);#if 1  for (i = 0; i < 5; i++)    fprintf (stderr,	     "%20.10f %s\n", wiig_list[i].ig, bow_int2word (wiig_list[i].wi));#endif  bow_verbosify (bow_progress, 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99精品热视频| 亚洲成人av中文| 国产视频一区二区在线| 久久精品久久综合| 亚洲精品日韩一| 久久久青草青青国产亚洲免观| 色成年激情久久综合| 欧美日韩精品一二三区| 青娱乐精品视频在线| 精品国产一区二区三区久久久蜜月| 久久机这里只有精品| 欧美—级在线免费片| 色婷婷av久久久久久久| 五月天久久比比资源色| 日韩欧美一区二区久久婷婷| 国产成人综合在线观看| 亚洲欧美另类久久久精品2019| 欧美日韩另类一区| 激情综合色播激情啊| **性色生活片久久毛片| 欧美美女黄视频| 国产91丝袜在线观看| 亚洲一线二线三线久久久| 婷婷开心久久网| 亚洲最色的网站| 福利一区福利二区| 亚洲成人午夜电影| 久久一区二区三区四区| 在线精品观看国产| 国产在线精品不卡| 一区二区三区欧美| 久久精品欧美一区二区三区不卡| 色先锋aa成人| 国产一区二区三区在线观看免费| 亚洲欧美视频在线观看视频| 日韩欧美综合在线| 色网综合在线观看| 国产精品白丝av| 亚洲成人免费影院| 成人免费一区二区三区视频| 日韩视频在线永久播放| 92国产精品观看| 国产精品影视网| 日韩国产精品久久| 亚洲激情中文1区| 国产色婷婷亚洲99精品小说| 91黄色免费版| 成人性色生活片| 久久国产尿小便嘘嘘| 亚洲国产一区二区三区| 国产精品免费av| 日韩欧美精品在线视频| 欧美在线免费视屏| 99久久精品免费精品国产| 韩国精品一区二区| 日本三级韩国三级欧美三级| 亚洲激情在线激情| 中文字幕一区二区三区四区不卡| 2023国产精品自拍| 日韩一区二区三区精品视频| 色94色欧美sute亚洲线路一久| 岛国精品在线观看| 国产成人8x视频一区二区| 美女国产一区二区三区| 日韩主播视频在线| 亚洲香蕉伊在人在线观| 亚洲精品成人精品456| 中文字幕在线不卡国产视频| 日本一区二区三区四区在线视频| 久久伊人蜜桃av一区二区| 日韩一级视频免费观看在线| 欧美日韩国产首页在线观看| 在线精品观看国产| 在线日韩av片| 欧洲国内综合视频| 在线观看中文字幕不卡| 欧美综合欧美视频| 日本韩国一区二区| 欧美日韩精品欧美日韩精品一| 在线观看区一区二| 欧美日韩免费一区二区三区视频| 在线视频亚洲一区| 欧美日本一区二区三区| 欧美理论电影在线| 日韩精品一区二区三区中文不卡| 91精品国产入口| 精品国产乱码久久久久久牛牛| 精品久久久久久久久久久久包黑料 | 日韩一区二区高清| 欧美xxxx老人做受| 久久久久99精品一区| 国产欧美日本一区二区三区| 中文字幕av不卡| 一区二区三区在线免费观看 | 日韩免费观看2025年上映的电影| 日韩一区二区视频| 久久只精品国产| 中文字幕乱码日本亚洲一区二区| 中文字幕亚洲精品在线观看| 一区二区三区精品| 男男gaygay亚洲| 国产不卡一区视频| 色婷婷综合久久久久中文一区二区 | 午夜精品福利久久久| 日本成人中文字幕在线视频| 国产一区二区按摩在线观看| 成人激情视频网站| 欧美日韩久久不卡| xnxx国产精品| 一级中文字幕一区二区| 日日摸夜夜添夜夜添亚洲女人| 国内精品伊人久久久久av影院 | 国产成人高清在线| 色哟哟精品一区| 日韩视频免费观看高清完整版在线观看 | 国产成人av电影在线| 色婷婷av久久久久久久| 欧美电影免费观看高清完整版在| 国产精品美女久久久久aⅴ国产馆| 亚洲在线观看免费| 国产一区二区不卡老阿姨| 色欧美88888久久久久久影院| 欧美一区二区三区在线观看| 国产精品久久久久久亚洲伦| 亚洲v日本v欧美v久久精品| 国产在线观看免费一区| 欧美亚洲动漫制服丝袜| 精品国产一区二区三区av性色| 亚洲区小说区图片区qvod| 久久99国内精品| 色婷婷久久久亚洲一区二区三区| 日韩一级大片在线观看| 亚洲你懂的在线视频| 国产乱人伦精品一区二区在线观看 | 免费在线视频一区| 97久久超碰国产精品| 精品国产不卡一区二区三区| 亚洲午夜精品网| www.久久精品| 精品福利一二区| 日日摸夜夜添夜夜添精品视频| www.欧美.com| 国产视频在线观看一区二区三区| 日韩精品一级中文字幕精品视频免费观看 | 亚洲综合在线观看视频| 国产一区激情在线| 91精品国产91久久久久久最新毛片 | 欧美人与z0zoxxxx视频| 亚洲色图丝袜美腿| 国产乱码字幕精品高清av| 日韩免费高清av| 日本不卡123| 欧美精品123区| 婷婷综合久久一区二区三区| 色综合夜色一区| 国产精品国产精品国产专区不蜜| 韩国成人精品a∨在线观看| 欧美男男青年gay1069videost| 亚洲男人天堂一区| 99久久精品免费看国产 | 3d动漫精品啪啪1区2区免费| 一级做a爱片久久| 91福利精品视频| 美女视频网站久久| 欧美群妇大交群中文字幕| 亚洲狠狠爱一区二区三区| 91久久奴性调教| 亚洲一二三四久久| 欧美性生活一区| 亚洲成在人线免费| 欧美狂野另类xxxxoooo| 日韩有码一区二区三区| 欧美一区二区三区系列电影| 秋霞电影一区二区| 日韩欧美在线不卡| 国内外精品视频| 中文字幕精品综合| av激情成人网| 亚洲精选视频在线| 欧美日韩免费不卡视频一区二区三区| 亚洲一二三级电影| 欧美日韩一区三区| 日本亚洲三级在线| 精品日产卡一卡二卡麻豆| 国产在线精品一区在线观看麻豆| 国产亚洲一二三区| 成人精品一区二区三区四区| 亚洲色图在线播放| 欧美美女一区二区| 国产中文一区二区三区| 国产精品久久毛片av大全日韩| 色欧美日韩亚洲| 日本特黄久久久高潮| 久久精品亚洲国产奇米99| 99久久精品免费| 三级精品在线观看| 久久久国际精品| 日本二三区不卡| 久久精品国产亚洲高清剧情介绍| 久久久久高清精品|