Examples of INeuralNetwork


Examples of zdenekdrahos.AI.NeuralNetwork.INeuralNetwork

        }
    };

    public static INeuralNetwork getNetwork() {
        INetworkBuilder builder = new NetworkBuilder();
        INeuralNetwork network = builder.build(topology, activations);
        network.setWeights(weights);
        return network;
    }
View Full Code Here

Examples of zdenekdrahos.AI.NeuralNetwork.INeuralNetwork

        int[] topology = {1, 2, 1};
        Activations[] activations = {Activations.LIN, Activations.SIG, Activations.LIN};

        INetworkBuilder networkBuilder = new NetworkBuilder();
        INeuralNetwork network = networkBuilder.build(topology, activations);

        TrainingInput in = new TrainingInput();
        in.iterationsCount = 2000;
        in.learningRate = 0.1;
        in.momentum = 0;
View Full Code Here

Examples of zdenekdrahos.AI.NeuralNetwork.INeuralNetwork

    public static void main(String[] args) {
        INetworkBuilder builder = new NetworkBuilder();
       
        int[] topology = {2, 3, 1};
        Activations[] activations = {Activations.LIN, Activations.TANH, Activations.LIN};       
        INeuralNetwork network = builder.build(topology, activations);
        Printing.printNetworkWeights(network);
       
        TrainingInput in = new TrainingInput();
        in.iterationsCount = 3000;
        in.learningRate = 0.8;
        in.momentum = 0.798;
        in.inputs = input;
        in.targets = output;
       
        ITrainingBuilder trainBuilder = new TrainingBuilder();
        ITraining train = trainBuilder.build();
        TrainingOutput out = new TrainingOutput(0.01);
        train.train(network, in, out);
        System.out.printf("Solution in %d iteration, minError = %f, lastError: %f\n\n", out.lastIterationNumber, out.minError, out.lastError);       
        //Printing.printNetworkWeights(network);
       
        System.out.println();
        System.out.println("Prediction");
       
        IFeedForward feedForward = new FeedForward();
        INetworkValues values;
        double excepted, real;
        for (int i = 0; i < input.length; i++) {
            values = feedForward.buildNetwork(network, input[i]);
            for (int j = 0; j < output[i].length; j++) {
                excepted = output[i][j];
                real = values.getNeuronValue(network.getOutputLayerIndex(), j);
                System.out.printf("Expected %f , but result %f\n", excepted, real);
            }           
        }
       
    }
View Full Code Here

Examples of zdenekdrahos.AI.NeuralNetwork.INeuralNetwork

    @Override
    public INeuralNetwork build(int[] topology, Activations[] functions) {
        if (topology.length != functions.length) {
            throw new IllegalArgumentException("Layers & functions - different length");
        }
        INeuralNetwork network = new NeuralNetwork();
        ILayer layer;
        for (int i = 0; i < topology.length; i++) {
            layer = new Layer(topology[i], getActivation(functions[i]));
            network.addLayer(layer);
        }
        network.generateWeights();
        return network;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.