本文整理汇总了Java中com.rapidminer.operator.ports.metadata.MetaDataUnderspecifiedError类的典型用法代码示例。如果您正苦于以下问题:Java MetaDataUnderspecifiedError类的具体用法?Java MetaDataUnderspecifiedError怎么用?Java MetaDataUnderspecifiedError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetaDataUnderspecifiedError类属于com.rapidminer.operator.ports.metadata包,在下文中一共展示了MetaDataUnderspecifiedError类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractPerformanceEvaluator
import com.rapidminer.operator.ports.metadata.MetaDataUnderspecifiedError; //导入依赖的package包/类
public AbstractPerformanceEvaluator(OperatorDescription description) {
super(description);
// exampleSetInput.addPrecondition(new ExampleSetPrecondition(exampleSetInput,
// Ontology.VALUE_TYPE, Attributes.LABEL_NAME,
// Attributes.PREDICTION_NAME));
exampleSetInput.addPrecondition(new CapabilityPrecondition(this, exampleSetInput));
exampleSetInput.addPrecondition(new SimplePrecondition(exampleSetInput, new ExampleSetMetaData()) {
@Override
public void makeAdditionalChecks(MetaData metaData) {
if (!(metaData instanceof ExampleSetMetaData)) {
exampleSetInput.addError(new MetaDataUnderspecifiedError(exampleSetInput));
return;
}
ExampleSetMetaData emd = (ExampleSetMetaData) metaData;
if (emd.hasSpecial(Attributes.LABEL_NAME) == MetaDataInfo.YES
&& emd.hasSpecial(Attributes.PREDICTION_NAME) == MetaDataInfo.YES) {
int type1 = emd.getSpecial(Attributes.LABEL_NAME).getValueType();
int type2 = emd.getSpecial(Attributes.PREDICTION_NAME).getValueType();
if (type1 != type2) {
exampleSetInput.addError(new SimpleMetaDataError(Severity.ERROR, exampleSetInput,
"label_prediction_mismatch", new Object[] { Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(type1),
Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(type2) }));
} else if (!canEvaluate(type1)) {
exampleSetInput.addError(new SimpleMetaDataError(Severity.ERROR, exampleSetInput,
"cannot_evaluate_label_type", new Object[] { Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(type1) }));
}
}
}
});
performanceInput.addPrecondition(new SimplePrecondition(performanceInput, new MetaData(PerformanceVector.class),
false));
PassThroughOrGenerateRule performanceRule = new PassThroughOrGenerateRule(performanceInput, performanceOutput,
new MetaData(PerformanceVector.class));
getTransformer().addRule(performanceRule);
getTransformer().addRule(new PassThroughRule(exampleSetInput, exampleSetOutput, false));
// add values for logging
List<PerformanceCriterion> criteria = getCriteria();
for (PerformanceCriterion criterion : criteria) {
addPerformanceValue(criterion.getName(), criterion.getDescription());
}
addValue(new ValueDouble("performance", "The last performance (main criterion).") {
@Override
public double getDoubleValue() {
if (currentPerformanceVector != null) {
return currentPerformanceVector.getMainCriterion().getAverage();
} else {
return Double.NaN;
}
}
});
}
示例2: AbstractPerformanceEvaluator
import com.rapidminer.operator.ports.metadata.MetaDataUnderspecifiedError; //导入依赖的package包/类
public AbstractPerformanceEvaluator(OperatorDescription description) {
super(description);
// exampleSetInput.addPrecondition(new ExampleSetPrecondition(exampleSetInput,
// Ontology.VALUE_TYPE, Attributes.LABEL_NAME,
// Attributes.PREDICTION_NAME));
exampleSetInput.addPrecondition(new CapabilityPrecondition(this, exampleSetInput));
exampleSetInput.addPrecondition(new SimplePrecondition(exampleSetInput, new ExampleSetMetaData()) {
@Override
public void makeAdditionalChecks(MetaData metaData) {
if (!(metaData instanceof ExampleSetMetaData)) {
exampleSetInput.addError(new MetaDataUnderspecifiedError(exampleSetInput));
return;
}
ExampleSetMetaData emd = (ExampleSetMetaData) metaData;
if (emd.hasSpecial(Attributes.LABEL_NAME) == MetaDataInfo.YES
&& emd.hasSpecial(Attributes.PREDICTION_NAME) == MetaDataInfo.YES) {
int type1 = emd.getSpecial(Attributes.LABEL_NAME).getValueType();
int type2 = emd.getSpecial(Attributes.PREDICTION_NAME).getValueType();
if (type1 != type2) {
exampleSetInput.addError(new SimpleMetaDataError(Severity.ERROR, exampleSetInput,
"label_prediction_mismatch", new Object[] { Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(type1),
Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(type2) }));
} else if (!canEvaluate(type1)) {
exampleSetInput.addError(new SimpleMetaDataError(Severity.ERROR, exampleSetInput,
"cannot_evaluate_label_type", new Object[] { Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(type1) }));
}
}
}
});
performanceInput.addPrecondition(new SimplePrecondition(performanceInput, new MetaData(PerformanceVector.class),
false));
PassThroughOrGenerateRule performanceRule = new PassThroughOrGenerateRule(performanceInput, performanceOutput,
new MetaData(PerformanceVector.class));
getTransformer().addRule(performanceRule);
getTransformer().addRule(new PassThroughRule(exampleSetInput, exampleSetOutput, false));
// add values for logging
List<PerformanceCriterion> criteria = getCriteria();
for (PerformanceCriterion criterion : criteria) {
addPerformanceValue(criterion.getName(), criterion.getDescription());
}
addValue(new ValueDouble("performance", "The last performance (main criterion).") {
@Override
public double getDoubleValue() {
if (currentPerformanceVector != null) {
return currentPerformanceVector.getMainCriterion().getAverage();
} else {
return Double.NaN;
}
}
});
}
示例3: AbstractPerformanceEvaluator
import com.rapidminer.operator.ports.metadata.MetaDataUnderspecifiedError; //导入依赖的package包/类
public AbstractPerformanceEvaluator(OperatorDescription description) {
super(description);
//exampleSetInput.addPrecondition(new ExampleSetPrecondition(exampleSetInput, Ontology.VALUE_TYPE, Attributes.LABEL_NAME, Attributes.PREDICTION_NAME));
exampleSetInput.addPrecondition(new CapabilityPrecondition(this, exampleSetInput));
exampleSetInput.addPrecondition(new SimplePrecondition(exampleSetInput, new ExampleSetMetaData()) {
@Override
public void makeAdditionalChecks(MetaData metaData) {
if (!(metaData instanceof ExampleSetMetaData)) {
exampleSetInput.addError(new MetaDataUnderspecifiedError(exampleSetInput));
return;
}
ExampleSetMetaData emd = (ExampleSetMetaData)metaData;
if ((emd.hasSpecial(Attributes.LABEL_NAME) == MetaDataInfo.YES) && (emd.hasSpecial(Attributes.PREDICTION_NAME) == MetaDataInfo.YES)) {
int type1 = emd.getSpecial(Attributes.LABEL_NAME).getValueType();
int type2 = emd.getSpecial(Attributes.PREDICTION_NAME).getValueType();
if (type1 != type2) {
exampleSetInput.addError(new SimpleMetaDataError(Severity.ERROR,
exampleSetInput,
"label_prediction_mismatch",
new Object[] { Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(type1), Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(type2) }));
} else if (!canEvaluate(type1)) {
exampleSetInput.addError(new SimpleMetaDataError(Severity.ERROR, exampleSetInput, "cannot_evaluate_label_type", new Object[] { Ontology.ATTRIBUTE_VALUE_TYPE.mapIndex(type1) }));
}
}
}
});
performanceInput.addPrecondition(new SimplePrecondition(performanceInput, new MetaData(PerformanceVector.class), false));
PassThroughOrGenerateRule performanceRule = new PassThroughOrGenerateRule(performanceInput, performanceOutput, new MetaData(PerformanceVector.class));
getTransformer().addRule(performanceRule);
getTransformer().addRule(new PassThroughRule(exampleSetInput, exampleSetOutput, false));
// add values for logging
List<PerformanceCriterion> criteria = getCriteria();
for (PerformanceCriterion criterion : criteria) {
addPerformanceValue(criterion.getName(), criterion.getDescription());
}
addValue(new ValueDouble("performance", "The last performance (main criterion).") {
@Override
public double getDoubleValue() {
if (currentPerformanceVector != null)
return currentPerformanceVector.getMainCriterion().getAverage();
else
return Double.NaN;
}
});
}