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

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

?? id3inducer.java

?? 用JAVA實現的C4.5算法
?? 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一区二区三区免费野_久草精品视频
精品在线播放免费| 日本欧美在线观看| 成人理论电影网| 国产精品丝袜久久久久久app| 国内精品写真在线观看| 欧美激情一区二区三区蜜桃视频 | 91福利资源站| 亚洲国产精品一区二区久久 | 国产日韩欧美a| 播五月开心婷婷综合| 尤物视频一区二区| 欧美日韩二区三区| 精品在线观看视频| 国产精品国产三级国产普通话蜜臀 | 亚洲第一搞黄网站| 精品日产卡一卡二卡麻豆| 国产一区二区三区四区在线观看 | 成人国产精品免费观看| 有码一区二区三区| 精品理论电影在线观看| 成人av资源站| 午夜国产精品影院在线观看| 精品免费国产二区三区 | 亚洲欧美国产三级| 欧美一区二区精品在线| 懂色av一区二区在线播放| 亚洲美女淫视频| 日韩亚洲欧美一区| 99视频精品免费视频| 日本中文在线一区| 亚洲三级免费观看| 91精品国产综合久久精品图片| 国产一区欧美一区| 亚洲综合免费观看高清在线观看| 亚洲精品在线一区二区| 色偷偷一区二区三区| 国内精品自线一区二区三区视频| 一区二区三区四区中文字幕| 精品国产91洋老外米糕| 在线精品视频一区二区| 国产电影精品久久禁18| 丝袜美腿亚洲一区二区图片| 国产精品午夜免费| 精品国产乱码久久久久久影片| 不卡一区二区三区四区| 久久国产精品一区二区| 亚洲一区二区欧美激情| 亚洲国产精品精华液ab| 91精品国产综合久久精品麻豆| 色综合色狠狠天天综合色| 国产乱国产乱300精品| 视频一区二区国产| 亚洲一区二区在线视频| 国产精品久久毛片a| 精品国精品自拍自在线| 欧美日本在线看| 色婷婷久久一区二区三区麻豆| 国产高清精品在线| 久久国产精品色婷婷| 日韩精品五月天| 亚洲大片精品永久免费| 亚洲美女在线国产| 亚洲女与黑人做爰| 亚洲国产成人自拍| 国产日韩三级在线| 久久久久久久久一| 久久色在线视频| 精品国产免费一区二区三区四区| 制服丝袜国产精品| 欧美日精品一区视频| 色综合夜色一区| 99国产精品国产精品毛片| 国产成人免费网站| 高清不卡一区二区在线| 国产精品一区二区三区乱码| 国产乱子轮精品视频| 韩国欧美一区二区| 国产传媒一区在线| 懂色av一区二区在线播放| 岛国一区二区在线观看| 成人网在线播放| 成人高清在线视频| 色婷婷av一区二区三区之一色屋| 色猫猫国产区一区二在线视频| 色综合久久88色综合天天免费| 99久久久精品| 91福利在线免费观看| 欧美日韩精品欧美日韩精品一综合| 欧美视频一区二| 制服.丝袜.亚洲.中文.综合| 欧美一级理论片| 久久久精品免费观看| 国产精品久久久久久亚洲毛片| 亚洲欧洲日韩av| 亚洲成人777| 久久99日本精品| 丰满少妇久久久久久久| 99精品久久久久久| 欧美性猛交xxxxxx富婆| 日韩一区二区三区电影| wwwwxxxxx欧美| 国产精品三级久久久久三级| 亚洲六月丁香色婷婷综合久久| 亚洲观看高清完整版在线观看| 日日摸夜夜添夜夜添精品视频| 精品无人码麻豆乱码1区2区| 成人一级片在线观看| 在线观看区一区二| 精品人在线二区三区| 中文字幕一区二区5566日韩| 亚洲综合网站在线观看| 加勒比av一区二区| 91丨九色porny丨蝌蚪| 69堂成人精品免费视频| 国产精品网友自拍| 亚洲mv在线观看| 成人做爰69片免费看网站| 欧美性高清videossexo| 久久先锋影音av鲁色资源网| 不卡一二三区首页| 成人免费毛片嘿嘿连载视频| 91香蕉视频黄| 日韩亚洲欧美高清| 亚洲人成网站色在线观看| 日本一不卡视频| 大胆亚洲人体视频| 欧美一级欧美三级在线观看| 国产欧美中文在线| 亚州成人在线电影| 99久久99久久精品免费看蜜桃| 欧美一级黄色大片| 亚洲在线视频免费观看| 国产精品一卡二| 51精品视频一区二区三区| 中文字幕日韩一区| 国产主播一区二区| 欧美人与z0zoxxxx视频| 中文字幕在线不卡| 国产一区欧美二区| 日韩精品中文字幕在线不卡尤物| 日韩美女精品在线| 国产精品一区二区黑丝| 欧美人动与zoxxxx乱| 亚洲日本乱码在线观看| 国产二区国产一区在线观看| 7777精品伊人久久久大香线蕉最新版| 亚洲视频在线一区| 国产乱码精品一区二区三区av| 欧美一区二区三区免费视频 | 国产精品亚洲一区二区三区在线| 欧美久久久久中文字幕| 亚洲欧美另类在线| 99久久久国产精品| 国产精品丝袜一区| 精品国产91亚洲一区二区三区婷婷| 国产99久久久精品| 欧美一级国产精品| 亚洲成人免费av| 91美女在线视频| 综合激情成人伊人| caoporm超碰国产精品| 欧美国产精品一区二区三区| 国内精品国产三级国产a久久| 91精品在线麻豆| 欧美aaa在线| 91精品国产色综合久久不卡蜜臀 | 久久精品一区二区三区av| 免费成人在线视频观看| 7777精品伊人久久久大香线蕉完整版| 一区二区久久久久久| 91成人看片片| 亚洲一卡二卡三卡四卡五卡| 欧美色老头old∨ideo| 亚洲高清免费视频| 欧美午夜精品免费| 婷婷综合久久一区二区三区| 精品1区2区3区| 日本不卡免费在线视频| 精品久久久久一区| 国产精品一区二区三区99| 中文字幕国产一区二区| 91在线高清观看| 亚洲午夜久久久久中文字幕久| 欧美日韩亚洲另类| 久久成人久久鬼色| 亚洲精品国产一区二区精华液 | 一区二区免费看| 欧美日韩国产经典色站一区二区三区| 亚洲第一综合色| 欧美电视剧在线看免费| 国产一区二区伦理| 国产精品每日更新在线播放网址| jlzzjlzz亚洲女人18| 亚洲一区二区免费视频| 91精品国产综合久久精品性色| 老司机午夜精品| 久久久www成人免费毛片麻豆| 成人黄色777网| 午夜精品视频一区| 久久无码av三级|