/** * Normalize a single column to the input vector. * * @param colDef The column to normalize. * @param outputColumn The current position in the vector. * @param output The vector to output to. * @param isInput Is this an input column. * @param value The value to normalize. * @return The new current position in the vector. */ public int normalizeToVector( ColumnDefinition colDef, int outputColumn, double[] output, boolean isInput, String value) { MissingHandler handler = null; if (this.unknownValues.contains(value)) { if (!this.missingHandlers.containsKey(colDef)) { throw new EncogError( "Do not know how to process missing value \"" + value + "\" in field: " + colDef.getName()); } handler = this.missingHandlers.get(colDef); } if (colDef.getDataType() == ColumnType.continuous) { double d = parseDouble(value); if (handler != null) { d = handler.processDouble(colDef); } return this.normStrategy.normalizeColumn(colDef, isInput, d, output, outputColumn); } else { if (handler != null) { value = handler.processString(colDef); } return this.normStrategy.normalizeColumn(colDef, isInput, value, output, outputColumn); } }
/** * Define a missing value handler. * * @param colDef The column this handler applies to. * @param handler The handler. */ public void defineMissingHandler(ColumnDefinition colDef, MissingHandler handler) { this.missingHandlers.put(colDef, handler); handler.init(this); }