@Override public ExampleSetMetaData applyOnFilteredMetaData(ExampleSetMetaData metaData) { for (AttributeMetaData amd : metaData.getAllAttributes()) { if (amd.isNumerical() && !amd.isSpecial()) { Range range = amd.getValueRange(); amd.setValueRange( new Range(0, Math.max(Math.abs(range.getLower()), Math.abs(range.getUpper()))), amd.getValueSetRelation()); amd.getMean().setUnkown(); } } return metaData; }
@Override public ExampleSetMetaData applyOnFilteredMetaData(ExampleSetMetaData emd) { boolean round = getParameterAsBoolean(PARAMETER_ROUND); for (AttributeMetaData amd : emd.getAllAttributes()) { if ((Ontology.ATTRIBUTE_VALUE_TYPE.isA(amd.getValueType(), Ontology.NUMERICAL)) && (!Ontology.ATTRIBUTE_VALUE_TYPE.isA(amd.getValueType(), Ontology.INTEGER))) { amd.setType(Ontology.INTEGER); } if (round) { amd.setValueRange( new Range( Math.round(amd.getValueRange().getLower()), Math.round(amd.getValueRange().getUpper())), SetRelation.EQUAL); } else { amd.setValueRange( new Range((long) amd.getValueRange().getLower(), (long) amd.getValueRange().getUpper()), SetRelation.EQUAL); } } return emd; }
private void setMetaData( String value, AttributeMetaData targetAttribute, String i18nCode, Object[] i18nArguments) { if (targetAttribute != null) { if (targetAttribute.isNominal()) { targetAttribute.getValueSet().add(value); } else { try { targetAttribute.getValueRange().add(Double.parseDouble(value)); } catch (NumberFormatException e) { // add warning addError( new SimpleProcessSetupError( Severity.WARNING, getPortOwner(), i18nCode, i18nArguments)); } } } }