public double learn(double[] x, double[] y, double weight) {
        setInput(x);
        propagate();

        double err = weight * computeOutputError(y);

        if (weight != 1.0) {
            for (int i = 0; i < outputLayer.units; i++) {
                outputLayer.error[i] *= weight;
            }
        }
        
        backpropagate();
        adjustWeights();
        return err;
    }
public double learn ( double [ ] x , double [ ] y , double weight ) { setInput ( x ) ; propagate ( ) ; double err = weight * computeOutputError ( y ) ; if ( weight != 1.0 ) { for ( int i = 0 ; i < outputLayer . units ; i ++ ) { outputLayer . error [ i ] *= weight ; } } backpropagate ( ) ; adjustWeights ( ) ; return err ; }
Update the neural network with given instance and associated target value.
Note that this method is NOT multi-thread safe.
@param x the training instance.
@param y the target value.
@param weight a positive weight value associated with the training instance.
@return the weighted training error before back-propagation.