Giter VIP home page Giter VIP logo

Comments (3)

wagenaartje avatar wagenaartje commented on May 22, 2024 1

You are a right, the goal of all distance/error functions is to minimize their value. The built-in Network.prototype.evolve function tries to minimize the error on a certain dataset. A simple workaround is used:

return -sum;

As negative fitnesses are supported by Neataptic. From my perspective, I think it is quite logical that a 'fitness function' should return a higher value if a genome performs better (thus is 'fitter').

I think this is just a matter of personal preference. If more people bring this up then I will reverse the sort function, but still, this would create some problems with selection.FITNESS_PROPORTIONATE.

I could also create a seperate option when constructing the Neat instance where you can specify if you want to minimize or maximize the value of the fitness function.

from neataptic.

codyseibert avatar codyseibert commented on May 22, 2024

Thanks for the work around suggestion! I didn't even think about negating the absolute sum result. Thank you for dedicating your time towards working on this project.

I think your argument makes sense. For example, let's say you want to write a fitness function which maximizes the amount made in a stock market trade. You want the network which has the greatest value. But, in another example, let's say you want a network to predict a position on an image; it would make sense to have your fitness function sum to zero be the maximum.

At the very least, I'd say document that the current implementation of the fitness function expects a maximum value to be the "most fit". (maybe I just skipped over that part in the docs, but I didn't read anything like that)

from neataptic.

wagenaartje avatar wagenaartje commented on May 22, 2024

Exactly. It depends on the problem. For some problems it is easy to define a maximum score (e.g. distance = 0) but not a minimum score and for some problems it is easy to define a minimum score (e.g. goals scored = 0) but not a maximum score.

I have added this extra info in the develop branch (7fc2cb4) and it will be build soon. I hope that makes a little clearer. I still might implement an option that allows the choice for minimize/maximize score. Thanks for the appreciation 😄

from neataptic.

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.