Package com.heatonresearch.aifh.learning

Examples of com.heatonresearch.aifh.learning.RBFNetwork


     * @param codec The codec, the type of network to use.
     * @return The population.
     */
    public static Population initPopulation(GenerateRandom rnd, RBFNetworkGenomeCODEC codec) {
        // Create a RBF network to get the length.
        final RBFNetwork network = new RBFNetwork(codec.getInputCount(), codec.getRbfCount(), codec.getOutputCount());
        int size = network.getLongTermMemory().length;

        // Create a new population, use a single species.
        Population result = new BasicPopulation(POPULATION_SIZE, new DoubleArrayGenomeFactory(size));
        BasicSpecies defaultSpecies = new BasicSpecies();
        defaultSpecies.setPopulation(result);
        result.getSpecies().add(defaultSpecies);

        // Create a new population of random networks.
        for (int i = 0; i < POPULATION_SIZE; i++) {
            final DoubleArrayGenome genome = new DoubleArrayGenome(size);
            network.reset(rnd);
            System.arraycopy(network.getLongTermMemory(), 0, genome.getData(), 0, size);
            defaultSpecies.add(genome);
        }

        // Set the genome factory to use the double array genome.
        result.setGenomeFactory(new DoubleArrayGenomeFactory(size));
View Full Code Here


            genetic.addOperation(0.3, new MutatePerturb(0.1));


            performIterations(genetic, 100000, 0.05, true);

            RBFNetwork winner = (RBFNetwork) codec.decode(genetic.getBestGenome());

            queryOneOfN(winner, trainingData, species);


        } catch (Throwable t) {
View Full Code Here

     * @param codec The codec, the type of network to use.
     * @return The population.
     */
    public static Population initPopulation(GenerateRandom rnd, RBFNetworkGenomeCODEC codec) {
        // Create a RBF network to get the length.
        final RBFNetwork network = new RBFNetwork(codec.getInputCount(), codec.getRbfCount(), codec.getOutputCount());
        int size = network.getLongTermMemory().length;

        // Create a new population, use a single species.
        Population result = new BasicPopulation(POPULATION_SIZE, new DoubleArrayGenomeFactory(size));
        BasicSpecies defaultSpecies = new BasicSpecies();
        defaultSpecies.setPopulation(result);
        result.getSpecies().add(defaultSpecies);

        // Create a new population of random networks.
        for (int i = 0; i < POPULATION_SIZE; i++) {
            final DoubleArrayGenome genome = new DoubleArrayGenome(size);
            network.reset(rnd);
            System.arraycopy(network.getLongTermMemory(), 0, genome.getData(), 0, size);
            defaultSpecies.add(genome);
        }

        // Set the genome factory to use the double array genome.
        result.setGenomeFactory(new DoubleArrayGenomeFactory(size));
View Full Code Here

            genetic.addOperation(0.3, new MutatePerturb(0.1));


            performIterations(genetic, 100000, 0.05, true);

            RBFNetwork winner = (RBFNetwork) codec.decode(genetic.getBestGenome());

            queryOneOfN(winner, trainingData, species);


        } catch (Throwable t) {
View Full Code Here

            final Map<String, Integer> species = ds.encodeEquilateral(4);
            istream.close();

            final List<BasicData> trainingData = ds.extractSupervised(0, 4, 4, 2);

            final RBFNetwork network = new RBFNetwork(4, 4, 2);
            network.reset(new MersenneTwisterGenerateRandom());
            final ScoreFunction score = new ScoreRegressionData(trainingData);
            final TrainNelderMead train = new TrainNelderMead(network, score);
            performIterations(train, 1000, 0.01, true);
            queryEquilateral(network, trainingData, species, 0, 1);
View Full Code Here

            final Map<String, Integer> species = ds.encodeEquilateral(4);
            istream.close();

            final List<BasicData> trainingData = ds.extractSupervised(0, 4, 4, 2);

            final RBFNetwork network = new RBFNetwork(4, 4, 2);
            network.reset(new MersenneTwisterGenerateRandom());
            final ScoreFunction score = new ScoreRegressionData(trainingData);
            final TrainHillClimb train = new TrainHillClimb(true, network, score);
            performIterations(train, 100000, 0.01, true);
            queryEquilateral(network, trainingData, species, 0, 1);
View Full Code Here

    /**
     * Perform the example.
     */
    public void process() {
        final List<BasicData> trainingData = BasicData.convertArrays(XOR_INPUT, XOR_IDEAL);
        final RBFNetwork network = new RBFNetwork(2, 5, 1);
        final ScoreFunction score = new ScoreRegressionData(trainingData);
        final TrainGreedyRandom train = new TrainGreedyRandom(true, network, score);
        performIterations(train, 1000000, 0.01, true);
        query(network, trainingData);
    }
View Full Code Here

            final Map<String, Integer> species = ds.encodeEquilateral(4);
            istream.close();

            final List<BasicData> trainingData = ds.extractSupervised(0, 4, 4, 2);

            final RBFNetwork network = new RBFNetwork(4, 4, 2);
            final ScoreFunction score = new ScoreRegressionData(trainingData);
            final TrainGreedyRandom train = new TrainGreedyRandom(true, network, score);
            performIterations(train, 100000, 0.01, true);
            queryEquilateral(network, trainingData, species, 0, 1);
View Full Code Here

            final Map<String, Integer> species = ds.encodeOneOfN(4);
            istream.close();

            final List<BasicData> trainingData = ds.extractSupervised(0, 4, 4, 3);

            final RBFNetwork network = new RBFNetwork(4, 4, 3);
            network.reset(new MersenneTwisterGenerateRandom());

            final ScoreFunction score = new ScoreRegressionData(trainingData);
            final TrainAnneal train = new TrainAnneal(network, score);
            performIterations(train, 100000, 0.01, true);
            queryOneOfN(network, trainingData, species);
            System.out.println(Arrays.toString(network.getLongTermMemory()));


        } catch (Throwable t) {
            t.printStackTrace();
        }
View Full Code Here

        File dataPath = new File(filename);

        FitTitanic fit = new FitTitanic();
        fit.process(dataPath);

        RBFNetwork bestNetwork = fit.getBestNetwork();

        SubmitTitanic submit = new SubmitTitanic();
        submit.submit(dataPath, bestNetwork, fit.getCrossvalidation());
    }
View Full Code Here

TOP

Related Classes of com.heatonresearch.aifh.learning.RBFNetwork

Copyright © 2018 www.massapicom. 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.