当前位置: 首页>>代码示例>>Java>>正文


Java MultiLabelOutput类代码示例

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


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

示例1: makePredictionInternal

import mulan.classifier.MultiLabelOutput; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected MultiLabelOutput makePredictionInternal(Instance instance) {

	boolean[] bipartition = new boolean[numLabels];
	double[] confidences = new double[numLabels];

	marginDifference = new double[numLabels];

	leastConfidences = new double[numLabels];

	for (int counter = 0; counter < numLabels; counter++) {
		Instance transformedInstance = brt.transformInstance(instance, counter);
		double distribution[];
		try {
			distribution = ensemble[counter].distributionForInstance(transformedInstance);

			marginDifference[counter] = Math.abs(distribution[0] - distribution[1]);

			leastConfidences[counter] = Math.abs(1 - Math.max(distribution[0], distribution[1]));

		} catch (Exception e) {
			System.out.println(e);
			return null;
		}

		int maxIndex = (distribution[0] > distribution[1]) ? 0 : 1;

		// Ensure correct predictions both for class values {0,1} and {1,0}
		bipartition[counter] = (maxIndex == 1) ? true : false;

		// The confidence of the label being equal to 1
		confidences[counter] = distribution[1];
	}

	MultiLabelOutput mlo = new MultiLabelOutput(bipartition, confidences);
	return mlo;
}
 
开发者ID:ogreyesp,项目名称:JCLAL,代码行数:40,代码来源:BinaryRelevance.java

示例2: makePrediction

import mulan.classifier.MultiLabelOutput; //导入依赖的package包/类
/**
 * Return a MultiLabelOutput object
 *
 * @param instance
 *            The instance to test
 * @return a MultiLabelOutput object
 */
public MultiLabelOutput makePrediction(Instance instance) {

	try {
		return classifier.makePrediction(instance);
	} catch (Exception e) {

		Logger.getLogger(MulanClassifier.class.getName()).log(Level.SEVERE, null, e);
	}
	return null;
}
 
开发者ID:ogreyesp,项目名称:JCLAL,代码行数:18,代码来源:MulanClassifier.java

示例3: makePredictionInternal

import mulan.classifier.MultiLabelOutput; //导入依赖的package包/类
@Override
   protected MultiLabelOutput makePredictionInternal( Instance instance)
throws Exception {

MultiLabelOutput baseout = basebr.makePrediction(instance);
       
boolean[] bipartition = new boolean[uppermatrix.numAttributes()];
double[] confidences = new double[uppermatrix.numAttributes()];


       for (int i = 0; i < bipartition.length; i++) {
    int index1 = uppermatrix.attribute(i).value(0).equals("0") ? 1 : 0;
           for (int j = 0; j < baseout.getBipartition().length; j++) {
	double matval = uppermatrix.instance(j).value(i);
               bipartition[i] = bipartition[i]
	    || (baseout.getBipartition()[j] && (matval == index1));
           
	if (matval == index1) {
	    confidences[i] = Math.max(confidences[i], baseout.getConfidences()[j]);

	}


    }
           
       }
MultiLabelOutput mlo = new MultiLabelOutput(bipartition, confidences);
       return mlo;
   }
 
开发者ID:joergwicker,项目名称:mlcbmad,代码行数:30,代码来源:MLCBMaD.java

示例4: computeMeanAveragePrecision

import mulan.classifier.MultiLabelOutput; //导入依赖的package包/类
public void computeMeanAveragePrecision() {
    MeanAveragePrecision measure = new MeanAveragePrecision(numLabels);
    for (int dd = 0; dd < trueLabels.length; dd++) {
        if (this.docNumTrueLabels[dd] == 0) {
            continue;
        }
        measure.update(new MultiLabelOutput(predictedScores[dd]), trueLabels[dd]);
    }
    this.measurements.add(new Measurement("MAP", measure.getValue()));
}
 
开发者ID:vietansegan,项目名称:segan,代码行数:11,代码来源:MultilabelClassificationEvaluation.java

示例5: computeOneError

import mulan.classifier.MultiLabelOutput; //导入依赖的package包/类
public void computeOneError() {
    OneError oneError = new OneError();
    for (int dd = 0; dd < trueLabels.length; dd++) {
        if (this.docNumTrueLabels[dd] == 0) {
            continue;
        }
        oneError.update(new MultiLabelOutput(predictedScores[dd]), trueLabels[dd]);
    }
    this.measurements.add(new Measurement("One-error", oneError.getValue()));
}
 
开发者ID:vietansegan,项目名称:segan,代码行数:11,代码来源:MultilabelClassificationEvaluation.java

示例6: computeIsError

import mulan.classifier.MultiLabelOutput; //导入依赖的package包/类
public void computeIsError() {
    IsError isError = new IsError();
    for (int dd = 0; dd < trueLabels.length; dd++) {
        if (this.docNumTrueLabels[dd] == 0) {
            continue;
        }
        isError.update(new MultiLabelOutput(predictedScores[dd]), trueLabels[dd]);
    }
    this.measurements.add(new Measurement("Is-error", isError.getValue()));
}
 
开发者ID:vietansegan,项目名称:segan,代码行数:11,代码来源:MultilabelClassificationEvaluation.java


注:本文中的mulan.classifier.MultiLabelOutput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。