@Override
    public void preProcess(INDArray array, INDArray maskArray, MinMaxStats stats) {
    """
	Normalize a data array
	
	@param array the data to normalize
	@param stats statistics of the data population
    """
        if (array.rank() <= 2) {
            array.subiRowVector(stats.getLower());
            array.diviRowVector(stats.getRange());
        }
        // if feature Rank is 3 (time series) samplesxfeaturesxtimesteps
        // if feature Rank is 4 (images) samplesxchannelsxrowsxcols
        // both cases operations should be carried out in dimension 1
        else {
            Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getLower(), array, 1));
            Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, stats.getRange(), array, 1));
        }

        // Scale by target range
        array.muli(maxRange - minRange);
        // Add target range minimum values
        array.addi(minRange);

        if (maskArray != null) {
            DataSetUtil.setMaskedValuesToZero(array, maskArray);
        }
    }
@Override
    public void preProcess(INDArray array, INDArray maskArray, MinMaxStats stats) {
        if (array.rank() <= 2) {
            array.subiRowVector(stats.getLower());
            array.diviRowVector(stats.getRange());
        }
        // if feature Rank is 3 (time series) samplesxfeaturesxtimesteps
        // if feature Rank is 4 (images) samplesxchannelsxrowsxcols
        // both cases operations should be carried out in dimension 1
        else {
            Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getLower(), array, 1));
            Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, stats.getRange(), array, 1));
        }

        // Scale by target range
        array.muli(maxRange - minRange);
        // Add target range minimum values
        array.addi(minRange);

        if (maskArray != null) {
            DataSetUtil.setMaskedValuesToZero(array, maskArray);
        }
    }
@ Override public void preProcess ( INDArray array , INDArray maskArray , MinMaxStats stats ) { if ( array . rank ( ) <= 2 ) { array . subiRowVector ( stats . getLower ( ) ) ; array . diviRowVector ( stats . getRange ( ) ) ; } // if feature Rank is 3 (time series) samplesxfeaturesxtimesteps // if feature Rank is 4 (images) samplesxchannelsxrowsxcols // both cases operations should be carried out in dimension 1 else { Nd4j . getExecutioner ( ) . execAndReturn ( new BroadcastSubOp ( array , stats . getLower ( ) , array , 1 ) ) ; Nd4j . getExecutioner ( ) . execAndReturn ( new BroadcastDivOp ( array , stats . getRange ( ) , array , 1 ) ) ; } // Scale by target range array . muli ( maxRange - minRange ) ; // Add target range minimum values array . addi ( minRange ) ; if ( maskArray != null ) { DataSetUtil . setMaskedValuesToZero ( array , maskArray ) ; } }
Normalize a data array

@param array the data to normalize
@param stats statistics of the data population
Normalize a data array