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

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

?? id3inducer.java

?? 數據倉庫挖掘與開發 ID3算法實現代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package id3;
import java.lang.*;
import java.util.*;
import shared.*;
import shared.Error;

/** The ID3Class is the Java implementation of the ID3 algorithm. The
 * ID3 algorithm is a top-down decision-tree induction algorithm. This
 * algorithm uses the mutual information (original gain criteria),and
 * not the more recent information gain ratio.<P>
 * Complexity:<P>
 * Our split() method uses entropy and takes time O(vy) where v is
 * the total number of attribute values (over all attributes) and y
 * is the number of label values. This can be derived by noting that
 * mutual_info is computed for each attribute.<P>
 * Node categorizers (for predict) are AttrCategorizer and take
 * constant time, thus the overall prediction time is O(path-length).<P>
 * See TDDTInducer for more complexity information.<P>
 * Enhancements:<P>
 * The ID3Compute entropy once for the node, and pass it along to
 * avoid multiple computations like we do now.<P>
 *
 * @author James Louis 12/7/2000 Ported to Java
 * @author Clay Kunz 10/22/96 Changed bestSi to a pointer everywhere so
 * that we don't copy lots of split objects
 * around.
 * @author Yeogirl Yun 7/4/95 Added copy constructor.
 * @author Ronny Kohavi 9/08/93 Initial revision (.h,.c)
 */
public class ID3Inducer extends TDDTInducer
{
    /** Constructor.
     * @param dscr    The description of this inducer.
     * @param aCgraph A previously developed Cgraph.
     */
   public ID3Inducer(String dscr, CGraph aCgraph)
   {
      super(dscr, aCgraph);
   }

   /** Constructor.
    * @param dscr The description of this inducer.
    */
   public ID3Inducer(String dscr)
   {
      super(dscr); 
   }

   /** Copy Constructor.
    * @param source The original ID3Inducer that is being copied.
    */
   public ID3Inducer(ID3Inducer source)
   {
      super(source);
   }

   /** Returns the AttrCategorizer that splits on the best attribute found using
    * mutual information(information gain). Returns null if there is nothing
    * good to split on. Ties between this attribute and earlier attributes are
    * broken.
    * @param catNames The names of the categories that each instance may be
    * catagorized under.
    * @return The NodeCategorizer that splits on the best attribute found. May be
    * null if no good attribute split is found.
    */
   public  NodeCategorizer best_split(LinkedList catNames) 
   {
      Schema schema = TS.get_schema();
//schema used to be SchemaRC :JL
// @@ change these to return an index instead of bestSplit.
//   SplitAttr noSplit;
//bestSplit used to be set equal to noSplit : JL
      SplitAttr[] bestSplit = new SplitAttr[1]; 
	bestSplit[0] = new SplitAttr();
      SplitAttr[] splits = new SplitAttr[schema.num_attr()];
	for(int z = 0; z < splits.length;z++) splits[z] = new SplitAttr();
// @@ Call routine to initialize splits - sets penalty, minSplit
      if (!find_splits(bestSplit, splits)) return null;
      MLJ.ASSERT((bestSplit[0] != null) &&  (bestSplit[0].split_type() != SplitAttr.noReasonableSplit),
		"ID3Inducer:best_split--(bestSplit == null)"+
		"or(bestSplit.split_type() == noReasonableSplit)");
      NodeCategorizer bestCat = null;
      bestCat = split_to_cat(bestSplit[0], catNames);
      MLJ.ASSERT(bestCat != null,"ID3Inducer:best_split--bestCat == null");
//   DBG(bestCat->OK());
      logOptions.LOG(2, "Created split on attribute "+bestSplit[0].get_attr_num()+" ("+
          schema.attr_name(bestSplit[0].get_attr_num())+") at level "+
          get_level()+'\n');
      bestCat.build_distr(instance_list());
      return bestCat;
   }

   /** Fills in the array of splits for current subtree. It does very
    * little, but rarely overriden whereas best_split_info is overridden
    * by subclasses.
    * @return False if there is only one label value, the maximum number
    * of splits is reached, or if there is no reasonable split
    * available.
    * @param bestSplit This is an array of the best splits found during the
    * splitting process.
    * @param splits This is an array of all splits found during the
    * splitting process.
    */
   public boolean find_splits(SplitAttr[] bestSplit,
			    SplitAttr[] splits) 
   {
      if (TS.counters().label_num_vals() == 1)
         return false; // if we have one label value, we're done.
      if ((get_max_level() > 0)&&(get_level() >= get_max_level())) {
         logOptions.LOG(2, "Maximum level "+get_max_level()+" reached "+'\n');
         return false;
      }
      logOptions.LOG(3, TS.counters().toString());
      best_split_info(bestSplit, splits);
      return (bestSplit[0].split_type() != SplitAttr.noReasonableSplit);
   }

   /** Fills in the array of SplitAttr for current subtree. This function
    * is a good candidate to override in subclasses.
    * @param bestSplit	This is an array of the best splits found during the
    * splitting process.
    * @param splits	This is an array of all splits found during the
    * splitting process.
    */
   public  void best_split_info(SplitAttr[] bestSplit, SplitAttr[] splits) 
   {
      Schema schema = TS.get_schema();
   		//schema used to be SchemaRC : JL
      int numAttributes = schema.num_attr();
   
      StatData allMutualInfo = new StatData();
      StatData allNonMultiValMutualInfo = new StatData();
   
      RealAndLabelColumn[] realColumns = null;
      if (get_have_continuous_attributes()) {
         boolean[] mask = new boolean[numAttributes];
         for(int z = 0; z < numAttributes; z++) mask[z] = true;
         realColumns = TS.transpose(mask);
      }

      for (int attrNum = 0; attrNum < numAttributes; attrNum++) {
         split_info(attrNum, splits[attrNum], realColumns);
         // Find the mean of the mutual information over all attributes
         //   with reasonable splits.  From c4.5, we accumulate separately
         //   the mutual information that originates from attributes that
         //   do not have "too many" values.  Unless ALL attributes fail
         //   this criterion we use only those from the "smaller" attributes.
         // @@ We may want to compute the mean only when it's needed, i.e.,
         // @@ for gain-ratio emulation
         if (splits[attrNum].split_type() != SplitAttr.noReasonableSplit) {
            double mi = splits[attrNum].get_mutual_info(false, true);
            MLJ.ASSERT(mi >= 0,"ID3Inducer.best_split_info(SplitAttr,SplitAttr[])--"+
   			" mi < 0");
            logOptions.LOG(3, "Adding mutualInfo "+mi+" to mean.");
            allMutualInfo.insert(mi);
            if (!multi_val_attribute(attrNum)) {
               allNonMultiValMutualInfo.insert(mi);
               logOptions.LOG(3, "  It's not multi-val.");
            }
   	   logOptions.LOG(3,'\n');
         }
      }
      realColumns = null;
      pick_best_split(bestSplit, splits, allMutualInfo,allNonMultiValMutualInfo);
   }

   /** Return true if the attribute has many values according to
    * the C4.5 definition.
    * @return True if this attribute has many values, False otherwise.
    * @param attrNum	The number of the attribute being checked.
    */
   public boolean multi_val_attribute(int attrNum) 
   {
      double totalWeight = get_total_inst_weight();
      MLJ.ASSERT(totalWeight >= 0,"ID3Inducer.multi_val_attribute(int)--"+
   		 " totalWeight < 0");
      Schema schema = TS.get_schema();
//schema used to be SchemaRC : JL
      return ((schema.attr_info(attrNum).can_cast_to_nominal())&&(schema.num_attr_values(attrNum) >= (0.3 * totalWeight)));
   }

   /** Choose the best attribute to split the on from all possible splits.
    * @param bestSplit	The array of the best splits found during splitting
    * process.
    * @param splits	The array of all splits found during the splitting
    * process.
    * @param allMutualInfo	Statistical information about all instances.
    * @param allNonMultiValMutualInfo	Statistical information about instances
    * where an attribute can only have one
    * value at a time.
    */
   public void pick_best_split(SplitAttr[] bestSplit,
					SplitAttr[] splits,
					StatData allMutualInfo,
					StatData allNonMultiValMutualInfo) 
   {
      Schema schema = TS.get_schema();
      int numAttributes = schema.num_attr();

      if (get_split_score_criterion() != SplitScore.gainRatio) {
         for (int attrNum = 0; attrNum < numAttributes; attrNum++) {
            SplitAttr split = splits[attrNum];
            if (split.split_type() != SplitAttr.noReasonableSplit) {
      	    // Remember the best.  MLJ.realEpsilon is added because on
      	    //   monk1, the difference is 1e-16, and we want to tie break
      	    //   exactly as C4.5 does.
      	    // First half of test is because bestSplit might be unset, in
      	    //   which case we can't get its criterion score.
               if (bestSplit[0].split_type() == SplitAttr.noReasonableSplit
                  || split.score() > (bestSplit[0].score() + MLJ.realEpsilon))
                  bestSplit[0] = split;
            }
         }
      } else { // gain ratio
         double meanMutualInfo = Globals.UNDEFINED_REAL;
         if (allMutualInfo.size() > 0) 
         if (all_attributes_multi_val() || allNonMultiValMutualInfo.size() == 0) {
            meanMutualInfo = allMutualInfo.mean();
            if (all_attributes_multi_val()) logOptions.LOG(3, "All attributes are multi-val."+'\n');
         }
         else
            meanMutualInfo = allNonMultiValMutualInfo.mean();      
         logOptions.LOG(3,"Mean mutual info is "+meanMutualInfo+'\n');
   
         // Look at the criterion score for each attribute.  Any time an
         //   attribute has a mutual info greater than the mean mutual info
         //   it's a candidate for chosing as best.  If its score is
         //   greater than the max so far, pick it.
         double maxScore = Globals.UNDEFINED_REAL;
         boolean foundScoreAboveMean = false;
         for (int attrNum = 0; attrNum < numAttributes; attrNum++) {
            SplitAttr split = splits[attrNum];
            logOptions.LOG(3,"For attribute "+attrNum+", checking for reasonable split");
            if (split.split_type() == SplitAttr.noReasonableSplit){
               logOptions.LOG(3,"...Sorry, no reasonable split"+'\n');
            }
            else {
               boolean mutualInfoAboveMean = split.get_mutual_info(false,true) >
               meanMutualInfo + MLJ.realEpsilon;
   	    // was || maxScore == Globals.UNDEFINED_REAL)
//               if (maxScore == Globals.UNDEFINED_REAL) MLJ.ASSERT(!foundScoreAboveMean);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合九色综合欧美98 | 国产精品一区一区三区| 国产高清精品在线| 欧美精品精品一区| 亚洲天堂成人在线观看| 久久99最新地址| 欧美日韩免费观看一区二区三区 | 欧美三级视频在线观看| 国产精品久久看| 激情文学综合插| 欧美日本一区二区在线观看| 中文字幕在线一区免费| 精油按摩中文字幕久久| 欧美色图片你懂的| 亚洲男人的天堂在线aⅴ视频| 国产真实精品久久二三区| 欧美丰满一区二区免费视频| 亚洲一区欧美一区| 91片黄在线观看| 中文字幕在线播放不卡一区| 国产成人在线视频播放| 精品乱人伦小说| 久久精品av麻豆的观看方式| 欧美一区欧美二区| 五月激情综合网| 欧美老肥妇做.爰bbww| 亚洲一线二线三线久久久| 在线观看91视频| 亚洲综合激情另类小说区| 91在线高清观看| 亚洲乱码国产乱码精品精98午夜| jizz一区二区| 亚洲黄色小视频| 欧美少妇一区二区| 日韩黄色在线观看| 精品欧美黑人一区二区三区| 人妖欧美一区二区| 久久综合狠狠综合久久综合88 | 色综合 综合色| 亚洲欧美另类久久久精品| 99re6这里只有精品视频在线观看| 国产精品九色蝌蚪自拍| 91免费看`日韩一区二区| 亚洲精品国产一区二区精华液| 色婷婷国产精品| 亚洲超碰精品一区二区| 日韩三级伦理片妻子的秘密按摩| 另类小说综合欧美亚洲| 国产日韩成人精品| 色欧美88888久久久久久影院| 亚洲精品成a人| 日韩一区二区精品在线观看| 精品一区二区三区香蕉蜜桃| 久久久综合视频| 色噜噜狠狠色综合中国| 亚洲国产人成综合网站| 日韩亚洲欧美高清| 高清beeg欧美| 亚洲一区二区三区四区在线免费观看| 在线电影一区二区三区| 国产一区二区按摩在线观看| 久久精品亚洲一区二区三区浴池| 99re热这里只有精品免费视频| 亚洲电影第三页| 欧美国产精品中文字幕| 色猫猫国产区一区二在线视频| 日韩和欧美的一区| 欧美国产乱子伦| 制服丝袜一区二区三区| 福利91精品一区二区三区| 亚洲午夜激情av| 国产亚洲综合av| 91.com在线观看| 99这里都是精品| 韩国女主播一区| 亚洲一二三四在线| 中文字幕第一区综合| 欧美日韩精品一区二区三区四区| 国产一区二区福利视频| 亚洲国产视频网站| 中文字幕一区二区三| 欧美r级电影在线观看| 91丨porny丨最新| 国产精品影视网| 午夜精品在线视频一区| 亚洲免费伊人电影| 国产精品欧美极品| 精品欧美一区二区三区精品久久 | 天天av天天翘天天综合网| 久久蜜桃香蕉精品一区二区三区| 欧美四级电影网| 不卡一区二区在线| 经典三级一区二区| 日韩影视精彩在线| 亚洲国产精品一区二区久久| 国产精品乱码一区二三区小蝌蚪| 欧美xxxx在线观看| 日韩欧美国产精品一区| 在线综合视频播放| 欧美调教femdomvk| 欧美影视一区二区三区| 91天堂素人约啪| 色哟哟国产精品免费观看| www.av精品| www.日本不卡| 成人高清视频免费观看| 成人少妇影院yyyy| 床上的激情91.| 成人av在线影院| 成人少妇影院yyyy| 95精品视频在线| 91麻豆国产在线观看| 91丨porny丨国产| 91影院在线免费观看| 99久久久无码国产精品| 97精品电影院| 欧洲精品视频在线观看| 欧美少妇一区二区| 91.com在线观看| 精品福利一区二区三区免费视频| 精品欧美久久久| 欧美国产日产图区| 亚洲欧美中日韩| 亚洲综合丁香婷婷六月香| 午夜欧美大尺度福利影院在线看| 丝袜亚洲精品中文字幕一区| 免费在线成人网| 国产精品综合视频| www.欧美色图| 欧美日韩国产欧美日美国产精品| 91精品欧美久久久久久动漫| 日韩精品一区二区在线| 国产视频不卡一区| √…a在线天堂一区| 亚洲激情av在线| 美女一区二区三区| 国产91露脸合集magnet| 色综合一个色综合亚洲| 欧美人牲a欧美精品| 久久久久久久综合日本| 亚洲欧美视频在线观看视频| 亚洲成人av资源| 国产在线精品一区二区不卡了| 99视频在线观看一区三区| 欧美日韩午夜影院| 国产日韩视频一区二区三区| 亚洲视频免费在线| 蜜臀久久99精品久久久久久9 | 色呦呦日韩精品| 91精品国产综合久久福利| 久久久久久久久99精品| 亚洲精品国产第一综合99久久| 久草在线在线精品观看| 不卡一卡二卡三乱码免费网站| 欧美日韩精品系列| 欧美激情资源网| 日韩成人免费电影| 99精品国产91久久久久久| 日韩欧美国产小视频| 亚洲精品成人少妇| 国产宾馆实践打屁股91| 91麻豆精品久久久久蜜臀| 综合久久一区二区三区| 韩国女主播成人在线观看| 欧美视频自拍偷拍| 最新欧美精品一区二区三区| 免费亚洲电影在线| 欧美丝袜丝交足nylons| 国产精品福利一区| 国产一区二区免费在线| 日韩一区二区三区电影 | 狠狠久久亚洲欧美| 欧美日韩一区二区三区四区五区 | 精品第一国产综合精品aⅴ| 国产精品女同互慰在线看| 久久精工是国产品牌吗| 欧美色综合网站| 亚洲精品视频在线观看免费| 狠狠色丁香婷婷综合| 91精品国产免费| 一区二区免费在线播放| caoporen国产精品视频| 亚洲精品一区二区三区香蕉 | 亚洲色图在线视频| 国产凹凸在线观看一区二区| 亚洲欧美日韩久久精品| 国产不卡视频在线播放| 精品国产一区久久| 麻豆精品久久精品色综合| 欧美日韩成人激情| 亚洲自拍偷拍网站| 一本色道**综合亚洲精品蜜桃冫| 国产精品久久毛片| av成人动漫在线观看| 国产精品久久久久影院亚瑟| 成人永久免费视频| ...av二区三区久久精品| 91一区二区三区在线播放| 日韩伦理免费电影| 99久久精品99国产精品|