亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
色综合中文字幕国产| 精品视频在线看| 亚洲一区二区三区激情| 精品久久一二三区| 国产欧美中文在线| 福利视频网站一区二区三区| 亚洲综合色噜噜狠狠| 久久精品亚洲精品国产欧美kt∨| 欧美曰成人黄网| 丰满亚洲少妇av| 另类人妖一区二区av| 一区二区三区高清在线| 亚洲国产成人午夜在线一区| 欧美一区二区免费视频| 色综合中文字幕国产| 久久精品国产一区二区| 亚洲第一精品在线| 亚洲男人的天堂一区二区| 国产三级一区二区| 欧美一区二区久久久| 欧美三级电影在线观看| 91免费观看视频| av激情亚洲男人天堂| 国产精品一区二区在线观看网站| 日韩电影在线观看网站| 亚洲一区精品在线| 一区二区日韩av| 一区二区三区免费看视频| 国产精品你懂的在线| 久久人人97超碰com| 日韩欧美第一区| 日韩午夜精品视频| 日韩视频在线你懂得| 9191久久久久久久久久久| 欧美日韩在线直播| 欧美三级三级三级| 欧美日韩国产一级二级| 欧美亚洲愉拍一区二区| 欧美在线播放高清精品| 91久久一区二区| 91麻豆福利精品推荐| 99国产精品久久久久久久久久 | 亚洲午夜一区二区| 亚洲欧美另类综合偷拍| 亚洲裸体在线观看| 亚洲精品国产第一综合99久久 | 成人深夜在线观看| 国产乱国产乱300精品| 国产成人精品免费| 成人h动漫精品一区二区| 97久久精品人人澡人人爽| 波多野结衣精品在线| 97久久久精品综合88久久| 一本大道久久a久久综合| 91精品福利视频| 欧美三级电影网站| 91精选在线观看| 欧美v亚洲v综合ⅴ国产v| 国产亚洲一二三区| 亚洲视频电影在线| 亚洲一区二区三区激情| 日韩国产精品久久| 精品一区二区精品| 福利视频网站一区二区三区| 色综合天天综合网天天狠天天| 色婷婷av一区二区| 91精品国产综合久久久久久| 精品蜜桃在线看| 中文字幕在线一区二区三区| 亚洲精品中文字幕在线观看| 午夜精品久久久久久久蜜桃app| 全国精品久久少妇| 成人激情午夜影院| 欧美日韩一区二区在线视频| 精品少妇一区二区三区视频免付费 | 国产激情精品久久久第一区二区| 风流少妇一区二区| 欧美三电影在线| 久久精品视频网| 伊人夜夜躁av伊人久久| 麻豆精品新av中文字幕| 成人app在线| 欧美一区二区人人喊爽| 国产精品你懂的| 午夜精品一区二区三区电影天堂| 国产精品18久久久久久久久久久久| 99国产精品久久久久久久久久久| 日韩一区二区免费在线电影| 国产精品欧美一区喷水| 日韩电影免费一区| 99在线精品一区二区三区| 91精品国产综合久久国产大片 | 亚洲激情图片小说视频| 精品一区精品二区高清| 欧美在线免费视屏| 久久精品一区二区三区不卡| 亚洲国产一区二区三区青草影视| 国产乱码精品1区2区3区| 色综合天天综合网国产成人综合天 | 久久99精品久久久久久| 色综合久久66| 国产欧美日本一区视频| 天天色图综合网| av一区二区三区黑人| 精品久久久影院| 亚洲成人综合视频| 99久久99久久免费精品蜜臀| 日韩三级免费观看| 亚洲午夜精品久久久久久久久| 国产成人在线观看免费网站| 欧美精选在线播放| 亚洲欧美激情视频在线观看一区二区三区| 久久国产福利国产秒拍| 欧美性大战久久| 中文字幕在线一区二区三区| 国内精品久久久久影院薰衣草| 欧美综合一区二区| ●精品国产综合乱码久久久久 | av电影在线观看完整版一区二区| 精品久久人人做人人爰| 琪琪一区二区三区| 777xxx欧美| 亚洲成人中文在线| 欧美日韩成人一区二区| 亚洲在线中文字幕| 日本韩国一区二区| 亚洲欧美怡红院| av一本久道久久综合久久鬼色| 国产嫩草影院久久久久| 国产一区二区三区不卡在线观看 | jizz一区二区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 亚洲777理论| 欧美日韩综合色| 亚洲图片欧美视频| 欧美怡红院视频| 亚洲专区一二三| 欧美色网一区二区| 亚洲午夜在线观看视频在线| 在线视频欧美精品| 亚洲尤物视频在线| 欧美日韩久久久一区| 亚洲成a人片在线观看中文| 欧美日韩一区 二区 三区 久久精品| 夜夜揉揉日日人人青青一国产精品| 91小视频免费看| 亚洲伦在线观看| 欧美日韩国产片| 日本亚洲电影天堂| 欧美xxxxx牲另类人与| 国产真实精品久久二三区| 久久综合狠狠综合久久激情| 国产激情91久久精品导航| 亚洲国产成人在线| 色国产精品一区在线观看| 亚洲国产va精品久久久不卡综合 | 亚洲视频一区二区在线观看| 91香蕉视频污| 亚洲一级片在线观看| 精品视频在线免费观看| 美女一区二区久久| 久久精品日韩一区二区三区| 成人午夜av在线| 一区二区国产视频| 欧美一区二区视频在线观看2022| 极品销魂美女一区二区三区| 欧美国产丝袜视频| 在线观看亚洲a| 久久精品国产在热久久| 国产精品美女久久久久aⅴ| 精品视频在线视频| 国产综合色产在线精品| 亚洲免费观看高清| 日韩欧美色电影| 99国产精品国产精品久久| 视频一区国产视频| 中文字幕乱码久久午夜不卡 | 久久成人麻豆午夜电影| 国产精品伦理在线| 欧美日韩一级大片网址| 国产精品一区二区免费不卡 | 国产福利一区二区三区视频| 成人免费在线观看入口| 欧美一区二区三区公司| aaa亚洲精品一二三区| 免费久久99精品国产| 亚洲欧洲成人自拍| 日韩三级在线观看| 在线视频国内自拍亚洲视频| 国产一区二区三区免费看| 亚洲国产成人91porn| 国产亚洲制服色| 欧美一级日韩一级| 色综合久久66| 国产成人亚洲精品狼色在线| 五月天视频一区| 亚洲欧美另类久久久精品 | 久久综合色婷婷| 欧美视频一区二区三区| 北岛玲一区二区三区四区|