@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(); } }
@Override protected MDInteger getSampledSize(ExampleSetMetaData emd) throws UndefinedParameterError { switch (getParameterAsInt(PARAMETER_SAMPLE)) { case SAMPLE_ABSOLUTE: return new MDInteger(getParameterAsInt(PARAMETER_SAMPLE_SIZE)); case SAMPLE_RELATIVE: MDInteger number = emd.getNumberOfExamples(); number.multiply(getParameterAsDouble(PARAMETER_SAMPLE_RATIO)); return number; default: return new MDInteger(); } }