Code Monkey home page Code Monkey logo

ingenious's Introduction

ingenious

Travis build status: Build Status


Overview

The way in which a program combines a fitness calculator, a world and a UI

  • public static void main(String[] args) { ... }
    • [CalculatorSettings - optional]: user-defined settings for the calculators in the world
    • CalculatorProvider: used by the World to provide a corresponding calculator
    • World
    • App (UI)

The main method instantiates a fitness calculator provider, which may or may not require specific settings. Then it instantiates a world with that calculator provider. Finally it instantiates a UI with that world.

The general idea behind this is that a world can function properly with any kind of fitness calculator and it can be viewed/manipulated through any kind of UI. This is as modular as it can get. It might get even better if the feedforward neural network is made to function with any kind of neurons or activation function, but considering how RPROP is one of the most efficient simple algorithms, it may not be necessary.

Example calculator provider

The calculator provider instantiates a specific kind of Calculator, which takes DNA and determines the fitness of

an organism

  • SimpleCalculatorProvider
    • SimpleCalculator - just counts the number of 1s in the DNA that has been given to it

and...

  • CandleCalculatorProvider
    • CandleCalculator
      • FeedforwardNeuralNetwork
        • RpropFeedforwardNeuron (or BackpropFeedforwardNeuron)
          • LogisticActivationFunction
      • CandleDataset

Example world

The world creates/kills organisms, allows them to create calculators with the calculator provider and the organisms

pass their DNA to their personal calculator, which determines their fitness

  • SimpleWorld
    • SimpleOrganism
      • IntDna (or ByteDna)

Containment

When everything has been initialized, this is how the objects should contain each other

  • public static void main(String[] args) { ... }
    • App
      • World or World[], depending on what the app can handle
        • CalculatorProvider
          • Dataset [optional] - a dataset contains parsed data necessary for fitness calculation
        • Organism[]
          • Dna for the calculator
          • Dna [optional] - for the organism itself if it needs that (e.g. to determine its gender)
          • Calculator
            • NeuralNetwork [optional] - basically the brain of the organism

AI

The brains of the organisms. The neural networks can also be used outside of the context of organisms.

Currently there is only one type of neural networks in this project - atomic. The input of these networks is always of type double[] (i.e. numeric - one real value for each input neuron) and so is their output. The way they calculate the output and learn can vary greatly depending on what kind of a network it is and how it has been initialized. For now only a feedforward network class has been made, but there can be potentially even circular networks, for example a Hopfield network, or ones with an irregular shape.

Atomic network: #️⃣➡️#️⃣

Another 3 basic kinds of networks are planned:

  • 📷➡️#️⃣ Convolutional network (image input -> numeric output)
  • #️⃣➡️📷 Deconvolutional network (numeric input -> image output)
  • 📷➡️📷 Convolutional autoencoder (image input -> image output)

Image data will most probably be a double[][][] array - two dimensions for width and height, and one of depth in case the image has colours. The same kind of data can be used for audio (X is time, Y is pitch, and there is no depth) or even one-dimensional functions (X is, well, X, and there is no width or height).

The filters used in the convolutional networks will be of image type as well and should have width, height and depth lower than or equal to that of the image data that goes through them.

ingenious's People

Contributors

andypyrope avatar

Watchers

James Cloos avatar

ingenious's Issues

[P0] Generify and shorten the neural networks and nodes

  • There should be a NeuralNetwork class
  • FeedforwardNeuralNetwork should be renamed to FeedforwardNetwork
  • FeedforwardNeuron should be replaced with Neuron (because they would work in circular/chain networks as well, for example as a Markov chain)

[P0 | 6h] Improve CandleCalculator

Currently it reaches an error of 1.8%, which is too much. Moving averages, linear regression, or just different learning mechanisms are all welcome. The neural network would probably love that.

Currently, unfortunately, only raw candles are passed to the neural network of CandleCalculator.

[P2 | 8h] Create a complex world

NOTE: This world probably won't be useful for actual straightforward evolution. It's mostly just for fun, hence the low priority.

Organism constants (DNA-defined)

  • Genders (g - [0; 1)) - male organisms choosing female ones, after which female ones filter them out
    • Gender can be in the form of a double in the [0; 1) range. Every generation all organisms pick a temporary effective gender - male, female or asexual. The chance, if the gender coefficient is g, is as follows:
      • female: Math.max(0.5 - g, 0.0) -- chooses males based on their resources/fitness; receives resources from the chosen males but when giving birth, loses a preset part of her resources; doesn't know how much the males give,
      • male: Math.max(g - 0.5, 0.0) -- chooses females based on their fitness; gives resources to the ones who choose him
      • asexual: otherwise (the chance is technically 1.0 - Math.abs(0.5 - g))
  • Food/resources (r - (0; 1]) - every generation a set amount is given away and spread across the organisms, with the fittest ones receiving the most resources; an organism with 0 food dies; studying (training its neural network, etc.) costs resources. Any resources greater than 1.0 at the end of a generation are cut down to 1.0.
  • Care coefficient (c - [0; 1)). This one has 2 applications:
    • what part of their resources a parent gives to their child every generation
    • what part of their resources a male gives to a female
  • Studying coefficient (s - [0; 1)) - how much of their resources an organism is willing to spend for studying each generation
  • Promiscuity (p - [0; 1)) - what ratio of the available mates an organism would choose

World constants

  • Hunger rate (H - [0; 1)) - the amount of resources taken away from every organism (indiscriminately) each generation
  • N (N - natural number) - the average number of organisms. The resources given away each generation are equal to h * n. The number of organisms can go up or down but they should balance out around n
  • Max studying complexity (S - big natural number, e.g. 1 000 000) - the max number of computations an organism is allowed to make. The price of x computations is equal to x / S. Every generation an organism decides to allocate r * s resources for studying. If one studying iteration consists of x computations, then the organism will make (r * s) / (x / S) studying iterations. Any leftover resources remain in the organism.

TODO: Figure out how to make resource distribution fair. Another world constant may be necessary for this.

[P1 | 4h] Create a simple GUI

It should have:

  • a single label which shows what the current ConsoleInteractor shows
  • a button for next iteration
  • a text input (or numeric input) for specifying an exact number of iterations

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.