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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? statistics.java

?? Multi-label classification 和weka集成
?? JAVA
字號(hào):
package mulan;

/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

import java.io.FileReader;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Set;

import weka.core.Instance;
import weka.core.Instances;
import weka.core.Utils;

/**
 <!-- globalinfo-start -->
 * Class for calculating statistics of a multilabel dataset <p>
 * <br/>
 * For more information, see<br/>
 * <br/>
 * G. Tsoumakas, I. Katakis (2007). Multi-Label Classification: An Overview. International Journal of Data Warehousing and Mining, 3(3):1-13.
 * </p>
 <!-- globalinfo-end -->
 * 
 <!-- technical-bibtex-start -->
 * BibTeX:
 * <pre>
 * &#64;article{tsoumakas+katakis:2007,
 *    author = {G. Tsoumakas, I. Katakis},
 *    journal = {International Journal of Data Warehousing and Mining},
 *    pages = {1-13},
 *    title = {Multi-Label Classification: An Overview},
 *    volume = {3},
 *    number = {3},
 *    year = {2007}
 * }
 * </pre>
 * <p/>
 <!-- technical-bibtex-end -->
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -F &lt;filename&gt;
 *  The filename (including full path) of the multilabel data set).</pre>
 * 
 * <pre> -L &lt;number of labels&gt;
 *  Number of labels. </pre>
 * 
 <!-- options-end -->
 *
 * @author Grigorios Tsoumakas 
 * @author Robert Friberg
 * @version $Revision: 0.03 $ 
 */
public class Statistics implements Serializable
{    
    private static final long serialVersionUID = 1206845794397561633L;

    /** the number of instances */
    private int numInstances;
    
    /** the number of predictive attributes */
    private int numPredictors = 0;
    
    /** the number of nominal predictive attributes */
    private int numNominal = 0;
    
    /** the number of numeric attributes */
    private int numNumeric = 0;
    
    /** the number of labels */
    private int numLabels;
    
    /** the label density  */
    private double labelDensity;

    /** the label cardinality */
    private double labelCardinality;
        
    /** percentage of instances per label */
    private double[] examplesPerLabel;
    
    /** number of examples per cardinality, <br><br>
     *  note that this array has size equal to the number of elements plus one, <br>
     *  because the first element is the number of examples for cardinality=0  */
    private double[] cardinalityDistribution;
    
    /** labelsets and their frequency */
    private HashMap<LabelSet,Integer> labelsets;
    
    public Statistics()
    {
    }
    
    /** 
     * returns the HashMap containing the distinct labelsets and their frequencies
     */
    public HashMap<LabelSet,Integer> labelCombCount() {
    	return labelsets;
    }
    
    /** 
     * This method calculates and prints a matrix with the coocurrences of <br>
     * pairs of labels (under concstruction).
     */
    public double[][] calculateCoocurrence(Instances data, int labels) {
        double[][] coocurrenceMatrix = new double[labels][labels];
        
        int numPredictors = data.numAttributes()-labels;
        for (int k=0; k<data.numInstances(); k++) {
            Instance temp = data.instance(k);
            for (int i=0; i<labels; i++)
                for (int j=0; j<labels; j++) {
                    if (i >= j)
                        continue;
                    if (data.attribute(numPredictors+i).value((int) temp.value(numPredictors+i)).compareTo("1") == 0 && 
                        data.attribute(numPredictors+j).value((int) temp.value(numPredictors+j)).compareTo("1") == 0 )
                        coocurrenceMatrix[i][j]++;
                }
        }
        
        for (int i=0; i<labels; i++) {
            for (int j=0; j<labels; j++) {
                System.out.print(coocurrenceMatrix[i][j] + "\t");
            }
            System.out.println();
        }
        
        return coocurrenceMatrix;
    }    
       
    /** 
     * calculates various multilabel statistics, such as label cardinality, <br>
     * label density and the set of dinstinct labels along with their frequency
     */
    public void calculateStats(Instances data, int labels) {        
        // initialize statistics
        numLabels = labels;
        numPredictors = data.numAttributes()-numLabels;
        labelCardinality = 0;
        numNominal = 0;
        numNumeric = 0;
        examplesPerLabel = new double[numLabels];
        cardinalityDistribution = new double[numLabels+1];
        labelsets = new HashMap<LabelSet,Integer>();
             
        // gather statistics
        for (int i=0; i<numPredictors; i++) {
            if (data.attribute(i).isNominal())
                numNominal++;
            if (data.attribute(i).isNumeric())
                numNumeric++;
        }
        
        
        numInstances = data.numInstances(); 
        for (int i=0; i<numInstances; i++)
        {
            int exampleCardinality=0;
            double[] dblLabels = new double[numLabels];
            for (int j=0; j<numLabels; j++)
            {
            	double value = Double.parseDouble(data.attribute(numPredictors+j).value((int) data.instance(i).value(numPredictors + j))); 
                dblLabels[j] = value; 
                
                if (Utils.eq(value, 1.0))
                {
                    exampleCardinality++;
                    labelCardinality++;
                    examplesPerLabel[j]++;
                }
            }
            cardinalityDistribution[exampleCardinality]++;
            
            LabelSet labelSet = new LabelSet(dblLabels);
            if (labelsets.containsKey(labelSet))
            {
                labelsets.put(labelSet, labelsets.get(labelSet) + 1);
            }
            else labelsets.put(labelSet, 1);
        }
        
        labelCardinality /= numInstances;
        labelDensity = labelCardinality / numLabels;
        for (int j=0; j<numLabels; j++)
            examplesPerLabel[j] /= numInstances;        
    }
    
    /** 
     * returns various multilabel statistics in textual representation 
     */
    public String toString() {
        String description = "";
        
        description += "Examples: " + numInstances + "\n";
        description += "Predictors: " + numPredictors + "\n";
        description += "--Nominal: " + numNominal + "\n";
        description += "--Numeric: " + numNumeric + "\n";
        
        description += "Labels: " + numLabels + "\n";

        description += "\n";       
        description += "Cardinality: " + labelCardinality + "\n";
        description += "Density: " + labelDensity + "\n";
        description += "Distinct Labelsets: " + labelsets.size() +"\n";
        
        description += "\n";
        for (int j=0; j<numLabels; j++)
            description += "Percentage of examples with label " + (j+1) + ": " + examplesPerLabel[j] + "\n";        
        
        description += "\n";
        for (int j=0; j<=numLabels; j++)
            description += "Examples of cardinality " + j + ": " + cardinalityDistribution[j] + "\n";            	

        description += "\n";
        for(LabelSet set : labelsets.keySet())
            description += "Examples of combination " + set + ": " +	labelsets.get(set) + "\n";

        return description;
    }
           
    /** 
     * returns the prior probabilities of the labels
     */
    public double[] priors() {
        double[] pr = new double[numLabels];
        for (int i=0; i<numLabels; i++)
            pr[i] = examplesPerLabel[i]/numInstances;
        return pr;
    }

    /** 
     * returns the label cardinality of the dataset
     */
    public double cardinality() {
        return labelCardinality;
    }    
    
    /** 
     * returns the label density of the dataset
     */
    public double density() {
        return labelDensity;
    }

    /** 
     * returns a set with the distinct labelsets of the dataset
     */
    public Set<LabelSet> labelSets() {
        return labelsets.keySet();
    }
    
    /** 
     * returns the frequency of a labelset in the dataset
     */
    public int labelFrequency(LabelSet x) {
        return labelsets.get(x);
    }
    
    public static void main(String[] args) throws Exception {
        String filename = Utils.getOption('F', args);
        FileReader frData = new FileReader(filename);
        Instances data = new Instances(frData);                
        int numLabels = Integer.parseInt(Utils.getOption('L',args));
        
        Statistics stats = new Statistics();
        stats.calculateStats(data, numLabels);
        System.out.println(stats.toString());
    }
    
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩国产欧美一区二区三区| 欧美亚男人的天堂| 久久在线免费观看| 国产在线精品不卡| 久久久影视传媒| 国产福利一区二区| 国产精品护士白丝一区av| 91一区二区三区在线播放| 亚洲欧美电影一区二区| 欧美亚洲国产一区二区三区| 国产一区二区三区av电影 | 在线亚洲免费视频| 亚洲二区在线视频| 欧美成人高清电影在线| 成人免费毛片片v| 亚洲综合色丁香婷婷六月图片| 欧美人体做爰大胆视频| 国精产品一区一区三区mba视频| 国产精品美女一区二区三区 | 欧美在线一区二区三区| 国产成人午夜电影网| 麻豆精品视频在线| 综合色天天鬼久久鬼色| 91精品啪在线观看国产60岁| 国产精品一区二区你懂的| 亚洲丝袜美腿综合| 国产精品欧美极品| 国产亚洲欧美在线| 欧美另类久久久品| 成人国产在线观看| 蜜桃av噜噜一区| 石原莉奈在线亚洲二区| 国产精品久久久久aaaa| 国产网红主播福利一区二区| 2020国产精品自拍| 久久久久久免费网| 久久久久久一二三区| 欧美mv和日韩mv国产网站| 日韩午夜激情电影| 欧洲av在线精品| 欧美亚洲高清一区| 欧美视频一区二区三区在线观看| 欧美综合天天夜夜久久| 欧美在线观看18| 欧美人狂配大交3d怪物一区| 欧美精选一区二区| 日韩一区二区不卡| 日韩欧美在线网站| 精品国产乱码久久久久久浪潮| 欧美色爱综合网| 99re免费视频精品全部| 国产在线国偷精品免费看| 国产一区二区精品久久91| 东方欧美亚洲色图在线| 久久国产三级精品| 日韩电影一区二区三区| 精品伊人久久久久7777人| 亚洲成人动漫在线观看| 亚洲乱码中文字幕| 欧美高清在线一区| 久久蜜桃av一区二区天堂| 国产日韩精品一区二区浪潮av | 欧美在线色视频| 8x8x8国产精品| 精品免费国产一区二区三区四区| 欧美精品一区二区久久久| 日本一区二区三区国色天香| 亚洲色图欧美偷拍| 婷婷中文字幕一区三区| 亚洲成a人片综合在线| 美女久久久精品| 高清视频一区二区| 色久综合一二码| 日本大香伊一区二区三区| 欧美高清hd18日本| 国产亚洲欧美在线| 亚洲尤物在线视频观看| 久久国产精品99久久人人澡| 成人免费视频一区| 欧美日韩另类一区| 国产视频视频一区| 午夜影院在线观看欧美| 国产精品456露脸| 欧洲精品视频在线观看| 精品av久久707| 亚洲精品videosex极品| 黄页视频在线91| 色94色欧美sute亚洲线路一ni | 国产日韩欧美激情| 亚洲成人av资源| 国产成人精品免费网站| 欧美日韩午夜在线视频| 国产欧美日韩综合| 视频一区二区国产| 99r精品视频| 精品成人一区二区| 香蕉成人啪国产精品视频综合网 | 亚洲123区在线观看| 成人一区二区三区视频| 7777精品伊人久久久大香线蕉最新版| 久久久电影一区二区三区| 午夜精品免费在线| 99精品欧美一区二区三区小说 | 一区二区三区在线免费视频 | 奇米四色…亚洲| 极品少妇一区二区| 欧美日韩三级在线| 亚洲啪啪综合av一区二区三区| 麻豆精品一区二区三区| 欧美性受xxxx黑人xyx| 国产精品久久久久久久久搜平片| 久久精品久久99精品久久| 在线免费av一区| 国产精品久久久久婷婷 | 色噜噜狠狠一区二区三区果冻| 久久免费的精品国产v∧| 日本强好片久久久久久aaa| 日本精品一区二区三区四区的功能| 亚洲国产精品t66y| 国产一区二三区| 精品国产一区二区精华| 奇米色一区二区| 91精品国产综合久久久久久漫画| 伊人色综合久久天天人手人婷| 成人av资源在线观看| 国产蜜臀97一区二区三区| 国产在线不卡一区| 精品99一区二区| 加勒比av一区二区| 精品国产乱子伦一区| 激情六月婷婷综合| 久久久久久免费| 国产成人综合亚洲91猫咪| 久久综合99re88久久爱| 韩国在线一区二区| 久久久美女毛片| 成人综合日日夜夜| 国产精品久久久久7777按摩| 不卡一区二区三区四区| 中文字幕一区av| 久久99国产精品尤物| 日韩欧美一级精品久久| 亚洲精品国产品国语在线app| 99久久免费精品| 一区二区久久久久久| 欧美三级欧美一级| 视频一区视频二区中文字幕| 91精品久久久久久蜜臀| 久久精品国产99久久6| wwwwxxxxx欧美| 成人综合在线视频| 亚洲免费大片在线观看| 欧美图区在线视频| 久久精品久久精品| 中文字幕 久热精品 视频在线| 不卡一区二区三区四区| 一区二区三区四区不卡在线 | 欧美系列日韩一区| 日韩精品一二区| 26uuu亚洲| 国产传媒欧美日韩成人| 亚洲欧美色一区| 欧美老年两性高潮| 狠狠色丁香久久婷婷综| 国产精品视频在线看| 91激情五月电影| 免费成人在线视频观看| 国产视频一区在线观看 | 欧美精品一区视频| 99精品热视频| 奇米888四色在线精品| 国产午夜精品福利| 在线观看www91| 国产一区二区精品久久99| 亚洲丝袜另类动漫二区| 91精品国产综合久久久久久| 盗摄精品av一区二区三区| 亚洲国产视频一区二区| 久久欧美中文字幕| 欧美亚洲综合色| 国产一区二区三区美女| 亚洲激情五月婷婷| 精品久久久久久久人人人人传媒| 99久久精品99国产精品| 日本三级亚洲精品| 亚洲精品乱码久久久久久久久| 欧美大片一区二区| 91理论电影在线观看| 国产一区二区在线免费观看| 亚洲激情欧美激情| 久久久99精品免费观看| 欧美日韩黄视频| av在线播放成人| 亚洲精品自拍动漫在线| 精品国产乱码久久久久久夜甘婷婷| 国产视频一区二区在线| 欧美日韩一区二区三区在线| 成熟亚洲日本毛茸茸凸凹| 日本91福利区| 亚洲乱码中文字幕|