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

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

?? id3inducer.java

?? java數據挖掘算法
?? 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一区二区三区免费野_久草精品视频
91丨九色丨蝌蚪丨老版| 久久你懂得1024| 亚洲图片有声小说| 欧美日韩一级二级| 久久成人综合网| 久久精子c满五个校花| av不卡免费电影| 亚洲五码中文字幕| 国产香蕉久久精品综合网| 97久久精品人人爽人人爽蜜臀| 日韩一区有码在线| 欧美一区二区三区视频免费播放| 麻豆视频一区二区| 亚洲欧美电影一区二区| 欧美成人a视频| 色呦呦网站一区| 精品亚洲成a人在线观看| 国产精品久久久久久久久快鸭| 欧美主播一区二区三区美女| 激情亚洲综合在线| 国产拍欧美日韩视频二区| 欧美色图片你懂的| 91亚洲精品一区二区乱码| 精品一区二区三区在线观看国产| 亚洲黄色小说网站| 综合久久久久久| 欧美国产精品中文字幕| 久久久影视传媒| 久久久美女艺术照精彩视频福利播放| 亚洲乱码精品一二三四区日韩在线| 国产精品影视网| 国产精品一二一区| 日韩一区二区免费在线电影| 欧洲在线/亚洲| 日韩欧美专区在线| 精品国产91洋老外米糕| 国产精品久久一级| 日本不卡在线视频| 在线观看日韩精品| 欧美国产日韩在线观看| 麻豆精品国产91久久久久久| 欧美图区在线视频| 国产精品成人免费在线| 国产精品123| 欧美福利一区二区| 久久综合成人精品亚洲另类欧美 | 国产a久久麻豆| 本田岬高潮一区二区三区| 欧美日韩在线综合| 国产精品免费看片| 精品综合久久久久久8888| 色综合天天天天做夜夜夜夜做| 欧美美女黄视频| 国产精品成人在线观看| 美腿丝袜亚洲色图| 91蜜桃在线免费视频| 国产蜜臀97一区二区三区| 蜜臀精品一区二区三区在线观看| 中文字幕欧美激情一区| 亚洲美女区一区| 狠狠网亚洲精品| 欧美哺乳videos| 日本视频一区二区| 欧美一级日韩一级| 亚洲丶国产丶欧美一区二区三区| 久久爱www久久做| 欧美日韩你懂得| 日韩—二三区免费观看av| 91日韩精品一区| 国产精品第13页| 99re66热这里只有精品3直播| 国产精品久久毛片a| 成人av综合在线| 亚洲乱码国产乱码精品精的特点 | 色八戒一区二区三区| 亚洲日本一区二区三区| 色噜噜狠狠色综合欧洲selulu| 免费看欧美美女黄的网站| 亚洲综合在线电影| 国产精品久久福利| 中文字幕免费不卡| 精品日本一线二线三线不卡| 成人h精品动漫一区二区三区| 亚洲精品免费看| 国产三级精品视频| 欧美日韩国产乱码电影| 国产精品亚洲一区二区三区在线| 久久久久国产精品厨房| 91久久精品国产91性色tv| 久久99久久久久| 亚洲一区二区三区四区在线| 久久综合五月天婷婷伊人| 欧美日韩和欧美的一区二区| 国产精品99久久久久久久vr| 日韩二区在线观看| 亚洲私人黄色宅男| 国产色一区二区| 精品久久免费看| 亚洲免费观看高清在线观看| 国产精品一区免费在线观看| 亚洲精品欧美激情| 伊人色综合久久天天人手人婷| 香港成人在线视频| 亚洲欧洲三级电影| 亚洲视频狠狠干| 亚洲va欧美va国产va天堂影院| 天天亚洲美女在线视频| 丝袜亚洲另类欧美| 国产精品中文字幕欧美| 99久久99久久免费精品蜜臀| 欧洲中文字幕精品| 精品久久久久一区| 亚洲精品一区二区三区蜜桃下载| 91一区二区三区在线观看| 欧美激情一区二区三区蜜桃视频| 蜜臀精品久久久久久蜜臀| 国产色婷婷亚洲99精品小说| 欧美自拍偷拍一区| 国产激情91久久精品导航| 亚洲主播在线观看| 国产日本亚洲高清| 88在线观看91蜜桃国自产| 国产伦精品一区二区三区视频青涩| 亚洲欧洲av在线| 国产色一区二区| xnxx国产精品| 久久婷婷国产综合精品青草| 在线视频国内自拍亚洲视频| 国产激情视频一区二区三区欧美| 亚洲成人免费视| 国产精品污污网站在线观看| 日韩欧美你懂的| 在线播放日韩导航| 91精品婷婷国产综合久久| 色天使久久综合网天天| k8久久久一区二区三区| 国产精一品亚洲二区在线视频| 天堂av在线一区| 日本不卡的三区四区五区| 亚洲一区二区三区不卡国产欧美| 日韩一区在线看| 紧缚奴在线一区二区三区| 国产一区二区三区四| 日韩精品欧美精品| 久久国产精品99精品国产| 欧美日韩aaa| 日韩欧美一级二级三级| 日韩一区在线免费观看| 欧美综合欧美视频| 久久午夜电影网| 欧洲日韩一区二区三区| 美女一区二区视频| 日本在线播放一区二区三区| 一区二区免费看| 免费人成在线不卡| 国产成人av电影在线播放| 91黄色免费看| 26uuu亚洲| 夜夜嗨av一区二区三区网页| 奇米影视一区二区三区小说| 成人av免费网站| 91精品国产福利在线观看| 国产精品午夜在线| 日韩精品国产欧美| 国产成人亚洲综合a∨猫咪| 欧美三电影在线| 亚洲同性同志一二三专区| 秋霞电影网一区二区| 不卡的电影网站| 久久理论电影网| 日韩福利视频导航| 欧美自拍偷拍一区| 国产精品污网站| 精品亚洲成a人| 亚洲精品在线三区| 日韩国产精品91| 色国产综合视频| 亚洲精品国产一区二区精华液| 国产又粗又猛又爽又黄91精品| 欧美绝品在线观看成人午夜影视| 国产精品白丝在线| 久久国内精品自在自线400部| 欧美日韩免费一区二区三区视频| 一区二区三区小说| 色激情天天射综合网| 伊人性伊人情综合网| 色综合久久久久久久久久久| 亚洲色图欧洲色图| 欧美久久高跟鞋激| 污片在线观看一区二区| 777xxx欧美| 久久激情五月激情| 国产精品网站在线播放| 91一区在线观看| 丝袜美腿亚洲一区二区图片| 综合久久国产九一剧情麻豆| 欧美日韩一本到| 欧美一级电影网站| 日韩女优毛片在线| 91日韩在线专区|