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

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

?? id3inducer.java

?? ID3 分類決策數java代碼 需要ID3java代碼公用包
?? 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一区二区三区免费野_久草精品视频
首页国产丝袜综合| 亚洲综合成人在线视频| 久久机这里只有精品| 日韩亚洲欧美在线| 美女mm1313爽爽久久久蜜臀| 欧美成人欧美edvon| 国产一区不卡在线| 国产精品美女久久福利网站| 色综合久久中文字幕综合网| 亚洲一区在线观看视频| 欧美一区二区三区日韩| 久久精品国产亚洲aⅴ| 久久久久久久久久久99999| 成人h精品动漫一区二区三区| 亚洲色图视频免费播放| 欧美日韩一区三区四区| 久草中文综合在线| 亚洲视频在线观看三级| 制服丝袜中文字幕一区| 国产精品资源在线观看| 亚洲制服丝袜在线| 欧美成人video| 97精品电影院| 麻豆国产一区二区| |精品福利一区二区三区| 欧美区在线观看| 国产传媒久久文化传媒| 亚洲一区二区三区四区在线观看 | 亚洲三级在线看| 欧美日韩国产一级二级| 九九国产精品视频| 亚洲综合一二区| 国产天堂亚洲国产碰碰| 制服丝袜亚洲网站| 不卡的电影网站| 精品亚洲国产成人av制服丝袜| 国产精品对白交换视频| 日韩一区二区电影网| 91在线一区二区三区| 精品无人码麻豆乱码1区2区| 亚洲综合男人的天堂| 中国av一区二区三区| 日韩精品一区二区三区中文不卡 | 午夜电影一区二区三区| 国产精品国产三级国产有无不卡 | 国产精品一区2区| 亚瑟在线精品视频| 中文字幕日韩一区| 精品国产成人在线影院| 欧美丝袜丝nylons| 成人白浆超碰人人人人| 极品尤物av久久免费看| 亚洲电影中文字幕在线观看| 国产精品伦一区二区三级视频| 日韩视频永久免费| 欧美日韩成人综合天天影院 | 亚洲国产高清aⅴ视频| 日韩免费看网站| 欧美老女人在线| 日本精品裸体写真集在线观看| 国产激情精品久久久第一区二区| 青青草国产精品97视觉盛宴| 亚洲亚洲精品在线观看| 亚洲女同一区二区| 国产精品久久久久久妇女6080| 久久日韩精品一区二区五区| 日韩一区二区三区三四区视频在线观看| 午夜亚洲国产au精品一区二区| 中文字幕在线播放不卡一区| 久久久久久久久久久99999| 日韩精品在线看片z| 欧美一区二区三区精品| 欧美日韩视频专区在线播放| 在线观看日韩电影| 欧美午夜不卡视频| 欧美色图免费看| 欧美三级在线视频| 欧美日韩aaaaaa| 欧美另类videos死尸| 欧美精品在线观看播放| 欧美另类久久久品| 日韩午夜激情电影| 欧美成人三级电影在线| 久久伊99综合婷婷久久伊| 久久久久国色av免费看影院| 中文字幕av资源一区| 国产精品理论片| 亚洲激情一二三区| 爽好多水快深点欧美视频| 美女任你摸久久| 国产美女在线精品| 成人精品国产福利| 日本二三区不卡| 欧美高清视频在线高清观看mv色露露十八 | 精品三级av在线| 国产亚洲精品aa午夜观看| 亚洲国产成人午夜在线一区| 中文字幕在线观看一区| 亚洲欧美另类久久久精品| 亚洲国产裸拍裸体视频在线观看乱了| 天天综合色天天| 国产乱一区二区| 色综合久久综合网97色综合| 欧美另类z0zxhd电影| 久久久国产精华| 亚洲激情av在线| 蜜桃在线一区二区三区| 成人一区二区三区视频在线观看 | 老色鬼精品视频在线观看播放| 国模冰冰炮一区二区| 色综合中文字幕| 91精品国产综合久久福利软件| 久久你懂得1024| 一区二区三区四区精品在线视频| 免费日本视频一区| 成人国产精品视频| 日韩三级中文字幕| 综合中文字幕亚洲| 奇米色777欧美一区二区| 成人一区二区视频| 欧美一区二区三区喷汁尤物| 中文字幕av不卡| 日本不卡视频在线观看| gogo大胆日本视频一区| 91精品国产欧美日韩| 亚洲私人影院在线观看| 久久97超碰国产精品超碰| 91美女在线看| 国产偷国产偷亚洲高清人白洁| 午夜日韩在线电影| 972aa.com艺术欧美| 精品国内二区三区| 亚洲国产毛片aaaaa无费看| 成人h动漫精品一区二| 精品电影一区二区三区| 午夜激情综合网| 欧美影院一区二区三区| 国产精品久久99| 国产成人三级在线观看| 欧美一区二区网站| 亚洲夂夂婷婷色拍ww47| 91在线一区二区三区| 国产视频一区二区在线| 久久成人免费网| 欧美一区二区三区四区高清| 亚洲精品国产第一综合99久久 | 国产麻豆精品久久一二三| 欧美群妇大交群中文字幕| 亚洲美女区一区| proumb性欧美在线观看| 国产欧美一区二区三区鸳鸯浴 | 国产成a人亚洲精| 精品电影一区二区三区| 美女国产一区二区三区| 欧美日韩高清一区二区不卡| 一区二区三区免费网站| 一本色道久久综合亚洲精品按摩| 中文幕一区二区三区久久蜜桃| 国产很黄免费观看久久| 久久久三级国产网站| 国产精品91一区二区| 国产亚洲一区二区三区四区 | 蜜桃av一区二区| 91精品国产综合久久久蜜臀图片 | 国产揄拍国内精品对白| 日韩欧美一二三区| 麻豆中文一区二区| 26uuu国产日韩综合| 国产精品一区二区久久不卡| 久久精品视频一区二区三区| 国产剧情一区在线| 国产精品久久久久aaaa| 91老师片黄在线观看| 亚洲精品美国一| 欧美日韩成人高清| 免费观看在线综合色| 精品国产乱码久久久久久夜甘婷婷 | 欧美激情一区三区| 99久久精品国产毛片| 中文字幕一区二区三| 在线观看区一区二| 免费成人性网站| 亚洲精品一区二区三区精华液| 国产成人久久精品77777最新版本| 欧美激情一区二区三区蜜桃视频| 不卡电影一区二区三区| 亚洲欧美韩国综合色| 欧美日韩美女一区二区| 久久精品99国产精品| 国产精品久久久久婷婷| 色婷婷综合久久久久中文一区二区 | 日韩毛片在线免费观看| 在线免费不卡电影| 免费观看成人鲁鲁鲁鲁鲁视频| 精品国产免费一区二区三区四区 | 色呦呦一区二区三区| 午夜精品视频一区| 精品国产91洋老外米糕| 99视频精品全部免费在线| 亚洲一区二三区|