src/core/preprocess/Normalizer.java
public void minMaxSamples(HashMap<Integer, MMatrix> data, double newMinimum, double newMaximum, boolean adjust, HashSet<Integer> normalizableRows) throws NeuralNetworkException {
        if (data.size() == 0) return;
        if (!adjustedMinMax && !adjust) throw new NeuralNetworkException("Normalizer is not adjusted");
        if (adjust) {
            int dataRows = data.values().toArray(new MMatrix[0])[0].get(0).getRows();
            minMaxRows.clear();
            minimumValues.clear();
            maximumValues.clear();
            if (normalizableRows == null || normalizableRows.isEmpty()) for (int row = 0; row < dataRows; row++) minMaxRows.add(row);
            else for (Integer row : normalizableRows) if (row >= 0 && row < dataRows) minMaxRows.add(row);
        }
        for (Integer row : minMaxRows) {
            if (adjust) {
                minimumValues.put(row, Double.POSITIVE_INFINITY);
                maximumValues.put(row, Double.NEGATIVE_INFINITY);
                for (Integer entry : data.keySet()) {
                    for (Integer depth : data.get(entry).keySet()) {
                        minimumValues.put(row, Math.min(minimumValues.get(row), data.get(entry).get(depth).getValue(row, 0)));
                        maximumValues.put(row, Math.max(maximumValues.get(row), data.get(entry).get(depth).getValue(row, 0)));
                    }
                }
                adjustedMinMax = true;
            }
            double delta = maximumValues.get(row) - minimumValues.get(row) != 0 ? maximumValues.get(row) - minimumValues.get(row) : 1;
            for (Integer entry : data.keySet()) {
                for (Integer depth : data.get(entry).keySet()) {
                    double newValue = (data.get(entry).get(depth).getValue(row, 0) - minimumValues.get(row)) / delta * (newMaximum - newMinimum) + newMinimum;
                    data.get(entry).get(depth).setValue(row, 0, newValue);
                }
            }
        }
    }
/**
     * Executes min max normalization.<br>
     * Can either adjust normalizer or use earlier adjustment. This is useful if training data and test data must be adjusted by same normalization setting.<br>
     *
     * @param data data to be normalized.
     * @param newMinimum manually define minimum value for mapping.
     * @param newMaximum manually define maximum value for mapping.
     * @param adjust true if normalizer is adjusted with current data otherwise earlier normalization setting is applied.
     * @param normalizableRows rows to be normalized.
     * @throws NeuralNetworkException throws exception if normalizer is not yet adjusted.
     */
Executes min max normalization.
Can either adjust normalizer or use earlier adjustment. This is useful if training data and test data must be adjusted by same normalization setting.

@param data data to be normalized.
@param newMinimum manually define minimum value for mapping.
@param newMaximum manually define maximum value for mapping.
@param adjust true if normalizer is adjusted with current data otherwise earlier normalization setting is applied.
@param normalizableRows rows to be normalized.
@throws NeuralNetworkException throws exception if normalizer is not yet adjusted.
Executes min max normalization . Can either adjust normalizer or use earlier adjustment . This is useful if training data and test data must be adjusted by same normalization setting . @param data data to be normalized . @param newMinimum manually define minimum value for mapping . @param newMaximum manually define maximum value for mapping . @param adjust true if normalizer is adjusted with current data otherwise earlier normalization setting is applied . @param normalizableRows rows to be normalized . @throws NeuralNetworkException throws exception if normalizer is not yet adjusted .
public void minMaxSamples(HashMap<Integer, MMatrix> data, double newMinimum, double newMaximum, boolean adjust, HashSet<Integer> normalizableRows) throws NeuralNetworkException {
        if (data.size() == 0) return;
        if (!adjustedMinMax && !adjust) throw new NeuralNetworkException("Normalizer is not adjusted");
        if (adjust) {
            int dataRows = data.values().toArray(new MMatrix[0])[0].get(0).getRows();
            minMaxRows.clear();
            minimumValues.clear();
            maximumValues.clear();
            if (normalizableRows == null || normalizableRows.isEmpty()) for (int row = 0; row < dataRows; row++) minMaxRows.add(row);
            else for (Integer row : normalizableRows) if (row >= 0 && row < dataRows) minMaxRows.add(row);
        }
        for (Integer row : minMaxRows) {
            if (adjust) {
                minimumValues.put(row, Double.POSITIVE_INFINITY);
                maximumValues.put(row, Double.NEGATIVE_INFINITY);
                for (Integer entry : data.keySet()) {
                    for (Integer depth : data.get(entry).keySet()) {
                        minimumValues.put(row, Math.min(minimumValues.get(row), data.get(entry).get(depth).getValue(row, 0)));
                        maximumValues.put(row, Math.max(maximumValues.get(row), data.get(entry).get(depth).getValue(row, 0)));
                    }
                }
                adjustedMinMax = true;
            }
            double delta = maximumValues.get(row) - minimumValues.get(row) != 0 ? maximumValues.get(row) - minimumValues.get(row) : 1;
            for (Integer entry : data.keySet()) {
                for (Integer depth : data.get(entry).keySet()) {
                    double newValue = (data.get(entry).get(depth).getValue(row, 0) - minimumValues.get(row)) / delta * (newMaximum - newMinimum) + newMinimum;
                    data.get(entry).get(depth).setValue(row, 0, newValue);
                }
            }
        }
    }
public void minMaxSamples ( HashMap < Integer , MMatrix > data , double newMinimum , double newMaximum , boolean adjust , HashSet < Integer > normalizableRows ) throws NeuralNetworkException { if ( data . size ( ) == 0 ) return ; if ( ! adjustedMinMax && ! adjust ) throw new NeuralNetworkException ( "Normalizer is not adjusted" ) ; if ( adjust ) { int dataRows = data . values ( ) . toArray ( new MMatrix [ 0 ] ) [ 0 ] . get ( 0 ) . getRows ( ) ; minMaxRows . clear ( ) ; minimumValues . clear ( ) ; maximumValues . clear ( ) ; if ( normalizableRows == null || normalizableRows . isEmpty ( ) ) for ( int row = 0 ; row < dataRows ; row ++ ) minMaxRows . add ( row ) ; else for ( Integer row : normalizableRows ) if ( row >= 0 && row < dataRows ) minMaxRows . add ( row ) ; } for ( Integer row : minMaxRows ) { if ( adjust ) { minimumValues . put ( row , Double . POSITIVE_INFINITY ) ; maximumValues . put ( row , Double . NEGATIVE_INFINITY ) ; for ( Integer entry : data . keySet ( ) ) { for ( Integer depth : data . get ( entry ) . keySet ( ) ) { minimumValues . put ( row , Math . min ( minimumValues . get ( row ) , data . get ( entry ) . get ( depth ) . getValue ( row , 0 ) ) ) ; maximumValues . put ( row , Math . max ( maximumValues . get ( row ) , data . get ( entry ) . get ( depth ) . getValue ( row , 0 ) ) ) ; } } adjustedMinMax = true ; } double delta = maximumValues . get ( row ) - minimumValues . get ( row ) != 0 ? maximumValues . get ( row ) - minimumValues . get ( row ) : 1 ; for ( Integer entry : data . keySet ( ) ) { for ( Integer depth : data . get ( entry ) . keySet ( ) ) { double newValue = ( data . get ( entry ) . get ( depth ) . getValue ( row , 0 ) - minimumValues . get ( row ) ) / delta * ( newMaximum - newMinimum ) + newMinimum ; data . get ( entry ) . get ( depth ) . setValue ( row , 0 , newValue ) ; } } } }
Executes min max normalization.<br>
 Can either adjust normalizer or use earlier adjustment.
Executes min max normalization . <br > Can either adjust normalizer or use earlier adjustment .