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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? splitscore.java

?? 本程序是用java語言編寫的數(shù)據(jù)挖掘分類算法中的決策樹分類方法c4.5程序代碼
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
package shared;
import java.lang.*;
import java.io.*;
/** A class for determining, holding, and returning the information associated
 * with an attribute split. Uses methods from the Entropy class for the
 * determination of the scores.
 * The scores for a specific item are cached in an internal cache structure.
 * This structure contains the entropy, conditional entropy, split entropy,
 * mutual information, gain ratio, split distribution, label distribution, and
 * the number of instances that these scores have been evaluated on. Access to
 * scores that have been cached are constant time, while items that need
 * refreshment have a longer access time for recalculation.
 * @author James Louis   Initial Java implementation.
 * @author Eric Eros     Initial revision                        7/08/96
 */

public class SplitScore {
    //ENUMS
    /** Value indicating how splits are scored.
     */
    public static final byte mutualInfo = 0;          /* SplitScoreCriterion enum */
    /** Value indicating how splits are scored.
     */
    public static final byte normalizedMutualInfo = 1;/*                          */
    /** Value indicating how splits are scored.
     */
    public static final byte gainRatio = 2;           /*                          */
    /** Value indicating how splits are scored.
     */
    public static final byte mutualInfoRatio = 3;     /*                          */
    /** Value indicating how splits are scored.
     */
    public static final byte externalScore = 4;       /*                          */
    //END ENUM
    
    /** Default criterion for determining the score of a particular split.
     * @see #mutualInfo
     * @see #normalizedMutualInfo
     * @see #gainRatio
     * @see #mutualInfoRatio
     * @see #externalScore
     */
    public static byte defaultSplitScoreCriterion = normalizedMutualInfo;
    /** String names for each form of split criterion. **/
    public static String[] splitScoreCriterionEnum = {"mutualInfo",
    "normalizedMutualInfo","gainRatio","mutualInfoRatio","externalScore"};
    
    /***************************************************************************
     *Cache structure for storing scores from sets of instances. Stores the
     *information for the entropy, conditional entropy, split entropy,
     *mutual information, gain ratio, split distribution, label distribution,
     *and the number of instances that these scores have been evaluated on.
     **************************************************************************/
    private class CacheStruct {
        /** Mutual Information calculation. **/
        public double mutualInfo;
        /** Distribution of attribute splits over the set of instances. **/
        public double[] splitDist;
        /** Distribution of labels over the set of instances. **/
        public double[] labelDist;
        /** The total weight of the set of instances. **/
        public double totalWeight;
        /** The entropy calculation. **/
        public double entropy;
        /** The gain ratio calculation. **/
        public double gainRatio;
        /** The entropy for the split examined. **/
        public double splitEntropy;
        /** The conditional entropy calculation for the split examined. **/
        public double condEntropy;
        
        /** Cache Constructor.
         */
        public CacheStruct() {
            totalWeight = Globals.UNDEFINED_REAL;
            entropy = Globals.UNDEFINED_REAL;
            mutualInfo = Globals.UNDEFINED_REAL;
            condEntropy = Globals.UNDEFINED_REAL;
            gainRatio = Globals.UNDEFINED_REAL;
            splitEntropy = Globals.UNDEFINED_REAL;
            splitDist = null;
            labelDist = null;
        }
        
        /** Copies the specified CacheStruct to this CacheStruct instance.
         * @param source The CacheStruct to be copied from.
         */
        public void copy(CacheStruct source) {
            totalWeight = source.totalWeight;
            entropy = source.entropy;
            mutualInfo = source.mutualInfo;
            condEntropy = source.condEntropy;
            gainRatio = source.gainRatio;
            splitEntropy = source.splitEntropy;
            splitDist = source.splitDist;
            labelDist = source.labelDist;
        }
        
        /** Cache copy constructor.
         * @param source The CacheStruct to be copied from.
         */
        public CacheStruct(CacheStruct source) {
            copy(source);
        }
        
        /** Assignment of specified CacheStruct to this CacheStruct instance.
         * @param source The CacheStruct to be copied.
         * @return This CacheStruct.
         */
        public CacheStruct assign(CacheStruct source) {
            copy(source);
            return this;
        }
    }
    
    /** Cache of calculated data. **/
    private CacheStruct cache;
    
    /** A matrix of labels(rows) by splits (columns). **/
    private double[][] splitAndLabelDist; //row, column
    /** Indicator of wether cache is filled with calculations. TRUE indicates
     *the values are in place, FALSE otherwise. **/
    private boolean validCache;
    /** Type of criterion used for examining the attribute split. **/
    private byte splitScoreCriterion;
    private double theExternalScore;
    
    /** Logging options for this class. **/
    protected LogOptions logOptions = new LogOptions();
    
    /** Sets the logging level for this object.
     * @param level  The new logging level.
     */
    public void set_log_level(int level){logOptions.set_log_level(level);}
    
    /** Returns the logging level for this object.
     * @return The level of logging in this class.
     */
    public int  get_log_level(){return logOptions.get_log_level();}
    
    /** Sets the stream to which logging options are displayed.
     * @param strm   The stream to which logs will be written.
     */
    public void set_log_stream(Writer strm)
    {logOptions.set_log_stream(strm);}
    
    /** Returns the stream to which logs for this object are written.
     * @return The stream to which logs for this object are written.
     */
    public Writer get_log_stream(){return logOptions.get_log_stream();}
    
    /** Returns the LogOptions object for this object.
     * @return The LogOptions object for this object.
     */
    public LogOptions get_log_options(){return logOptions;}
    
    /** Sets the LogOptions object for this object.
     * @param opt    The new LogOptions object.
     */
    public void set_log_options(LogOptions opt)
    {logOptions.set_log_options(opt);}
    
    /** Sets the logging message prefix for this object.
     * @param file   The file name to be displayed in the prefix of log messages.
     * @param line   The line number to be displayed in the prefix of log messages.
     * @param lvl1   The log level of the statement being logged.
     * @param lvl2   The level of log messages being displayed.
     */
    public void set_log_prefixes(String file, int line,int lvl1, int lvl2)
    {logOptions.set_log_prefixes(file, line, lvl1, lvl2);}
    
    /** Copy Constructor.
     * @param source The SplitScore to be copied.
     */
    public SplitScore(SplitScore source) {
        cache = new CacheStruct();
        splitAndLabelDist = null;
        cache.splitDist = null;
        cache.labelDist = null;
        reset();
        splitScoreCriterion = source.splitScoreCriterion;
        copy_split_and_label_dist(source);
        // Must initialize after reset
        theExternalScore = source.theExternalScore;
    }
    
    /** Constructor.
     */
    public SplitScore() {
        cache = new CacheStruct();
        splitAndLabelDist = null;
        cache.splitDist = null;
        cache.labelDist = null;
        reset();
        splitScoreCriterion = defaultSplitScoreCriterion;
    }
    
    /** Returns the mutual info (information gain) score for the split this
     * SplitScore object represents. Created to avoid JVM error.
     * @return The unnormalized mutual info for this split.
     */
    public double get_unnormalized_mutual_info() {
        valid_cache(); // Percolate validCache to the cache members.
        if ((cache.mutualInfo == Globals.UNDEFINED_REAL) && (has_distribution(true)))
            cache.mutualInfo =
            Entropy.mutual_info(get_entropy(), get_split_and_label_dist(),
            get_split_dist(), total_weight());
        return cache.mutualInfo;
    }
    
    /** Returns the mutual info (information gain) score for the split this
     * SplitScore object represents. This method updates the cache.
     * @param normalize TRUE if normalization is requested, FALSE otherwise.
     * @return The mutual info value for this split.
     */
    public double get_mutual_info(boolean normalize) {
        valid_cache(); // Percolate validCache to the cache members.
        if ((cache.mutualInfo == Globals.UNDEFINED_REAL) && (has_distribution(true)))
            cache.mutualInfo =
            Entropy.mutual_info(get_entropy(), get_split_and_label_dist(),
            get_split_dist(), total_weight());
        return normalize ?
        normalize_by_num_splits(cache.mutualInfo) : cache.mutualInfo;
    }
    
    /** Normalize by the number of splits. Divide by (the number of bits needed to store
     * the value (number of splits - 1)). This method updates the cache.
     *
     * @param score The score to be normalized.
     * @return The normalized score value.
     */
    public double normalize_by_num_splits(double score) {
        int numSplits = num_splits();
        if (numSplits <= 0)
            Error.err("SplitScore::normalize_by_num_splits: number of splits "+
            "not greater than 0: " + num_splits() + "-->fatal_error");
        // If num_splits is 1 or 2, it becomes 2, with the log_2(2) == 1
        if (numSplits >= 3)
            // There may be only one value and it's useful because of
            //   unknowns.  We therefore divide by max(2, value)
            score /= Entropy.log_bin(numSplits);
        
        //            score /= Math.log((double)numSplits);// /Math.log(2.0);
        return score;
    }
    
    /** Returns the number of splits--not including unknowns. This method updates the
     * cache.
     * @return The number of splits.
     */
    public int num_splits() {
        valid_cache(); // Percolate validCache to the cache members.
        int numSplits = Globals.UNDEFINED_INT;
        if (has_distribution(true)) {
            get_split_dist(); // Ensure the distribution is non-NULL.
            // Note that by looking at high, we ignore the UNKNOWN edge
            //   if it exists.
            numSplits = cache.splitDist.length - 1;
            //obs cache.splitDist.high() + 1;
            //The -1 is to offset the movement of unknown values to array index
            //zero. Only the number of actual values for the split should
            //be returned. -JL
        }
        return numSplits;
    }
    
    /** The split distribution is calculated from the split and label distribution.
     *
     * @return The split distribution.
     */
    public double[] get_split_dist() {
        valid_cache(); // Percolate validCache to the cache members.
        if (cache.splitDist != null)
            return (cache.splitDist);
        if (!has_distribution(false))
            Error.err("SplitScore::get_split_dist: splitAndLabelDist has not "+
            "been set-->fatal_error");
        else {
            cache.splitDist = new double[splitAndLabelDist[0].length];
            Matrix.sum_cols(cache.splitDist,splitAndLabelDist);
        }
        return (cache.splitDist);
    }
    
    
    /** Checks if there exists a splitAndLabel distribution.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区久久久| 亚洲色图丝袜美腿| 麻豆成人91精品二区三区| 91麻豆精品久久久久蜜臀| 日韩国产欧美在线视频| 91精品国产综合久久香蕉麻豆 | 国产欧美日韩卡一| 国产成人午夜精品5599| 久久久精品综合| 成人av电影在线观看| 成人欧美一区二区三区视频网页 | 91看片淫黄大片一级在线观看| 亚洲精品一二三| 欧美色电影在线| 国产在线视频一区二区三区| 国产色综合久久| 91国在线观看| 美女一区二区久久| 日本一区二区三区视频视频| 一本高清dvd不卡在线观看| 亚洲二区视频在线| 精品久久久久久最新网址| 国产精品亚洲第一区在线暖暖韩国| 国产精品久久久一本精品| 在线精品视频一区二区| 久久国产婷婷国产香蕉| 国产精品久久毛片a| 欧美日韩精品一区二区三区蜜桃| 国产在线视频不卡二| 亚洲蜜臀av乱码久久精品蜜桃| 91麻豆精品国产91久久久久久 | 亚洲成年人网站在线观看| 亚洲一区二区三区国产| 欧美在线视频不卡| 国产一区二区在线视频| 亚洲最大色网站| 国产欧美精品日韩区二区麻豆天美| 一本色道综合亚洲| 国产在线精品一区二区夜色| 亚洲人精品一区| 久久精品一区蜜桃臀影院| 欧美日韩卡一卡二| 成人app软件下载大全免费| 免费视频一区二区| 一区二区三区日韩欧美| 久久久五月婷婷| 6080午夜不卡| 91国内精品野花午夜精品| 国产在线播放一区| 日韩电影在线观看网站| 综合久久综合久久| 久久精品一区蜜桃臀影院| 欧美高清精品3d| 一本色道久久综合亚洲精品按摩| 国产一区二区女| 老司机免费视频一区二区三区| 亚洲女爱视频在线| 中文字幕精品在线不卡| 日韩免费高清av| 欧美老年两性高潮| 在线观看日韩电影| 91同城在线观看| 懂色一区二区三区免费观看| 麻豆国产欧美一区二区三区| 午夜精品福利视频网站| 亚洲主播在线观看| 樱花草国产18久久久久| 日韩一区日韩二区| 国产精品美女www爽爽爽| 久久夜色精品一区| 久久蜜桃av一区二区天堂| 日韩欧美国产午夜精品| 日韩女优制服丝袜电影| 欧美精三区欧美精三区| 欧美日韩成人在线一区| 欧美无人高清视频在线观看| 色香色香欲天天天影视综合网| av在线这里只有精品| 99精品视频免费在线观看| av在线一区二区| 色综合天天做天天爱| 99九九99九九九视频精品| 成人白浆超碰人人人人| 不卡一区二区在线| 色丁香久综合在线久综合在线观看| 成人91在线观看| 91视频国产资源| 欧美日韩一本到| 日韩午夜精品视频| 久久久久久久综合日本| 日本一区二区三区dvd视频在线| 久久精品这里都是精品| 国产欧美日韩在线| 亚洲码国产岛国毛片在线| 亚洲综合色成人| 日本欧美在线观看| 黄色日韩三级电影| av一本久道久久综合久久鬼色| 91视频精品在这里| 6080亚洲精品一区二区| 精品国产一区二区三区不卡 | 免费在线看一区| 国产麻豆视频一区二区| 国产成人a级片| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 色94色欧美sute亚洲线路一久| 91国产免费观看| 日韩美女天天操| 中文字幕av资源一区| 一区二区三区四区蜜桃 | 日韩精品福利网| 国产一区欧美二区| 在线中文字幕不卡| 日韩三级高清在线| 中文字幕亚洲电影| 麻豆freexxxx性91精品| 不卡一区在线观看| 欧美一个色资源| 中文字幕亚洲精品在线观看| 午夜久久久影院| 国产一区 二区| 91黄色免费看| 久久青草欧美一区二区三区| 亚洲美女区一区| 国产在线精品一区二区三区不卡| 色婷婷激情久久| 久久久国际精品| 亚洲观看高清完整版在线观看| 久久99久国产精品黄毛片色诱| 91一区二区在线| 久久九九国产精品| 日韩国产精品大片| 91免费在线看| 中文一区二区在线观看| 青青国产91久久久久久| 色综合一个色综合| 日本一区二区三区dvd视频在线 | 最近日韩中文字幕| 黄页视频在线91| 91麻豆精品国产自产在线观看一区 | 91麻豆精品国产91久久久久| 亚洲欧洲国产专区| 欧美精品一卡二卡| 中文字幕亚洲在| 国产91精品一区二区麻豆网站| 在线观看91av| 香蕉久久一区二区不卡无毒影院| av在线不卡免费看| 国产亚洲精品超碰| 免费视频最近日韩| 欧美精品少妇一区二区三区| 亚洲免费av高清| 91麻豆国产香蕉久久精品| 久久女同互慰一区二区三区| 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美在线啊v一区| 亚洲精选视频在线| 99re热这里只有精品免费视频| 久久久久久麻豆| 国产成人综合在线播放| 精品福利二区三区| 国内久久精品视频| 日韩午夜在线影院| 乱一区二区av| 精品区一区二区| 激情欧美一区二区三区在线观看| 91精品在线麻豆| 免费精品视频在线| 日韩欧美精品在线视频| 美女国产一区二区三区| 欧美一级久久久| 激情综合五月天| 久久久777精品电影网影网| 麻豆国产精品一区二区三区| 欧美成人精品二区三区99精品| 美女一区二区三区| 国产亚洲女人久久久久毛片| 黑人巨大精品欧美黑白配亚洲| 久久奇米777| a级高清视频欧美日韩| 亚洲欧美国产毛片在线| 色综合久久久久| 丝袜诱惑制服诱惑色一区在线观看| 欧美日韩激情一区二区三区| 午夜精品成人在线| 亚洲精品在线一区二区| 国产福利一区在线| 成人欧美一区二区三区小说 | 欧美精品久久一区二区三区| 日本不卡视频在线| 亚洲精品一区二区三区影院 | 欧日韩精品视频| 免费高清成人在线| 久久久久国产精品麻豆ai换脸 | 99免费精品在线| 午夜av一区二区| wwww国产精品欧美| 色综合视频在线观看| 日韩—二三区免费观看av| 久久久久青草大香线综合精品|