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

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

?? tddtinducer.java

?? 自己編的ID3算法很小但效果很好
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
      String wDist = stream.mem_buf();
      stream = null; //delete stream;
      MString& newDescr = leafCat.description();
      String dbgDescr = newDescr + " (#=" + MString(totalWeight,0) +
	 " Err=" + MString(numErrors, 0) + "/" +
	String(pessimisticErrors, 2) + ")\\npDist=" + pDist +
	 "\\nwDist=" + wDist;
      leafCat.set_description(dbgDescr);
   }
*/
   Categorizer cat = leafCat;
   
   LeafCategorizer leafCategorizer = new LeafCategorizer(cat);
//   DBG(ASSERT(cat == null));
   return leafCategorizer;
}

/** Induce decision tree from a given split. The split is provided
 * in the form of a categorizer, which picks which subtree a given
 * instance will follow.
 * @param decisionTree Decision tree induced.
 * @param splitCat The categorizer for this split.
 * @param catNames List of category names.
 * @param tieBreakingOrder Order for breaking distribution ties.
 * @param numSubtreeErrors Number of errors this subtree produces in categorization of Instances.
 * @param pessimisticSubtreeErrors Error estimate if this was a leaf node.
 * @param numLeaves Number of leaves on a subtree.
 * @param remainingSiblings Siblings that have not be induced yet.
 */
protected void induce_tree_from_split(DecisionTree decisionTree, NodeCategorizer splitCat, LinkedList catNames, int[] tieBreakingOrder, DoubleRef numSubtreeErrors, DoubleRef pessimisticSubtreeErrors, IntRef numLeaves, int remainingSiblings)
{
   int[] myTiebreakingOrder =
      CatDist.merge_tiebreaking_order(tieBreakingOrder,
				       TS.counters().label_counts());
   InstanceList[] instLists =
      splitCat.split_instance_list(instance_list());
   // Add one if we have unknown instances
//   IFDRIBBLE(dribble_level(level, splitCat.description(), remainingSiblings));
   numSubtreeErrors.value = 0;
   pessimisticSubtreeErrors.value = 0;
   numLeaves.value = 0;
   DoubleRef numChildErrors = new DoubleRef(0);
   DoubleRef childPessimisticErrors = new DoubleRef(0);
   Node largestChild = null; // with the most instances (weight)
   DoubleRef maxChildWeight = new DoubleRef(-1);   
   for (int cat = 0; cat < instLists.length; cat++) {
      if (instLists[cat].num_instances() >= instance_list().num_instances())
	 Error.fatalErr("TDDTInducer.induce_tree_from_split: the most recent split "
	     +splitCat.description()+" resulted in no reduction of the "
	     +"instance list total weight (from "
	     +instance_list().total_weight()+" to "
	     +instLists[cat].total_weight());
      int remainingChildren = instLists.length - cat;
      Node child;
      if (instLists[cat].no_weight()) {
		// No weight of instances with this value.  Make it a leaf (majority),
		//   unless category unknown.
//		if (cat != UNKNOWN_CATEGORY_VAL)
//			IFDRIBBLE(dribble_level(level+1, "Leaf node",
//				remainingChildren));
		if (get_unknown_edges() || cat != Globals.UNKNOWN_CATEGORY_VAL) { 
			logOptions.LOG(3, "Category: " + (cat - 1)//-1 added to match MLC output -JL
				+" empty.  Assigning majority"+'\n');
			NodeCategorizer[] constCat = new NodeCategorizer[1];
			constCat[0] = create_leaf_categorizer(0, myTiebreakingOrder,
				numChildErrors, childPessimisticErrors);
			if (cat != Globals.UNKNOWN_CATEGORY_VAL)
				++numLeaves.value;  // don't count trivial leaves
			MLJ.ASSERT(numChildErrors.value == 0,"TDDTInducer.induce_tree_from_split: numChildErrors.value != 0");
			MLJ.ASSERT(childPessimisticErrors.value == 0,"TDDTInducer.induce_tree_from_split: childPessimisticErrors.value != 0");
			child = decisionTree.create_node(constCat, get_level() + 1);
			MLJ.ASSERT(constCat[0] == null,"TDDTInducer.induce_tree_from_split: constCat != null");
			//create_node gets ownership
			logOptions.LOG(6, "Created child leaf "+child+'\n');
			logOptions.LOG(6, "Connecting root "+decisionTree.get_root()
				+" to child "+child
				+" with string '"+(String)catNames.get(cat)+"'"+'\n');
			connect(decisionTree, decisionTree.get_root(), child,
				cat, (String)catNames.get(cat));
		}
      } else { // Solve the problem recursively.
		CGraph aCgraph = decisionTree.get_graph();
		logOptions.LOG(3, "Recursive call"+'\n');
		double totalChildWeight = instLists[cat].total_weight();
		TDDTInducer childInducer =
		create_subinducer(name_sub_inducer(splitCat.description(), cat),
			      aCgraph);
		childInducer.set_total_inst_weight(get_total_inst_weight());
		childInducer.assign_data(instLists[cat]);
		IntRef numChildLeaves = new IntRef(0);
		child = childInducer.induce_decision_tree(aCgraph,
						    myTiebreakingOrder,
						    numChildErrors,
						    childPessimisticErrors,
						    numChildLeaves,
						    remainingChildren);
		numSubtreeErrors.value += numChildErrors.value;
		pessimisticSubtreeErrors.value += childPessimisticErrors.value;
		numLeaves.value += numChildLeaves.value;
		if (totalChildWeight > maxChildWeight.value) {
			maxChildWeight.value = totalChildWeight;
			largestChild = child;
		}
		childInducer = null; //delete childInducer;
		Node root = decisionTree.get_root();
		logOptions.LOG(6, "Connecting child "+child+" to root "
			+root+", using "+cat
			+" with string '"+(String)catNames.get(cat)+"'"+'\n');
		connect(decisionTree, decisionTree.get_root(), child,
		cat, (String)catNames.get(cat));
	}
   }

   MLJ.clamp_above(maxChildWeight, 0, "TDDTInducer.induce_tree_from_split: "
   		   +"maximum child's weight must be non-negative");

	MLJ.ASSERT(largestChild != null,"TDDTInducer.induce_tree_from_split: largestChild == null");
//   DBGSLOW(decisionTree.OK(1));
   
   instLists = null; //delete &instLists;
/*   prune_subtree(decisionTree, myTiebreakingOrder,
		 largestChild, numSubtreeErrors, pessimisticSubtreeErrors,
		 numLeaves);
*/   myTiebreakingOrder = null; //delete myTiebreakingOrder;
/*   
   if (get_debug()) {
      // Cast away constness for modifying the name.
      Categorizer splitC = (Categorizer)decisionTree.
	         get_categorizer(decisionTree.get_root());
      String name = splitC.description();
      double[] distribution = splitC.get_distr();
      int numChars = 128;
      char buffer[numChars];
      for (int chr = 0; chr < numChars; chr++)
	         buffer[chr] = '\0';
      MLCOStream stream(EMPTY_STRING, buffer, numChars);
      stream << distribution;
      String distDescrip = stream.mem_buf();
      String newName = name + "\\nErr=" + String(numSubtreeErrors, 3) +
	 "/" + String(pessimisticSubtreeErrors, 3);
      if (splitC.class_id() != CLASS_CONST_CATEGORIZER)
	 newName += "\\nwDist=" + distDescrip;
      splitC.set_description(newName);
   }
*/
//   if (get_level() == 0)
//      DRIBBLE(endl);
}

/** Connects two nodes in the specified CatGraph.
 * @param catGraph The CatGreph containing these nodes.
 * @param from     The node from which the edge originates.
 * @param to       The node to which the edge connects.
 * @param edgeVal  The value of the AugCategory associated with that edge.
 * @param edgeName The name of the edge.
 */
protected void connect(CatGraph catGraph, Node from, Node to, int edgeVal, String edgeName)
{
   AugCategory edge = new AugCategory(edgeVal, edgeName);
   logOptions.GLOBLOG(6, "TDDTInducer's connect(), given string '" +edgeName
	   +"', is using '" + edge.description()
	   +"' as an edge description\n");
   catGraph.connect(from, to, edge);
//   ASSERT(edge == NULL); // connect() gets ownership
//   catGraph.OK(1);
}

/** Create a string to name the subinducer. We just append some basic info.
 * @return The name of the subinducer.
 * @param catDescr	The description of this subinducer.
 * @param catNum	The category number for which this subinducer is
 * inducing.
 */
public String name_sub_inducer(String catDescr, int catNum)
{
   String CAT_EQUAL = " Cat=";
   String CHILD_EQUAL = " child =";
   
   return description() + CAT_EQUAL + catDescr + CHILD_EQUAL + catNum;
}

/** Create_subinducer creates the Inducer for calling recursively. Note that since
 * this is an abstract class, it can't create a copy of itself.
 *
 * @param dscr The description for the sub inducer.
 * @param aCgraph The categorizer graph to use for the subinducer.
 * @return The new subinducer.
 */
abstract public TDDTInducer create_subinducer(String dscr, CGraph aCgraph);

/** When the subtree rooted from the current node does not improve
 * the error, the subtree may be replaced by a leaf or by its largest
 * child. This serves as a collapsing mechanism if the pruning factor
 * is 0, i.e., we collapse the subtree if it has the same number of
 * errors as all children.<P>
 * "Confidence" pruning is based on C4.5's pruning method. "Penalty"
 * pruning is based on "Pessimistic Decision tree pruning based on tree
 * size" by Yishay Mansour, ICML-97. "Linear" pruning is used to implement
 * cost-complexity pruning as described in CART.  Its use is not
 * recommended otherwise. "KLdistance" pruning uses the Kullback-Leibler
 * distance metric to determine whether to prune.<P>
 * This function is divided into three main parts. First, initial
 * checks are performed and values are set. Second, the test specific
 * to each pruning method is performed. Last, if pruning is
 * necessary, do it.
 * @param decisionTree Tree to be pruned.
 * @param tieBreakingOrder Order for breaking distribution ties.
 * @param largestChild The largest child node.
 * @param numSubtreeErrors Number of errors this subtree produces in categorization of Instances.
 * @param pessimisticSubtreeErrors Error estimate if this was a leaf node.
 * @param numLeaves Number of leaves on a subtree.
 */
public void prune_subtree(DecisionTree decisionTree,
				int[] tieBreakingOrder,
				Node largestChild,
				DoubleRef numSubtreeErrors,
				DoubleRef pessimisticSubtreeErrors,
				IntRef numLeaves)
{
logOptions.LOG(0,"Pruning is taking place.\n");
   MLJ.ASSERT(numSubtreeErrors.value >= 0,"TDDTInducer:prune_subtree:"
			+" numSubtreeErrors < 0");
   MLJ.ASSERT(pessimisticSubtreeErrors.value >= 0,"TDDTInducer:prune_subtree:"
			+" pessimisticSubtreeErrors < 0");
   Node treeRoot = decisionTree.get_root(true);

   // @@ CatDTInducers can't prune, but we don't want to check
   // get_prune_tree() here because even if we're not doing pruning, this code
   // does some useful safety checks. The checks aren't valid on
   // CatDTInducers, because they do not compute pessmisticSubtreeErrors.
//   if (this instanceof CatDTInducer) return;
//   if (class_id() == CatDT_INDUCER)
//      return;

//   DBGSLOW(if (numLeaves != decisionTree.num_nontrivial_leaves())
//	      Error.fatalErr("TDDTInducer.prune_subtree: number of leaves given "
//	          +numLeaves+" is not the same as the number counted "
//	          +decisionTree.num_nontrivial_leaves()));

//   DBGSLOW(
//       // We don't want any side effect logging only in debug level
//       logOptions logOpt(logOptions.get_log_options());
//       logOpt.set_log_level(0);
//       double pess_err =
//         pessimistic_subtree_errors(logOpt, decisionTree, treeRoot, *TS,
//				    get_pruning_factor(), tieBreakingOrder);
//       MLJ.verify_approx_equal(pess_err, pessimisticSubtreeErrors,
//			       "TDDTInducer.prune_subtree: pessimistic error"
//			       " differs from expected value");
//          );
   // How many errors (weighted) would we make with a leaf here?
   int myMajority = TS.majority_category(tieBreakingOrder);
   double numMajority = TS.counters().label_count(myMajority);
   double totalWeight = TS.total_weight();
   double myErrors = totalWeight - numMajority;
   if (!(MLJ.approx_greater(myErrors, numSubtreeErrors.value) ||
	MLJ.approx_equal(myErrors, numSubtreeErrors.value)))
      Error.fatalErr("TDDTInducer.prune_subtree: myErrors is not >= numSubtreeErrors"
	 +": myErrors - numSubtreeErrors = "+(myErrors - numSubtreeErrors.value));
   int numChildren = decisionTree.num_children(treeRoot);

   // test if a leaf; if so, we can exit immediately
   if (numChildren == 0) {
      numSubtreeErrors.value = totalWeight - numMajority;
      numLeaves.value = 1;
      return;
   }
   
   logOptions.LOG(3, "Testing at "
      +decisionTree.get_categorizer(treeRoot).description()
      +" (weight "+decisionTree.get_categorizer(treeRoot).total_weight()
      +')'+'\n');

   boolean pruneSubtree = false;
   boolean pruneChild = false;
   // We need to declare these here, as we use them during pruning
   double myPessimisticErrors = CatTestResult.pessimistic_error_correction(
                    myErrors, TS.total_weight(), get_pruning_factor());
   DoubleRef childPessimisticErrors = new DoubleRef(0);
   if (get_pruning_factor() == 0)  
      MLJ.verify_approx_equal(myPessimisticErrors, myErrors,
			      "TDDTInducer.prune_subtree:pessimistic error "
			      +"when computed for leaf, "
			      +"differs from expected value");

   switch (get_pruning_method()) {
      case confidence:
	 //@@ replace "100 * MLC.real_epsilon()" with "0.1" for
	 //@@   C4.5 functionality 
	 if (myPessimisticErrors - pessimis

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情深爱一区二区| 日韩美女视频19| 成人精品视频.| 亚洲精品国产精华液| 日韩电影在线看| 亚洲欧洲国产日韩| 8x福利精品第一导航| 床上的激情91.| 美女高潮久久久| 亚洲与欧洲av电影| 中文字幕欧美三区| 国产日产欧产精品推荐色| av高清久久久| 狠狠色综合播放一区二区| 亚洲1区2区3区4区| 17c精品麻豆一区二区免费| 亚洲精品美腿丝袜| 国产盗摄精品一区二区三区在线| 一区二区三区丝袜| 中文字幕第一页久久| 精品国产亚洲一区二区三区在线观看| 在线观看国产日韩| 99久久精品国产一区| 韩国女主播成人在线观看| 天堂久久久久va久久久久| 亚洲精品亚洲人成人网 | 亚洲欧美另类小说视频| 日韩欧美久久久| 欧美日韩国产综合视频在线观看 | 激情综合色综合久久综合| 91精品91久久久中77777| 一区二区三区蜜桃| 国产清纯美女被跳蛋高潮一区二区久久w| 色天天综合久久久久综合片| 亚洲综合激情网| 一区在线播放视频| 国产精品国产自产拍在线| 久久人人超碰精品| 精品久久一区二区| 欧美精品一区二区三区蜜桃| 日韩精品一区二区三区在线观看| 欧美二区三区91| 制服丝袜亚洲精品中文字幕| 欧美精选一区二区| 欧美日韩国产一区| 久久亚洲一级片| 久久亚区不卡日本| 久久综合久久99| 国产色产综合产在线视频| 久久久久九九视频| 国产人久久人人人人爽| 一区在线观看视频| 亚洲一区二区三区四区五区中文 | 99久久免费视频.com| 国产白丝精品91爽爽久久 | 国产一区二区调教| 国内精品自线一区二区三区视频| 黄色小说综合网站| 国产成人精品午夜视频免费| 成人av在线资源网站| 日本高清不卡一区| 在线成人午夜影院| www欧美成人18+| 国产精品电影一区二区三区| 一区二区三区久久| 日韩电影在线观看电影| 国精产品一区一区三区mba桃花 | 亚洲欧美日韩在线播放| 一区二区免费在线播放| 日精品一区二区三区| 国产在线麻豆精品观看| 不卡的看片网站| 欧美日韩一区二区不卡| 国产欧美一区视频| 中文字幕一区二区三区视频| 国产精品电影一区二区三区| 亚洲大尺度视频在线观看| 美国欧美日韩国产在线播放| 成人小视频在线观看| 欧美三区在线观看| 日韩午夜三级在线| 国产精品看片你懂得| 亚洲一区av在线| 麻豆91小视频| 成人性生交大片免费| 欧美日韩一卡二卡三卡| 国产三区在线成人av| 亚洲午夜激情网页| 精品无人码麻豆乱码1区2区| 成人毛片视频在线观看| 欧美欧美午夜aⅴ在线观看| eeuss鲁一区二区三区| 欧美另类videos死尸| 中文子幕无线码一区tr| 天堂蜜桃91精品| 不卡一区中文字幕| 欧美一卡2卡三卡4卡5免费| 国产精品私人自拍| 日韩av不卡在线观看| 中文字幕一区二区在线观看 | 欧美大肚乱孕交hd孕妇| 国产精品久久久久久亚洲毛片| 午夜欧美在线一二页| 成人午夜短视频| 欧美一级理论片| 4438x成人网最大色成网站| 肉丝袜脚交视频一区二区| 亚洲欧美另类久久久精品2019| 激情国产一区二区| 91精品国产一区二区三区| 国产精品福利一区二区| 国产精品夜夜嗨| 91精品国产全国免费观看| 亚洲视频一区在线| 国产一区二区毛片| 国内精品国产三级国产a久久| 欧美久久一二区| 国产精品久久久久国产精品日日| 日一区二区三区| 日本韩国欧美国产| 国产精品免费视频一区| 久久99精品视频| 91日韩在线专区| 国产精品系列在线| 99久久er热在这里只有精品15 | 亚洲综合一区二区三区| 岛国一区二区三区| 久久婷婷一区二区三区| 日本欧美久久久久免费播放网| 欧美性感一类影片在线播放| 亚洲男人的天堂一区二区| 成人av资源在线| 国产精品色婷婷| 国产福利一区二区三区在线视频| 久久日一线二线三线suv| 麻豆精品国产传媒mv男同| 欧美人xxxx| 亚洲www啪成人一区二区麻豆| 91首页免费视频| 久久九九国产精品| 国产精品123区| 亚洲国产精品视频| www国产成人| 亚洲chinese男男1069| 欧美日韩精品一二三区| 日韩综合一区二区| 日韩欧美国产小视频| 蜜臀国产一区二区三区在线播放| 欧美精品aⅴ在线视频| 免费xxxx性欧美18vr| 精品国产乱码久久久久久久| 另类成人小视频在线| 国产无一区二区| 国产一区二区三区香蕉 | 亚洲欧美日韩成人高清在线一区| 综合激情成人伊人| 日本欧美一区二区| 国产成a人无v码亚洲福利| 91国产免费看| 91精品国产品国语在线不卡| 中文天堂在线一区| 欧洲精品中文字幕| 国产日韩欧美精品综合| 一区二区三区高清不卡| 日韩1区2区3区| 99精品久久只有精品| 91麻豆精品国产91久久久使用方法 | 久久中文字幕电影| 国产精品理伦片| 毛片不卡一区二区| 色综合中文字幕| 久久久国产精华| 亚洲成在线观看| 日本二三区不卡| 一区二区中文视频| 中文字幕视频一区二区三区久| 欧美日韩卡一卡二| 中文字幕综合网| 欧美三级电影网站| 爽好多水快深点欧美视频| 日韩一区二区三区精品视频 | 亚洲另类春色校园小说| 国产在线不卡一区| 一区二区三区国产| 中文字幕一区不卡| 一区二区成人在线| 国产精品一品视频| 麻豆国产一区二区| 成人自拍视频在线| 日韩欧美中文字幕一区| 国产91在线|亚洲| 色狠狠色噜噜噜综合网| 国产欧美日韩亚州综合| 不卡一区中文字幕| 日韩视频中午一区| 午夜影院在线观看欧美| 久久se这里有精品| 久久日韩粉嫩一区二区三区| 国产精品网站一区| 爽好多水快深点欧美视频|