@Override
    public void update(double[] x, double y) {
        propagate(x, true);
        setTarget(y);
        backpropagate(true);
        t++;
    }
@Test
    public void testLongley() throws Exception {
        System.out.println("longley");

        int p = Longley.x[0].length;
        MLP model = new MLP(Layer.input(p), Layer.rectifier(30), Layer.sigmoid(30));
        // small learning rate and weight decay to counter exploding gradient
        model.setLearningRate(TimeFunction.constant(0.01));
        model.setWeightDecay(0.1);

        for (int epoch = 0; epoch < 5; epoch++) {
            int[] permutation = MathEx.permutate(Longley.x.length);
            for (int i : permutation) {
                model.update(Longley.x[i], Longley.y[i]);
            }
        }

        java.nio.file.Path temp = Write.object(model);
        Read.object(temp);
    }