亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩av成人高清| 欧美mv和日韩mv的网站| 天天综合日日夜夜精品| 欧美一区二区三区啪啪| 国产精品一区2区| 欧美麻豆精品久久久久久| 国模少妇一区二区三区| 久久精品欧美日韩精品| 日本不卡一区二区三区| 国产欧美精品一区二区色综合| 91在线观看下载| 亚洲第一福利视频在线| 欧美午夜在线观看| 国产在线精品一区在线观看麻豆| 亚洲天天做日日做天天谢日日欢| 777奇米成人网| 成人手机电影网| 日韩av电影天堂| 伊人色综合久久天天人手人婷| 欧美日韩在线一区二区| 国产成人av一区二区三区在线| 亚洲午夜久久久久久久久电影网| 国产亚洲一本大道中文在线| 色一区在线观看| 韩国女主播成人在线观看| 亚洲福利一区二区| 日韩精品一区二区三区在线| 午夜私人影院久久久久| 欧美国产精品一区二区三区| 91精品国产综合久久久久久| 91在线国内视频| 成人久久18免费网站麻豆 | 欧美激情一区二区在线| 日韩免费视频一区二区| 日本国产一区二区| 国产精品亚洲成人| 欧美国产一区视频在线观看| av在线综合网| 久久久精品国产免大香伊| 国产精品99久久久久| 日韩国产欧美在线播放| 久久亚洲捆绑美女| 精品国产一二三| 69久久夜色精品国产69蝌蚪网| 色综合亚洲欧洲| 国产老妇另类xxxxx| 午夜伦理一区二区| 成人欧美一区二区三区小说| 国产色产综合色产在线视频| 欧美精品第1页| 欧美日韩一区国产| 在线一区二区视频| 一本色道久久综合亚洲aⅴ蜜桃| 99久久精品免费观看| 成人av动漫在线| av在线这里只有精品| 国产精品亚洲第一| 亚洲激情第一区| 亚洲一区在线观看免费 | 国产乱码精品一区二区三区忘忧草 | 亚洲与欧洲av电影| 成人h动漫精品一区二区| 精品视频免费在线| 色老汉一区二区三区| 色噜噜夜夜夜综合网| 欧美日本国产视频| 欧美日韩成人综合天天影院| 欧美日本一道本在线视频| 欧美精品 国产精品| 久久青草欧美一区二区三区| 久久精品一区二区三区av| 国产视频一区二区在线观看| 国产偷国产偷精品高清尤物| 风间由美性色一区二区三区| 色8久久人人97超碰香蕉987| 一本久久综合亚洲鲁鲁五月天| 色欧美乱欧美15图片| www.久久精品| 欧美狂野另类xxxxoooo| 欧美一区二区在线视频| 精品伦理精品一区| 欧美日韩国产高清一区二区三区| 精品理论电影在线| 国产精品久久久久久久蜜臀| 久久精品一区八戒影视| 国产精品乱码一区二三区小蝌蚪| 国产精品美女一区二区三区| 国产精品萝li| 亚洲高清视频在线| 另类小说色综合网站| 成人毛片老司机大片| 欧美肥胖老妇做爰| 国产丝袜在线精品| 一区二区三区蜜桃| 日本午夜一区二区| 粉嫩在线一区二区三区视频| 欧美亚洲国产一区二区三区va| 欧美电视剧在线观看完整版| 国产精品久久网站| 亚洲男人的天堂一区二区| 日产欧产美韩系列久久99| 国产精品一级片在线观看| 91精品办公室少妇高潮对白| 久久精品一区二区三区av | 国产欧美一区二区精品久导航| 亚洲欧美日韩久久精品| 极品少妇一区二区| 91麻豆国产在线观看| 欧美一级久久久| 中文一区一区三区高中清不卡| 日韩精品成人一区二区三区| 成人精品亚洲人成在线| 在线电影欧美成精品| 国产亚洲欧美日韩日本| 午夜欧美在线一二页| 风间由美一区二区三区在线观看| 777a∨成人精品桃花网| 亚洲视频每日更新| 国产一区二区三区观看| 欧美亚洲一区二区在线| 中文字幕+乱码+中文字幕一区| 黄一区二区三区| 欧美色图一区二区三区| 久久久久久久av麻豆果冻| 亚洲成人免费视频| 一本大道av一区二区在线播放| 91在线porny国产在线看| 日韩欧美一区二区久久婷婷| 一个色在线综合| 国产精品自在在线| 欧美男人的天堂一二区| 精品国精品国产| 亚洲不卡一区二区三区| 欧美性欧美巨大黑白大战| 国产精品伦一区二区三级视频| 久久丁香综合五月国产三级网站| 久久亚洲一区二区三区明星换脸| 麻豆精品视频在线| 欧美亚洲动漫另类| 91官网在线免费观看| 麻豆精品久久精品色综合| 欧美日韩一二区| 亚洲自拍欧美精品| 在线亚洲人成电影网站色www| 亚洲视频狠狠干| 99视频一区二区| 亚洲欧美乱综合| 色婷婷综合久久久久中文 | 欧美卡1卡2卡| 视频在线观看一区| 精品美女被调教视频大全网站| 视频在线观看91| 91成人免费网站| 日韩av一区二区在线影视| 欧美一级xxx| 国产精品一区二区久久不卡| 亚洲国产精品ⅴa在线观看| av一区二区三区| 一区二区国产视频| 欧美精品在线观看播放| 久久99九九99精品| 欧美激情资源网| 日本道色综合久久| 人人狠狠综合久久亚洲| 久久久影视传媒| 91香蕉视频mp4| 五月婷婷激情综合| 久久蜜桃香蕉精品一区二区三区| 成人精品在线视频观看| 亚洲一区二区三区精品在线| 日韩欧美国产一区二区三区| 国产成人无遮挡在线视频| 亚洲精品美国一| 日韩一区二区三免费高清| 国产精华液一区二区三区| 伊人色综合久久天天| 日韩精品一区二区三区视频| 99久久精品情趣| 免费在线观看一区二区三区| 欧美国产精品一区二区| 91精品久久久久久久久99蜜臂| 国产真实精品久久二三区| 玉足女爽爽91| 久久综合资源网| 欧洲av在线精品| 国产成人综合在线观看| 亚洲午夜激情av| 国产欧美日韩三级| 911精品产国品一二三产区| 国产91丝袜在线播放九色| 午夜精彩视频在线观看不卡| 中文字幕不卡在线播放| 在线不卡的av| 91小视频在线免费看| 极品尤物av久久免费看| 五月综合激情网| 综合久久久久久| 久久久精品综合| 欧美一区二区在线看| 色天天综合色天天久久|