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

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

?? entropy.java

?? java數據挖掘算法
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
        return H.value;
    }
    
    /** Computes conditional entropy of the label given attribute X. From Ross,
     * Conditional entropy is defined as:                                          <BR>
     *             H(Y|X) = sum_x H(Y|X=x)*P(X=x).                            <BR>
     *                    = sum_x (-sum_y p(Y=y|X=x)log p(Y=y|X=x)) * P(X=x)  <BR>
     *             now derive Pagallo & Haussler's formula                    <BR>
     *                    = -sum_{x,y} p(Y=y, X=x) log p(Y=y|X=x)             <BR>
     *             Here we estimate p(Y=y, X=x) by counting, but if we
     *               have priors on the probabilities of the labels, then     <BR>
     *               p(x,y) = p(x|y)*p(y) = count(x,y)/s(y)* prior(y)         <BR>
     *               and p(x) = sum_y prior(y) count(x,y)/s(y).               <BR>
     *
     *             By counting we get the following:                          <BR>
     *             -sum_{x,y} num(Y=y,X=x)/num-rec * log num(Y=y,X=x)/num(X=x)
     *
     * @param instList The instance list over which conditional entropy is calculated.
     * @param attrNumX The number of the attribute for which conditional entropy is requested.
     * @return The conditional entropy.
     */
    public static double cond_entropy(InstanceList instList, int attrNumX) {
        return cond_entropy(instList.counters().value_counts()[attrNumX],
        instList.counters().attr_counts()[attrNumX],
        instList.total_weight());
    }
    
    /** Compute the mutual information which is defined as I(Y;X) = H(Y) - H(Y|X). Some
     * researchers like Quinlan call this "gain." This is the amount of information
     * gained about the category value of an instance after we test the variable X.
     *
     * @param ent Entropy value.
     * @param splitAndLabelDist Distributions over each split and label pair.
     * @param splitDist The distribution over splits.
     * @param totalWeight Total weight of the Instances trained on.
     * @return The mutual information value.
     */
    public static double mutual_info(double ent,double[][] splitAndLabelDist,
    double[] splitDist, double totalWeight) {
        double condEntropy = Entropy.cond_entropy(splitAndLabelDist, splitDist,
        totalWeight);
        DoubleRef mi = new DoubleRef(ent - condEntropy);
        // Mutual information should never be negative; the following
        //   accounts for possible numerical representation errors.
        MLJ.clamp_above(mi, 0, "mutual_info: negative values not allowed");
        return mi.value;
    }
    
    /** Compute the mutual information which is defined as I(Y;X) = H(Y) - H(Y|X). Some
     * researchers like Quinlan call this "gain." This is the amount of information
     * gained about the category value of an instance after we test the variable X.
     * @param instList The instance list over which mutual information is calculated.
     * @param attrNumX The number of the attribute for which mutual information is requested.
     * @return The mutual information value.
     */
    public static double mutual_info(InstanceList instList, int attrNumX) {
        if (instList.counters().attr_counts()[attrNumX] == null)
            Error.fatalErr("entropy::mutual_info: attribute "+attrNumX+
            " is not nominal (counts array is NULL)");
        
        double ent = entropy(instList.counters().label_counts(),
        instList.total_weight());
        return mutual_info(instList, ent, attrNumX);
    }
    
    /** Compute the mutual information which is defined as I(Y;X) = H(Y) - H(Y|X). Some
     * researchers like Quinlan call this "gain." This is the amount of information
     * gained about the category value of an instance after we test the variable X.
     * @param instList The instance list over which mutual information is calculated.
     * @param ent Entropy value.
     * @param attrNumX The number of the attribute for which mutual information is requested.
     * @return The mutual information value.
     */
    public static double mutual_info(InstanceList instList,
    double ent, int attrNumX) {
        if (instList.counters().attr_counts()[attrNumX] == null)
            Error.fatalErr("entropy::mutual_info: attribute "+attrNumX+
            " is not nominal (counts array is NULL)");
        
        return mutual_info(ent,
        instList.counters().value_counts()[attrNumX],
        instList.counters().attr_counts()[attrNumX],
        instList.total_weight());
    }
    
    
    /** Builds the distribution arrays necessary for calculating conditional entropy for
     * nominal attributes. All of the splitAndLabelDist arrays of the Instance Lists are
     * concatenated. The unaccounted instances allow the list of nodes to be partial,
     * i.e., not to contain all instances. The split will be created so that the
     * unaccounted instances are in an extra split with the same label, so that the
     * entropy will be decreased correctly as if they were in a pure node.
     *
     * @param currentLevel The list of instances in the current partition for which a split is being
     * determined.
     * @param attrNum The number of the attribute for which mutual information is requested.
     * @return The distribution over splits.
     */
    static public double[] build_nominal_attr_split_dist(InstanceList[] currentLevel,
    int attrNum) {
        return build_nominal_attr_split_dist(currentLevel,attrNum,0);
    }
    
    /** Builds the distribution arrays necessary for calculating conditional entropy for
     * nominal attributes. All of the splitAndLabelDist arrays of the Instance Lists are
     * concatenated. The unaccounted instances allow the list of nodes to be partial,
     * i.e., not to contain all instances. The split will be created so that the
     * unaccounted instances are in an extra split with the same label, so that the
     * entropy will be decreased correctly as if they were in a pure node.
     *
     * @param currentLevel The list of instances in the current partition for which a split is being
     * determined.
     * @param attrNum The number of the attribute for which mutual information is requested.
     * @param unaccountedWeight Weight that is not accounted for in the list of instances.
     * @return The distribution over splits.
     */
    static public double[] build_nominal_attr_split_dist(InstanceList[] currentLevel,
    int attrNum, double unaccountedWeight) {
        MLJ.ASSERT(currentLevel[0]!= null,"Entropy.build_nominal_attr_split_dist:currentLevel[0]== null.");
        Schema schema = currentLevel[0].get_schema();
        int numInstLists = currentLevel.length;
        int numAttrValues = schema.num_attr_values(attrNum);
        
        MLJ.ASSERT(numInstLists > 0,"Entropy.build_nominal_attr_split_dist:numInstLists <= 0");
        MLJ.ASSERT(numAttrValues > 0,"Entropy.build_nominal_attr_split_dist:numAttrValues <= 0");
        
        int unaccnt_wght_col = (unaccountedWeight > 0)? 1 : 0;
        double[] splitDist = new double[numInstLists * (numAttrValues + 1) + unaccnt_wght_col];
        int countSplitDist = Globals.UNKNOWN_CATEGORY_VAL;
        
        for (int instListCount = 0; instListCount < numInstLists; instListCount++) {
            MLJ.ASSERT(currentLevel[instListCount] != null,"Entropy.build_nominal_attr_split_dist:currentLevel[instListCount] == null");
            for (int attrCount = Globals.UNKNOWN_CATEGORY_VAL; attrCount < numAttrValues;
            attrCount++, countSplitDist++) {
                BagCounters bc = currentLevel[instListCount].counters();
                splitDist[countSplitDist] = bc.attr_counts()[attrNum][attrCount];
            }
        }
        if (unaccountedWeight > 0) {
            MLJ.ASSERT(countSplitDist == splitDist.length,"Entropy.build_nominal_attr_split_dist:countSplitDist != splitDist.length");
            splitDist[countSplitDist] = unaccountedWeight;
        }
        return splitDist;
    }
    
    
    /** Compute the J-measure. See papers by Goodman and Smyth, such as Data
     * Engineering, v.4, no.4, pp.301-316, 1992. The J-measure summed over all
     * values of x gives info-gain. The J-measure is                               <BR>
     * sum_y p(x,y)log(p(x,y)/(p(x)p(y)))                                          <BR>
     * 1/n * sum_y n(x,y)log(n(x,y)*n/(n(x)n(y)))                                  <BR>
     * Used in t_entropy.java.
     *
     * @return The j-measure value.
     * @param splitAndLabelDist Distributions over each split and label pair.
     * @param splitDist The distribution over splits.
     * @param labelCounts Counts of each label found in the data.
     * @param x The x value for the j-measure equation.
     * @param totalWeight Total weight of all data.
     */
    
    public static double j_measure(double[][] splitAndLabelDist,
    double[] splitDist, double[] labelCounts,
    int x, double totalWeight) {
        MLJ.verify_strictly_greater(totalWeight, 0, "j_measure: totalWeight is "+
        "too small");
        
        DoubleRef j = new DoubleRef();
        for (int y = 0;
        y < splitAndLabelDist.length; y++) {
            double num_xy = splitAndLabelDist[y][x];
            double num_x  = splitDist[x];
            double num_y  = labelCounts[y];
            if (!MLJ.approx_equal(num_xy, 0.0)) { // beware of log(0)
                if (Globals.DBG) MLJ.ASSERT((num_x > 0 && num_y > 0),"Entropy.j_measure: num_x <= 0 || num_y <= 0");
                j.value += num_xy *
                log_bin(totalWeight*(num_xy)/(num_x * num_y));
            }
        }
        j.value /= totalWeight; // We know this won't be division by zero.
        
        // Allow for possible numerical representation errors.
        MLJ.clamp_above(j, 0, "j_measure: negative j-measure not allowed");
        
        return j.value;
    }
    
    /** Compute the J-measure. See papers by Goodman and Smyth, such as Data
     * Engineering, v.4, no.4, pp.301-316, 1992. The J-measure summed over all
     * values of x gives info-gain. The J-measure is                               <BR>
     * sum_y p(x,y)log(p(x,y)/(p(x)p(y)))
     * 1/n * sum_y n(x,y)log(n(x,y)*n/(n(x)n(y)))                                  <BR>
     * Used in t_entropy.java.
     *
     * @param instList The list of Instances over which a j measure is to be
     * calculated.
     * @param attrNumX The number of attributes in the Schema of the Instances
     * supplied.
     * @param x The x value for the j-measure equation.
     * @return The j-measure value.
     */
    public static double j_measure(InstanceList instList, int attrNumX, int x) {
        return j_measure(instList.counters().value_counts()[attrNumX],
        instList.counters().attr_counts()[attrNumX],
        instList.counters().label_counts(), x,
        instList.total_weight());
    }
    
    
    /** Builds columns of real values and their associated label values. Invokes
     * InstanceList's transpose function to provide a single column for the passed
     * attribute number, sorts it, and returns the columns to the caller. The second
     * calling argument, if set to an attribute index, results in a single column
     * being transposed and sorted. When set to UNDEFINED_INT, all columns are
     * so treated.
     * @param instList The instance list containing the instance values for the attribute.
     * @param attrNum The number of the attribute for which the real and label column is
     * requested.
     * @return The columns of real values and their associated labels, organized by attribute.
     */
    public static RealAndLabelColumn[] build_real_and_label_columns(
    InstanceList instList, int attrNum) {
        // We initialize the array to FALSE, except for any element(s)
        //   we want to get the RealAndLabelColumn for, which is/are set to TRUE.
        boolean initializer = (attrNum == Globals.UNDEFINED_INT) ? true : false;
        boolean[] transp = new boolean[instList.get_schema().num_attr()];
        Arrays.fill(transp, initializer);
        if (attrNum != Globals.UNDEFINED_INT)
            transp[attrNum] = true;
        RealAndLabelColumn[] columns = instList.transpose(transp);
        
        // If a particular column was requested, check that it was transposed.
        if (attrNum != Globals.UNDEFINED_INT)
            if (columns[attrNum] != null)
                columns[attrNum].sort();
            else
                Error.fatalErr("build_real_and_label_columns: for attribute " +attrNum
                +", no column was built to sort");
        else
            for (int x = 0; x < instList.get_schema().num_attr(); x++)
                if (columns[x] != null)
                    columns[x].sort();
        return columns;
    }
    
    /** Builds a column of real values and their associated label values for the given
     * attribute. Invokes InstanceList's transpose function to provide a single column
     * for the passed attribute number, sorts it, and returns the columns to the caller.
     * The second calling argument, if set to an attribute index, results in a single
     * column being transposed and sorted. When set to UNDEFINED_INT, all columns are
     * so treated.
     * @param instList The instance list containing the instance values for the attribute.
     * @param attrNum The number of the attribute for which the real and label column is
     * requested.
     * @return The column of real values and their associated labels.
     */
    public static RealAndLabelColumn build_real_and_label_column(InstanceList
    instList, int attrNum) {
        RealAndLabelColumn[] columns = build_real_and_label_columns(instList, attrNum);
        // We want to pass the sorted column back to the caller, but delete
        //   the rest of the array.  Save a reference to the single desired
        //   column, and set the entry in the array that points to it to NULL so
        //   that when the array's deleted, the column isn't.  The caller must
        //   delete the single column.
        RealAndLabelColumn sortedColumn = columns[attrNum];
        columns[attrNum] = null;
        columns = null;
        return sortedColumn;
    }
    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美四级电影网| 国内精品国产成人国产三级粉色 | 成人中文字幕合集| 中文字幕在线免费不卡| eeuss国产一区二区三区| 亚洲人成在线观看一区二区| 欧洲精品一区二区| 免费看日韩精品| 国产色一区二区| 91美女在线看| 日本中文字幕一区| 精品欧美久久久| 国产999精品久久| 亚洲一区二区三区不卡国产欧美| 91精品久久久久久久久99蜜臂| 国产激情一区二区三区| 国产精品福利一区| 欧美丰满少妇xxxbbb| 国产福利视频一区二区三区| 一区二区三区在线观看国产| 91精品中文字幕一区二区三区 | 国产精品18久久久久久vr| 国产精品久久久久久久久图文区| 日本韩国欧美三级| 男男gaygay亚洲| 中文字幕一区av| 精品久久一二三区| 91久久精品国产91性色tv| 蜜桃一区二区三区在线| 综合在线观看色| 日韩一区二区电影在线| 成人免费看黄yyy456| 日韩精品一级中文字幕精品视频免费观看| 久久网站最新地址| 欧美精品一二三四| 成人v精品蜜桃久久一区| 天堂成人免费av电影一区| 国产亚洲欧美在线| 欧美理论电影在线| 成人sese在线| 国产一区二区三区蝌蚪| 午夜视频在线观看一区二区 | 激情综合一区二区三区| 亚洲另类色综合网站| 亚洲精品一区二区三区蜜桃下载| 在线观看91视频| 不卡在线观看av| 国产一区二区三区| 奇米四色…亚洲| 亚洲成av人片| 亚洲免费观看高清完整版在线观看熊| 精品国产91洋老外米糕| 884aa四虎影成人精品一区| 色综合中文字幕国产 | 亚洲国产wwwccc36天堂| 国产精品久久久一本精品| 久久综合九色综合欧美98| 9191久久久久久久久久久| 色丁香久综合在线久综合在线观看| 国内精品伊人久久久久av影院| 亚洲成国产人片在线观看| 亚洲人妖av一区二区| 中文字幕国产精品一区二区| 久久色在线观看| 精品国产一二三区| 日韩精品一区二区在线观看| 91精品国产欧美一区二区| 欧美吞精做爰啪啪高潮| 一道本成人在线| 在线观看免费一区| a4yy欧美一区二区三区| 懂色av一区二区三区免费观看| 免费久久精品视频| 精品一区二区日韩| 黑人巨大精品欧美黑白配亚洲| 精品一区二区三区影院在线午夜| 天堂成人免费av电影一区| 热久久国产精品| 美女网站色91| 狠狠色综合色综合网络| 国产91精品一区二区麻豆亚洲| 国产精品一卡二卡在线观看| 国产成a人亚洲精| 成人免费视频视频| 色综合天天综合网天天狠天天| 91社区在线播放| 欧洲另类一二三四区| 欧美二区三区91| 久久影视一区二区| 国产精品女主播av| 亚洲一二三四在线| 免费在线观看一区| 国产成人精品www牛牛影视| 波多野结衣在线一区| 91丨porny丨国产| 欧美丰满美乳xxx高潮www| 日韩精品一区二区三区四区视频 | 91麻豆精品在线观看| 午夜欧美电影在线观看| 免费观看在线色综合| 国产一区二区三区美女| 99久久er热在这里只有精品66| 97久久超碰国产精品电影| 在线视频你懂得一区| 日韩一区二区在线看片| 国产三级精品在线| 一级女性全黄久久生活片免费| 日韩精品欧美精品| 国产精品夜夜爽| 91精品91久久久中77777| 在线播放一区二区三区| 国产日韩精品一区二区浪潮av | 亚洲 欧美综合在线网络| 久久精品久久综合| 波多野洁衣一区| 日韩亚洲欧美一区二区三区| 中日韩av电影| 亚洲成人免费电影| 国产精品一区久久久久| 在线看日本不卡| 亚洲婷婷在线视频| 久久久另类综合| 久久精品一级爱片| 亚洲高清一区二区三区| 极品尤物av久久免费看| 欧美午夜精品久久久| 久久精品视频一区| 午夜国产精品一区| av激情成人网| 精品少妇一区二区三区视频免付费 | 亚洲视频在线一区| 久久国产乱子精品免费女| 在线视频国内自拍亚洲视频| 久久久精品综合| 麻豆91免费观看| 欧美性三三影院| 亚洲女与黑人做爰| 国产成人免费视频| 欧美一二三四区在线| 亚洲伊人伊色伊影伊综合网| 国产成人av网站| 精品伦理精品一区| 日本麻豆一区二区三区视频| 91国产免费观看| 亚洲精品第1页| 99久久久免费精品国产一区二区| 精品日韩一区二区三区| 日本电影欧美片| 精品中文av资源站在线观看| 裸体健美xxxx欧美裸体表演| 欧美视频中文字幕| 亚洲天天做日日做天天谢日日欢 | 一区二区三区在线播| 成人午夜av影视| 国产三级精品三级| 国产精品亚洲第一| 久久婷婷综合激情| 国产高清精品网站| 欧美成人一区二区三区在线观看| 天天综合色天天综合| 91精品中文字幕一区二区三区| 亚洲成人av一区| 欧美性三三影院| 久久亚洲二区三区| 偷拍一区二区三区| 欧美一a一片一级一片| 2021国产精品久久精品| 国产精品一区专区| 久久精品日韩一区二区三区| 亚洲在线观看免费视频| 欧美性三三影院| 欧美三区免费完整视频在线观看| 一区二区三区在线播放| 午夜欧美大尺度福利影院在线看 | 中文字幕精品一区二区精品绿巨人 | 欧美韩日一区二区三区| 成人精品一区二区三区四区| 国产精品久久综合| 色综合网站在线| 偷拍日韩校园综合在线| 日韩你懂的在线观看| 国产乱人伦偷精品视频不卡| 中文字幕第一区综合| 91一区二区三区在线观看| 亚洲一区在线观看免费观看电影高清| 欧美性猛交xxxxxxxx| 免费在线观看一区| 国产日韩欧美精品综合| 99久久精品99国产精品| 亚洲二区视频在线| 日韩精品中文字幕一区二区三区 | 日本美女视频一区二区| 久久先锋资源网| 国产女人18毛片水真多成人如厕| 亚洲欧美日韩久久| 国产精品夜夜嗨| 亚洲激情图片小说视频| 69成人精品免费视频| 国产98色在线|日韩| 亚洲成a人片在线观看中文|