Giter Site home page Giter Site logo

Comments (3)

colgreen avatar colgreen commented on June 3, 2024

Please see these classes in the SharpNeat.Neat.Genome.IO namespace:

  NeatGenomeSaver
  NeatGenomeLoader
  NeatGenomeLoaderFactory

You need to get an instance of NeatGenomeLoader, and the easiest way to do that is by calling static helper method NeatGenomeLoaderFactory.CreateLoaderDouble(); that in turn requires a MetaNeatGenome object to be supplied, with these properties set accordingly:

        /// <summary>
        /// Input node count.
        /// </summary>
        public int InputNodeCount { get; }

        /// <summary>
        /// Output node count.
        /// </summary>
        public int OutputNodeCount { get; }

        /// <summary>
        /// Indicates if the genomes that are evolved are acyclic, i.e. they should have no recurrent/cyclic connection paths.
        /// </summary>
        public bool IsAcyclic { get; }

        /// <summary>
        /// The neuron activation function to use in evolved networks. NEAT uses the same activation
        /// function at each node.
        /// </summary>
        public IActivationFunction<T> ActivationFn { get; }

Some of that info is redundant because it is saved in the genome data file. This is so that we can compare a loaded genome with the expected parameters for a given experiment we are loading it for (e.g. number of inputs and outputs).

This could all be a lot clearer I think, especially for the use case of loading an evolved network for direct use where you don't care that it came from a NeatGenome, but hopefully the above info allows you to do what you want today. The genome data format is very simple actually, so it should be relatively straightforward to write some code to load a genom data file directly into one of the NeuralNet types.

from sharpneat.

LightCZ avatar LightCZ commented on June 3, 2024

These classes looks very nice to save progress of the evolution - thank you for that. My point was exactly pointing out this:

The genome data format is very simple actually, so it should be relatively straightforward to write some code to load a genom data file directly into one of the NeuralNet types.

I think that this code is already written - CreateGenomeDecoder from experiemnt. You easily can create experiment - since you already need it for evolution phase - why not use is again in the loading phase. Use GenomeDecoder either created from INeatExperiment (simmilar properties as MetaNeatGenome) - Is acyclic etc.

  public class MetaNeatGenome<T> where T : struct
    {
        #region Auto Properties

        /// <summary>
        /// Input node count.
        /// </summary>
        public int InputNodeCount { get; }

        /// <summary>
        /// Output node count.
        /// </summary>
        public int OutputNodeCount { get; }

        /// <summary>
        /// Indicates if the genomes that are evolved are acyclic, i.e. they should have no recurrent/cyclic connection paths.
        /// </summary>
        public bool IsAcyclic { get; }

        /// <summary>
        /// The neuron activation function to use in evolved networks. NEAT uses the same activation
        /// function at each node.
        /// </summary>
        public IActivationFunction<T> ActivationFn { get; }

From INeatExperiment


    bool IsAcyclic { get; set; }
    int CyclesPerActivation { get; set; }
    string ActivationFnName { get; set; }

you even can create MetaNeatGenome from INeatExperiment with:
NeatUtils.CreateMetaNeatGenome(neatExperiment)

I think that either make CreateGenomeDecoder or maybe extend your IO namespace with directly loading into NeuralNet type would be much more clear.

By the way thank you very much for creating this framework.

from sharpneat.

colgreen avatar colgreen commented on June 3, 2024

Resolved.

Please see #55

from sharpneat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.