本文整理汇总了Java中com.rapidminer.operator.ProcessSetupError.Severity类的典型用法代码示例。如果您正苦于以下问题:Java Severity类的具体用法?Java Severity怎么用?Java Severity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Severity类属于com.rapidminer.operator.ProcessSetupError包,在下文中一共展示了Severity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRoleMetaData
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
private void setRoleMetaData(ExampleSetMetaData metaData, String name, String targetRole) {
AttributeMetaData amd = metaData.getAttributeByName(name);
if (amd != null) {
if (targetRole != null) {
if (REGULAR_NAME.equals(targetRole)) {
amd.setRegular();
} else {
AttributeMetaData oldRole = metaData.getAttributeByRole(targetRole);
if (oldRole != null && oldRole != amd) {
addError(new SimpleProcessSetupError(Severity.WARNING, this.getPortOwner(), "already_contains_role",
targetRole));
metaData.removeAttribute(oldRole);
}
amd.setRole(targetRole);
}
}
}
}
示例2: getErrorsForInput
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
/**
* Returns a (possibly empty) list of errors specifying in what regard <code>isData</code>
* differs from <code>this</code> meta data specification.
*
* @param inputPort
* required for generating errors
* @param isData
* the data received by the port
*/
public Collection<MetaDataError> getErrorsForInput(InputPort inputPort, MetaData isData, CompatibilityLevel level) {
if (!this.dataClass.isAssignableFrom(isData.dataClass)) {
return Collections.<MetaDataError> singletonList(new InputMissingMetaDataError(inputPort, this.getObjectClass(),
isData.getObjectClass()));
}
Collection<MetaDataError> errors = new LinkedList<MetaDataError>();
if (level == CompatibilityLevel.VERSION_5) {
for (Map.Entry<String, Object> entry : this.keyValueMap.entrySet()) {
Object isValue = isData.keyValueMap.get(entry.getKey());
if (!entry.getValue().equals(isValue)) {
errors.add(new SimpleMetaDataError(Severity.ERROR, inputPort, "general_property_mismatch", new Object[] {
entry.getKey(), entry.getValue() }));
}
}
}
return errors;
}
示例3: addError
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
/**
* Adds an error message.
*
* @deprecated Use {@link #addError(ProcessSetupError)}
*/
@Deprecated
public void addError(final String message) {
errorList.add(new ProcessSetupError() {
@Override
public String getMessage() {
return message;
}
@Override
public PortOwner getOwner() {
return portOwner;
}
@Override
public List<QuickFix> getQuickFixes() {
return Collections.emptyList();
}
@Override
public Severity getSeverity() {
return Severity.ERROR;
}
});
}
示例4: addWarning
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
/**
* Adds a warning message to the error list.
*
* @deprecated Use {@link #addError(ProcessSetupError)} *
*/
@Deprecated
public void addWarning(final String message) {
errorList.add(new ProcessSetupError() {
@Override
public String getMessage() {
return message;
}
@Override
public PortOwner getOwner() {
return portOwner;
}
@Override
public List<QuickFix> getQuickFixes() {
return Collections.emptyList();
}
@Override
public Severity getSeverity() {
return Severity.WARNING;
}
});
}
示例5: ProcessLogOperator
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
public ProcessLogOperator(OperatorDescription description) {
super(description);
dummyPorts.start();
getTransformer().addRule(dummyPorts.makePassThroughRule());
// check if the user entered duplicate column names
getTransformer().addRule(new MDTransformationRule() {
@Override
public void transformMD() {
try {
getColumnNames();
} catch (UserError e) {
addError(new SimpleProcessSetupError(Severity.INFORMATION, ProcessLogOperator.this.getPortOwner(),
Collections.singletonList(new ParameterSettingQuickFix(ProcessLogOperator.this, PARAMETER_LOG)),
"duplicate_log_column"));
}
}
});
}
示例6: CovarianceMatrixOperator
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
public CovarianceMatrixOperator(OperatorDescription description) {
super(description);
exampleSetInput.addPrecondition(new ExampleSetPrecondition(exampleSetInput) {
@Override
public void makeAdditionalChecks(ExampleSetMetaData emd) throws UndefinedParameterError {
for (AttributeMetaData amd : emd.getAllAttributes()) {
if (!amd.isSpecial() && !amd.isNumerical()) {
exampleSetInput.addError(new SimpleMetaDataError(Severity.WARNING, exampleSetInput,
"not_defined_on_nominal", "Covariance"));
break;
}
}
super.makeAdditionalChecks(emd);
}
});
getTransformer().addPassThroughRule(exampleSetInput, exampleSetOutput);
getTransformer().addGenerationRule(covarianceOutput, NumericalMatrix.class);
}
示例7: ANOVAMatrixOperator
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
public ANOVAMatrixOperator(OperatorDescription description) {
super(description);
exampleSetInput.addPrecondition(new ExampleSetPrecondition(exampleSetInput) {
@Override
public void makeAdditionalChecks(ExampleSetMetaData emd) throws UndefinedParameterError {
int numberOfNominals = 0;
for (AttributeMetaData amd : emd.getAllAttributes()) {
if (amd.isNominal()) {
numberOfNominals++;
}
}
if (numberOfNominals == 0) {
createError(Severity.WARNING, "exampleset.must_contain_nominal_attribute");
}
}
});
getTransformer().addRule(new PassThroughRule(exampleSetInput, exampleSetOutput, false));
getTransformer().addRule(new GenerateNewMDRule(anovaOutput, ANOVAMatrix.class));
}
示例8: modifyExampleSetMetaData
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
@Override
protected MetaData modifyExampleSetMetaData(ExampleSetMetaData unmodifiedMetaData) {
switch (unmodifiedMetaData.hasSpecial(Attributes.LABEL_NAME)) {
case NO:
getTrainingSetInputPort().addError(
new SimpleMetaDataError(Severity.ERROR, getTrainingSetInputPort(), "special_missing", "label"));
return unmodifiedMetaData;
case UNKNOWN:
getTrainingSetInputPort().addError(
new SimpleMetaDataError(Severity.WARNING, getTrainingSetInputPort(), "special_unknown", "label"));
return unmodifiedMetaData;
case YES:
AttributeMetaData labelMD = unmodifiedMetaData.getLabelMetaData();
unmodifiedMetaData.removeAttribute(labelMD);
AttributeMetaData transformedMD = labelMD.copy();
transformedMD.setName("transformation(" + labelMD.getName() + ")");
// TODO: Transform values instead of setting unknown
transformedMD.setValueSetRelation(SetRelation.UNKNOWN);
transformedMD.setMean(new MDReal());
unmodifiedMetaData.addAttribute(transformedMD);
return unmodifiedMetaData;
default:
return unmodifiedMetaData;
}
}
示例9: modifyExampleSetMetaData
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
@Override
protected MetaData modifyExampleSetMetaData(ExampleSetMetaData unmodifiedMetaData) {
switch (unmodifiedMetaData.hasSpecial(Attributes.LABEL_NAME)) {
case NO:
getTrainingSetInputPort().addError(
new SimpleMetaDataError(Severity.ERROR, getTrainingSetInputPort(), "special_missing", "label"));
return unmodifiedMetaData;
case UNKNOWN:
getTrainingSetInputPort().addError(
new SimpleMetaDataError(Severity.WARNING, getTrainingSetInputPort(), "special_unknown", "label"));
return unmodifiedMetaData;
case YES:
AttributeMetaData labelMD = unmodifiedMetaData.getLabelMetaData();
unmodifiedMetaData.removeAttribute(labelMD);
AttributeMetaData transformedMD = new AttributeMetaData("regression(" + labelMD.getName() + ")",
Ontology.REAL, Attributes.LABEL_NAME);
transformedMD.setValueRange(new Range(-1d, 1d), SetRelation.EQUAL);
transformedMD.setValueSetRelation(SetRelation.EQUAL);
transformedMD.setMean(new MDReal());
unmodifiedMetaData.addAttribute(transformedMD);
return unmodifiedMetaData;
default:
return unmodifiedMetaData;
}
}
示例10: checkSelectedSubsetMetaData
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
@Override
protected void checkSelectedSubsetMetaData(ExampleSetMetaData subsetMetaData) {
switch (subsetMetaData.containsSpecialAttribute(Attributes.LABEL_NAME)) {
case YES:
AttributeMetaData labelMD = subsetMetaData.getAttributeByRole(Attributes.LABEL_NAME);
if (!labelMD.isNominal()) {
getExampleSetInputPort().addError(
new SimpleMetaDataError(Severity.ERROR, getExampleSetInputPort(), "attribute_has_wrong_type",
labelMD.getName(), Ontology.VALUE_TYPE_NAMES[Ontology.NOMINAL]));
}
break;
case NO:
getExampleSetInputPort().addError(
new SimpleMetaDataError(Severity.ERROR, getExampleSetInputPort(), "special_missing", "label"));
break;
case UNKNOWN:
default:
getExampleSetInputPort().addError(
new SimpleMetaDataError(Severity.WARNING, getExampleSetInputPort(), "special_unknown", "label"));
break;
}
}
示例11: modifyMetaData
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
@Override
protected MetaData modifyMetaData(ExampleSetMetaData metaData) throws UndefinedParameterError {
int rowNumber = getParameterAsInt(PARAMETER_ROW_NUMBER);
if (metaData.getNumberOfExamples().getRelation() == Relation.EQUAL
|| metaData.getNumberOfExamples().getRelation() == Relation.AT_MOST) {
if (rowNumber > metaData.getNumberOfExamples().getNumber()) {
getExampleSetInputPort().addError(
new SimpleMetaDataError(Severity.ERROR, getExampleSetInputPort(), Collections
.singletonList(new ParameterSettingQuickFix(this, PARAMETER_ROW_NUMBER, metaData
.getNumberOfExamples().getNumber() + "")),
"exampleset.parameters.need_more_examples", rowNumber, PARAMETER_ROW_NUMBER, rowNumber));
}
} else if (metaData.getNumberOfExamples().getRelation() == Relation.AT_LEAST) {
if (rowNumber > metaData.getNumberOfExamples().getNumber()) {
getExampleSetInputPort().addError(
new SimpleMetaDataError(Severity.WARNING, getExampleSetInputPort(), Collections
.singletonList(new ParameterSettingQuickFix(this, PARAMETER_ROW_NUMBER, metaData
.getNumberOfExamples().getNumber() + "")),
"exampleset.parameters.need_more_examples", rowNumber, PARAMETER_ROW_NUMBER, rowNumber));
}
}
metaData.clear();
metaData.attributesAreSuperset();
return metaData;
}
示例12: getSampledSize
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
@Override
protected MDInteger getSampledSize(ExampleSetMetaData emd) throws UndefinedParameterError {
switch (getParameterAsInt(PARAMETER_SAMPLE)) {
case SAMPLE_ABSOLUTE:
int absoluteNumber = getParameterAsInt(PARAMETER_SAMPLE_SIZE);
if (emd.getNumberOfExamples().isAtLeast(absoluteNumber) == MetaDataInfo.NO) {
getExampleSetInputPort().addError(
new SimpleMetaDataError(Severity.ERROR, getExampleSetInputPort(), Collections
.singletonList(new ParameterSettingQuickFix(this, PARAMETER_SAMPLE_SIZE, emd
.getNumberOfExamples().getValue().toString())), "exampleset.need_more_examples",
absoluteNumber + ""));
}
return new MDInteger(absoluteNumber);
case SAMPLE_RELATIVE:
MDInteger number = emd.getNumberOfExamples();
number.multiply(getParameterAsDouble(PARAMETER_SAMPLE_RATIO));
return number;
default:
return new MDInteger();
}
}
示例13: getSampledSize
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
@Override
protected MDInteger getSampledSize(ExampleSetMetaData emd) throws UndefinedParameterError {
switch (getParameterAsInt(PARAMETER_SAMPLE)) {
case SAMPLE_ABSOLUTE:
int absoluteNumber = getParameterAsInt(PARAMETER_SAMPLE_SIZE);
if (emd.getNumberOfExamples().isAtLeast(absoluteNumber) == MetaDataInfo.NO) {
getExampleSetInputPort().addError(
new SimpleMetaDataError(Severity.ERROR, getExampleSetInputPort(), Collections
.singletonList(new ParameterSettingQuickFix(this, PARAMETER_SAMPLE_SIZE, emd
.getNumberOfExamples().getValue().toString())), "need_more_examples",
absoluteNumber + ""));
}
return new MDInteger(absoluteNumber);
case SAMPLE_RELATIVE:
MDInteger number = emd.getNumberOfExamples();
number.multiply(getParameterAsDouble(PARAMETER_SAMPLE_RATIO));
return number;
default:
return new MDInteger();
}
}
示例14: modifyAttributeMetaData
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
@Override
public Collection<AttributeMetaData> modifyAttributeMetaData(ExampleSetMetaData emd, AttributeMetaData amd,
InputPort exampleSetInputPort, ParameterHandler parameterHandler) throws UndefinedParameterError {
if (amd.getValueSetRelation() == SetRelation.EQUAL) {
if (emd.getNumberOfExamples().isKnown()) {
amd.setMean(new MDReal(1d / emd.getNumberOfExamples().getValue()));
} else {
amd.setMean(new MDReal());
}
Range range = amd.getValueRange();
if (range.getLower() < 0d) {
exampleSetInputPort.addError(new SimpleMetaDataError(Severity.WARNING, exampleSetInputPort,
"attribute_contains_negative_values", amd.getName(), getName()));
}
} else {
// set to unknown
amd.setMean(new MDReal());
amd.setValueRange(new Range(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), SetRelation.UNKNOWN);
}
return Collections.singleton(amd);
}
示例15: getAttributeMetaData
import com.rapidminer.operator.ProcessSetupError.Severity; //导入依赖的package包/类
/**
* This method can be called in order to get the target attribute meta data after the
* aggregation functions have been applied. This method can register errors on the given
* InputPort (if not null), if there's an illegal state. If the state makes applying an
* {@link AggregationFunction} impossible, this method will return null!
*
* @param aggregationFunctionName
* please use one of the FUNCTION_NAME_* constants to prevent unnecessary errors
*/
public static final AttributeMetaData getAttributeMetaData(String aggregationFunctionName,
AttributeMetaData sourceAttributeMetaData, InputPort inputPort) {
AggregationFunctionMetaDataProvider metaDataProvider = AGGREGATION_FUNCTIONS_META_DATA_PROVIDER
.get(aggregationFunctionName);
if (metaDataProvider != null) {
return metaDataProvider.getTargetAttributeMetaData(sourceAttributeMetaData, inputPort);
} else {
// register error about unknown aggregation function
if (inputPort != null) {
inputPort.addError(new SimpleMetaDataError(Severity.ERROR, inputPort,
"aggregation.unknown_aggregation_function", aggregationFunctionName));
}
return null;
}
}