public void trainOnFunction(double[][] inputs, double[][] target) {
        if (inputs.length != target.length) {
            throw new IllegalArgumentException("Number of input points does not equal number of output points");
        }

        for (int i = 0; i < inputs.length; i++) {
            if (inputs[i].length != nodes[0].length) {
                throw new IllegalArgumentException("Incorrect input dimension");
            }
        }

        for (int i = 0; i < target.length; i++) {
            if (target[i].length != nodes[numLayers].length) {
                throw new IllegalArgumentException("Incorrect target dimension");
            }
        }

        for (int i = 0; i < inputs.length; i++) {
            for (int j = 0; j < inputs[i].length; j++) {
                ((InitialNode) nodes[0][j]).setConcentration(inputs[i][j]);
            }

            for (Edge edge : edgeSet) {
                edge.calculateUpdate(target[i]);
            }
        }

        for (Edge edge : edgeSet) {
            edge.applyUpdate();
        }
    }