Java Measure类代码示例

本文整理汇总了Java中mulan.evaluation.measure.Measure的典型用法代码示例。如果您正苦于以下问题:Java Measure类的具体用法?Java Measure怎么用?Java Measure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java Measure类代码示例

Measure类属于mulan.evaluation.measure包,在下文中一共展示了Measure类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toString

import mulan.evaluation.measure.Measure; //导入依赖的package包/类
/**
 * Returns a string with the results of the evaluation
 * 
 * @return a string with the results of the evaluation
 */
@Override
public String toString() {
    
    StringBuilder sb = new StringBuilder();
    for (Measure m : getMeasures()) {
        sb.append(m);
        sb.append("\n");
    }
    return sb.toString();
} 
开发者ID:ogreyesp,项目名称:JCLAL,代码行数:16,代码来源:MulanEvaluation.java

示例2: getListMeasures

import mulan.evaluation.measure.Measure; //导入依赖的package包/类
/**
 * Generate the set of measures to obtain as output from classifiers
 *
 * @param numLabels Number of labels in the dataset
 * @return List of Measure objects
 */
private List<Measure> getListMeasures(int numLabels) {
    // Set of measures to obtain from the classifier
    List<Measure> measuresList = new ArrayList<Measure>(5);
    measuresList.add(new HammingLoss());
    measuresList.add(new ExampleBasedAccuracy(false));
    measuresList.add(new ExampleBasedPrecision(false));
    measuresList.add(new ExampleBasedRecall(false));
    measuresList.add(new ExampleBasedFMeasure(false));
    measuresList.add(new SubsetAccuracy());

    measuresList.add(new MacroFMeasure(numLabels, false));
    measuresList.add(new MacroPrecision(numLabels, false));
    measuresList.add(new MacroRecall(numLabels, false));
    measuresList.add(new MacroAUC(numLabels));
    measuresList.add(new MicroFMeasure(numLabels));
    measuresList.add(new MicroPrecision(numLabels));
    measuresList.add(new MicroRecall(numLabels));
    measuresList.add(new MicroAUC(numLabels));

    measuresList.add(new OneError());
    measuresList.add(new Coverage());
    measuresList.add(new RankingLoss());
    measuresList.add(new AveragePrecision());

    return measuresList;
} 
开发者ID:fcharte,项目名称:SM-MLC,代码行数:33,代码来源:Main.java

示例3: run

import mulan.evaluation.measure.Measure; //导入依赖的package包/类
/**
 * Run the selected multi-label classification algorithm
 *
 * @param args Command line arguments
 */
private void run(String[] args) {
    List<Measure> measures;
    MultiLabelLearner classifier;
    MultipleEvaluation results = new MultipleEvaluation();
    long tIniTr = 0;
    long tIniTe = 0;
    long tTrain = 0;
    long tTest = 0;
    long tTotal = 0;
    long taux = 0;
    long taux2 = 0;

    readParameters(args);
    root = path + File.separator + dataset + "-";

    try {
        int numLabels = getNumberOfLabels();

        measures = getListMeasures(numLabels);
        classifier = getClassifier(numLabels);


        for(int fold = 1; fold <= folds; fold++) {
            if(debug) System.out.println("Fold " + fold);
            MultiLabelInstances
                    train = new MultiLabelInstances(root + fold + "tra.arff", xmlfile),
                    test  = new MultiLabelInstances(root + fold + "tst.arff", xmlfile);

            MultiLabelLearner cls = classifier.makeCopy();


            tIniTr = System.currentTimeMillis();


            cls.build(train);
            taux = System.currentTimeMillis();
            tTrain = (taux-tIniTr)/1 + tTrain;
            tIniTe = System.currentTimeMillis();
            Evaluator evaluator = new Evaluator();
            Evaluation evaluation;
            evaluation = evaluator.evaluate(cls, test, measures);
            taux2 = System.currentTimeMillis();
            tTest = (taux2-tIniTe)/1 + tTest;
            tTotal = (taux2-tIniTr)/1 + tTotal;
            if (debug) System.out.println(evaluation);
            results.addEvaluation(evaluation);
        }
        results.calculateStatistics();
        System.out.println(algorithm + "," + dataset + "," + results.toCSV().replace(",", ".").replace(";", ",").replace("\u00B1", ";") + tTrain + "," + tTest + "," + tTotal+ ",");
    } catch(Exception e) {
        e.printStackTrace();
    }
} 
开发者ID:fcharte,项目名称:SM-MLC,代码行数:59,代码来源:Main.java

示例4: MulanEvaluation

import mulan.evaluation.measure.Measure; //导入依赖的package包/类
public MulanEvaluation(List<Measure> someMeasures, MultiLabelInstances data) throws Exception {
    super(someMeasures, data);
    
} 
开发者ID:ogreyesp,项目名称:JCLAL,代码行数:5,代码来源:MulanEvaluation.java

示例5: main

import mulan.evaluation.measure.Measure; //导入依赖的package包/类
public static void main(String[] args) throws Exception{

	// maybe llog, medical, enron

	System.err.println("Running...");
	
	MultiLabelInstances mli = new MultiLabelInstances(args[0] + ".arff", args[0] + ".xml");
	
	
	
	    
	for (int k = 2; k < mli.getNumLabels(); k++) {
	    for (double t = 0.1; t <= 1.0; t+=0.1) {
		MLCBMaD classif = new MLCBMaD(new RandomForest());
		
		classif.setK(k);
		classif.setT(t);
		
		    
		Evaluator eval = new Evaluator();
		
		ArrayList<Measure> mes = new ArrayList<Measure>();
		
		mes.add(new ExampleBasedAccuracy());

		
		MultipleEvaluation meval = eval.crossValidate(classif,
							      mli, 
							      mes,
							      5);
		
		meval.calculateStatistics();
		
		double curperf  = meval.getMean("Example-Based Accuracy");
		System.out.println(k + " " + t+ " " + curperf);
		
	    }
	}
	
	
	
    } 
开发者ID:joergwicker,项目名称:mlcbmad,代码行数:43,代码来源:Main.java

本文标签属性:

示例:示例英语

代码:代码是什么

java:javascript什么意思

上一篇:C# Mutex.Release方法代码示例
下一篇:Java Layout.setStyleName方法代码示例

为您推荐