當前位置: 首頁>>代碼示例>>Java>>正文


Java ROCData類代碼示例

本文整理匯總了Java中com.rapidminer.tools.math.ROCData的典型用法代碼示例。如果您正苦於以下問題:Java ROCData類的具體用法?Java ROCData怎麽用?Java ROCData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ROCData類屬於com.rapidminer.tools.math包,在下文中一共展示了ROCData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getVisualizationComponent

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
@Override
public Component getVisualizationComponent(Object renderable, IOContainer ioContainer) {
	ROCComparison model = (ROCComparison) renderable;
	ROCChartPlotter plotter = new ROCChartPlotter();
	Iterator<Map.Entry<String, List<ROCData>>> e = model.getRocData().entrySet().iterator();
	while (e.hasNext()) {
		Map.Entry<String, List<ROCData>> entry = e.next();
		plotter.addROCData(entry.getKey(), entry.getValue());
	}

	JPanel panel = new JPanel(new BorderLayout());
	JPanel innerPanel = new JPanel(new BorderLayout());
	innerPanel.add(plotter);
	innerPanel.setBorder(BorderFactory.createMatteBorder(10, 10, 5, 5, Colors.WHITE));
	panel.add(innerPanel, BorderLayout.CENTER);
	return panel;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:18,代碼來源:ROCComparisonRenderer.java

示例2: ROCViewer

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
public ROCViewer(String message, ROCDataGenerator rocGenerator, List<ROCData> rocData) {
    setLayout(new BorderLayout());
            
    // info string
    JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JTextPane infoText = new JTextPane();
    infoText.setEditable(false);
    infoText.setBackground(infoPanel.getBackground());
    infoText.setFont(infoText.getFont().deriveFont(Font.BOLD));
    infoText.setText(message);
    infoPanel.add(infoText);
    infoPanel.setBorder(BorderFactory.createEtchedBorder());
    add(infoPanel, BorderLayout.NORTH);
            
    // plot panel
    plotter = new ROCChartPlotter();
    plotter.addROCData("ROC", rocData);
    add(plotter, BorderLayout.CENTER);
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:20,代碼來源:ROCViewer.java

示例3: doWork

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
@Override
public void doWork() throws OperatorException {
	ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
	if (exampleSet.getAttributes().getLabel() == null) {
		throw new UserError(this, 105);
	}
	if (!exampleSet.getAttributes().getLabel().isNominal()) {
		throw new UserError(this, 101, "ROC Charts", exampleSet.getAttributes().getLabel());
	}
	if (exampleSet.getAttributes().getLabel().getMapping().getValues().size() != 2) {
		throw new UserError(this, 114, "ROC Charts", exampleSet.getAttributes().getLabel());
	}

	if (exampleSet.getAttributes().getPredictedLabel() != null && getParameterAsBoolean(PARAMETER_USE_MODEL)) {
		getLogger().warning("Input example already has a predicted label which will be removed.");
		PredictionModel.removePredictedLabel(exampleSet);
	}
	if (exampleSet.getAttributes().getPredictedLabel() == null && !getParameterAsBoolean(PARAMETER_USE_MODEL)) {
		throw new UserError(this, 107);
	}
	Model model = null;
	if (getParameterAsBoolean(PARAMETER_USE_MODEL)) {
		model = modelInput.getData(Model.class);
		exampleSet = model.apply(exampleSet);
	}
	if (exampleSet.getAttributes().getPredictedLabel() == null) {
		throw new UserError(this, 107);
	}

	ROCDataGenerator rocDataGenerator = new ROCDataGenerator(1.0d, 1.0d);
	ROCData rocPoints = rocDataGenerator.createROCData(exampleSet, getParameterAsBoolean(PARAMETER_USE_EXAMPLE_WEIGHTS),
			ROCBias.getROCBiasParameter(this));
	rocDataGenerator.createROCPlotDialog(rocPoints);

	PredictionModel.removePredictedLabel(exampleSet);

	modelOutput.deliver(model);
	exampleSetOutput.deliver(exampleSet);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:40,代碼來源:ROCChartGenerator.java

示例4: createReportable

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
@Override
public Reportable createReportable(Object renderable, IOContainer ioContainer, int desiredWidth, int desiredHeight) {
	ROCComparison model = (ROCComparison) renderable;
	ROCChartPlotter plotter = new ROCChartPlotter();
	Iterator<Map.Entry<String, List<ROCData>>> e = model.getRocData().entrySet().iterator();
	while (e.hasNext()) {
		Map.Entry<String, List<ROCData>> entry = e.next();
		plotter.addROCData(entry.getKey(), entry.getValue());
	}
	return plotter;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:12,代碼來源:ROCComparisonRenderer.java

示例5: doWork

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
@Override
public void doWork() throws OperatorException {
	ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
	Tools.hasNominalLabels(exampleSet, getOperatorClassName());
	Attribute label = exampleSet.getAttributes().getLabel();
	if (label.getMapping().size() != 2) {
		throw new UserError(this, 114, "ROC Charts", label);
	}

	if (exampleSet.getAttributes().getPredictedLabel() != null && getParameterAsBoolean(PARAMETER_USE_MODEL)) {
		getLogger().warning("Input example already has a predicted label which will be removed.");
		PredictionModel.removePredictedLabel(exampleSet);
	}
	if (exampleSet.getAttributes().getPredictedLabel() == null && !getParameterAsBoolean(PARAMETER_USE_MODEL)) {
		throw new UserError(this, 107);
	}
	Model model = null;
	if (getParameterAsBoolean(PARAMETER_USE_MODEL)) {
		model = modelInput.getData(Model.class);
		exampleSet = model.apply(exampleSet);
	}
	if (exampleSet.getAttributes().getPredictedLabel() == null) {
		throw new UserError(this, 107);
	}

	ROCDataGenerator rocDataGenerator = new ROCDataGenerator(1.0d, 1.0d);
	ROCData rocPoints = rocDataGenerator.createROCData(exampleSet, getParameterAsBoolean(PARAMETER_USE_EXAMPLE_WEIGHTS),
			ROCBias.getROCBiasParameter(this));
	rocDataGenerator.createROCPlotDialog(rocPoints);

	PredictionModel.removePredictedLabel(exampleSet);

	modelOutput.deliver(model);
	exampleSetOutput.deliver(exampleSet);
}
 
開發者ID:rapidminer,項目名稱:rapidminer-studio,代碼行數:36,代碼來源:ROCChartGenerator.java

示例6: doWork

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
@Override
public void doWork() throws OperatorException {
	ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
	if (exampleSet.getAttributes().getLabel() == null) {
		throw new UserError(this, 105);
	}
	if (!exampleSet.getAttributes().getLabel().isNominal()) {
		throw new UserError(this, 101, "ROC Charts", exampleSet.getAttributes().getLabel());
	}
	if (exampleSet.getAttributes().getLabel().getMapping().getValues().size() != 2) {
		throw new UserError(this, 114, "ROC Charts", exampleSet.getAttributes().getLabel());
	}

	if (exampleSet.getAttributes().getPredictedLabel() != null && getParameterAsBoolean(PARAMETER_USE_MODEL)) {
		getLogger().warning("Input example already has a predicted label which will be removed.");
		PredictionModel.removePredictedLabel(exampleSet);
	}
	if (exampleSet.getAttributes().getPredictedLabel() == null && !getParameterAsBoolean(PARAMETER_USE_MODEL)) {
		throw new UserError(this, 107);
	}
	Model model = null;
	if (getParameterAsBoolean(PARAMETER_USE_MODEL)) {
		model = modelInput.getData(Model.class);		
		exampleSet = model.apply(exampleSet);
	}
	if (exampleSet.getAttributes().getPredictedLabel() == null) {
		throw new UserError(this, 107);
	}

	ROCDataGenerator rocDataGenerator = new ROCDataGenerator(1.0d, 1.0d);
	ROCData rocPoints = rocDataGenerator.createROCData(exampleSet, getParameterAsBoolean(PARAMETER_USE_EXAMPLE_WEIGHTS),
			ROCBias.getROCBiasParameter(this)); 
	rocDataGenerator.createROCPlotDialog(rocPoints);

	PredictionModel.removePredictedLabel(exampleSet);

	modelOutput.deliver(model);
	exampleSetOutput.deliver(exampleSet);
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:40,代碼來源:ROCChartGenerator.java

示例7: createReportable

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
@Override
public Reportable createReportable(Object renderable, IOContainer ioContainer, int desiredWidth, int desiredHeight) {
	ROCComparison model = (ROCComparison) renderable;
	ROCChartPlotter plotter = new ROCChartPlotter();
	Iterator<Map.Entry<String, List<ROCData>>> e = model.getRocData().entrySet().iterator();
	while (e.hasNext()) {
		Map.Entry<String, List<ROCData>> entry = e.next();
		plotter.addROCData(entry.getKey(), entry.getValue());	
	}
	return plotter;
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:12,代碼來源:ROCComparisonRenderer.java

示例8: getVisualizationComponent

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
@Override
public Component getVisualizationComponent(Object renderable, IOContainer ioContainer) {
	ROCComparison model = (ROCComparison) renderable;
	ROCChartPlotter plotter = new ROCChartPlotter();
	Iterator<Map.Entry<String, List<ROCData>>> e = model.getRocData().entrySet().iterator();
	while (e.hasNext()) {
		Map.Entry<String, List<ROCData>> entry = e.next();
		plotter.addROCData(entry.getKey(), entry.getValue());	
	}
	return plotter;
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:12,代碼來源:ROCComparisonRenderer.java

示例9: doWork

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
@Override
public void doWork() throws OperatorException {
	// sanity checks
	ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);

	// checking preconditions
	Attribute label = exampleSet.getAttributes().getLabel();
	if (label == null) {
		throw new UserError(this, 105);
	}
	if (!label.isNominal()) {
		throw new UserError(this, 101, label, "threshold finding");
	}
	exampleSet.recalculateAttributeStatistics(label);
	NominalMapping mapping = label.getMapping();
	if (mapping.size() != 2) {
		throw new UserError(this, 118, new Object[] { label, Integer.valueOf(mapping.getValues().size()),
				Integer.valueOf(2) });
	}
	if (exampleSet.getAttributes().getPredictedLabel() == null) {
		throw new UserError(this, 107);
	}
	boolean useExplictLabels = getParameterAsBoolean(PARAMETER_DEFINE_LABELS);

	double secondCost = getParameterAsDouble(PARAMETER_MISCLASSIFICATION_COSTS_SECOND);
	double firstCost = getParameterAsDouble(PARAMETER_MISCLASSIFICATION_COSTS_FIRST);
	if (useExplictLabels) {
		String firstLabel = getParameterAsString(PARAMETER_FIRST_LABEL);
		String secondLabel = getParameterAsString(PARAMETER_SECOND_LABEL);

		if (mapping.getIndex(firstLabel) == -1) {
			throw new UserError(this, 143, firstLabel, label.getName());
		}
		if (mapping.getIndex(secondLabel) == -1) {
			throw new UserError(this, 143, secondLabel, label.getName());
		}

		// if explicit order differs from order in data: internally swap costs.
		if (mapping.getIndex(firstLabel) > mapping.getIndex(secondLabel)) {
			double temp = firstCost;
			firstCost = secondCost;
			secondCost = temp;
		}
	}

	// check whether the confidence attributes are available
	if (exampleSet.getAttributes().getConfidence(mapping.getPositiveString()) == null) {
		throw new UserError(this, 113, Attributes.CONFIDENCE_NAME + "_" + mapping.getPositiveString());
	}
	if (exampleSet.getAttributes().getConfidence(mapping.getNegativeString()) == null) {
		throw new UserError(this, 113, Attributes.CONFIDENCE_NAME + "_" + mapping.getNegativeString());
	}
	// create ROC data
	ROCDataGenerator rocDataGenerator = new ROCDataGenerator(firstCost, secondCost);
	ROCData rocData = rocDataGenerator.createROCData(exampleSet, getParameterAsBoolean(PARAMETER_USE_EXAMPLE_WEIGHTS),
			ROCBias.getROCBiasParameter(this));

	// create plotter
	if (getParameterAsBoolean(PARAMETER_SHOW_ROC_PLOT)) {
		rocDataGenerator.createROCPlotDialog(rocData, true, true);
	}

	// create and return output
	exampleSetOutput.deliver(exampleSet);
	thresholdOutput.deliver(new Threshold(rocDataGenerator.getBestThreshold(), mapping.getNegativeString(), mapping
			.getPositiveString()));
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:68,代碼來源:ThresholdFinder.java

示例10: getRocData

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
public List<ROCData> getRocData() {
	return rocData;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:4,代碼來源:AreaUnderCurve.java

示例11: ROCComparison

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
public ROCComparison(Map<String, List<ROCData>> rocData) {
	this.rocData = rocData;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:4,代碼來源:ROCComparison.java

示例12: getRocData

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
public Map<String, List<ROCData>> getRocData() {
	return this.rocData;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:4,代碼來源:ROCComparison.java

示例13: addROCData

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
public void addROCData(String name, ROCData singleROCData) {
	List<ROCData> tempList = new LinkedList<>();
	tempList.add(singleROCData);
	addROCData(name, tempList);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:6,代碼來源:ROCChartPlotter.java

示例14: prepareData

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
protected void prepareData() {

		this.dataset = new YIntervalSeriesCollection();

		Iterator<Map.Entry<String, List<ROCData>>> r = rocDataLists.entrySet().iterator();
		boolean showThresholds = true;
		if (rocDataLists.size() > 1) {
			showThresholds = false;
		}

		while (r.hasNext()) {
			Map.Entry<String, List<ROCData>> entry = r.next();
			YIntervalSeries rocSeries = new YIntervalSeries(entry.getKey());
			YIntervalSeries thresholdSeries = new YIntervalSeries(entry.getKey() + " (Thresholds)");
			List<ROCData> dataList = entry.getValue();
			for (int i = 0; i <= NUMBER_OF_POINTS; i++) {

				double rocSum = 0.0d;
				double rocSquaredSum = 0.0d;
				double thresholdSum = 0.0d;
				double thresholdSquaredSum = 0.0d;
				for (ROCData data : dataList) {
					double rocValue = data.getInterpolatedTruePositives(i / (double) NUMBER_OF_POINTS)
							/ data.getTotalPositives();
					rocSum += rocValue;
					rocSquaredSum += rocValue * rocValue;

					double thresholdValue = data.getInterpolatedThreshold(i / (double) NUMBER_OF_POINTS);
					thresholdSum += thresholdValue;
					thresholdSquaredSum += thresholdValue * thresholdValue;
				}

				double rocMean = rocSum / dataList.size();
				double rocDeviation = Math.sqrt(rocSquaredSum / dataList.size() - (rocMean * rocMean));
				rocSeries.add(i / (double) NUMBER_OF_POINTS, rocMean, rocMean - rocDeviation, rocMean + rocDeviation);

				double thresholdMean = thresholdSum / dataList.size();
				double thresholdDeviation = Math.sqrt(thresholdSquaredSum / dataList.size()
						- (thresholdMean * thresholdMean));
				thresholdSeries.add(i / (double) NUMBER_OF_POINTS, thresholdMean, thresholdMean - thresholdDeviation,
						thresholdMean + thresholdDeviation);

			}
			dataset.addSeries(rocSeries);

			if (showThresholds) {
				dataset.addSeries(thresholdSeries);
			}
		}
	}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:51,代碼來源:ROCChartPlotter.java

示例15: doWork

import com.rapidminer.tools.math.ROCData; //導入依賴的package包/類
@Override
public void doWork() throws OperatorException {
	// sanity checks
	ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);

	// checking preconditions
	Tools.hasNominalLabels(exampleSet, getOperatorClassName());
	Attribute label = exampleSet.getAttributes().getLabel();
	exampleSet.recalculateAttributeStatistics(label);
	NominalMapping mapping = label.getMapping();
	if (mapping.size() != 2) {
		throw new UserError(this, 118, label, Integer.valueOf(mapping.getValues().size()), Integer.valueOf(2));
	}
	if (exampleSet.getAttributes().getPredictedLabel() == null) {
		throw new UserError(this, 107);
	}
	boolean useExplictLabels = getParameterAsBoolean(PARAMETER_DEFINE_LABELS);

	double secondCost = getParameterAsDouble(PARAMETER_MISCLASSIFICATION_COSTS_SECOND);
	double firstCost = getParameterAsDouble(PARAMETER_MISCLASSIFICATION_COSTS_FIRST);
	if (useExplictLabels) {
		String firstLabel = getParameterAsString(PARAMETER_FIRST_LABEL);
		String secondLabel = getParameterAsString(PARAMETER_SECOND_LABEL);

		if (mapping.getIndex(firstLabel) == -1) {
			throw new UserError(this, 143, firstLabel, label.getName());
		}
		if (mapping.getIndex(secondLabel) == -1) {
			throw new UserError(this, 143, secondLabel, label.getName());
		}

		// if explicit order differs from order in data: internally swap costs.
		if (mapping.getIndex(firstLabel) > mapping.getIndex(secondLabel)) {
			double temp = firstCost;
			firstCost = secondCost;
			secondCost = temp;
		}
	}

	// check whether the confidence attributes are available
	if (exampleSet.getAttributes().getConfidence(mapping.getPositiveString()) == null) {
		throw new UserError(this, 113, Attributes.CONFIDENCE_NAME + "_" + mapping.getPositiveString());
	}
	if (exampleSet.getAttributes().getConfidence(mapping.getNegativeString()) == null) {
		throw new UserError(this, 113, Attributes.CONFIDENCE_NAME + "_" + mapping.getNegativeString());
	}
	// create ROC data
	ROCDataGenerator rocDataGenerator = new ROCDataGenerator(firstCost, secondCost);
	ROCData rocData = rocDataGenerator.createROCData(exampleSet, getParameterAsBoolean(PARAMETER_USE_EXAMPLE_WEIGHTS),
			ROCBias.getROCBiasParameter(this));

	// create plotter
	if (getParameterAsBoolean(PARAMETER_SHOW_ROC_PLOT)) {
		rocDataGenerator.createROCPlotDialog(rocData, true, true);
	}

	// create and return output
	exampleSetOutput.deliver(exampleSet);
	thresholdOutput.deliver(new Threshold(rocDataGenerator.getBestThreshold(), mapping.getNegativeString(), mapping
			.getPositiveString()));
}
 
開發者ID:rapidminer,項目名稱:rapidminer-studio,代碼行數:62,代碼來源:ThresholdFinder.java


注:本文中的com.rapidminer.tools.math.ROCData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。