本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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()));
}
示例10: getRocData
import com.rapidminer.tools.math.ROCData; //导入依赖的package包/类
public List<ROCData> getRocData() {
return rocData;
}
示例11: ROCComparison
import com.rapidminer.tools.math.ROCData; //导入依赖的package包/类
public ROCComparison(Map<String, List<ROCData>> rocData) {
this.rocData = rocData;
}
示例12: getRocData
import com.rapidminer.tools.math.ROCData; //导入依赖的package包/类
public Map<String, List<ROCData>> getRocData() {
return this.rocData;
}
示例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);
}
示例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);
}
}
}
示例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()));
}