GithubHelp home page GithubHelp logo

jcs-pr / unity-neural-network Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blueteak/unity-neural-network

0.0 1.0 0.0 63 KB

Simple neural network implemented in C# for Unity3D

C# 100.00%

unity-neural-network's Introduction

Unity3D Neural Network

This is a C# implementation of a simple feedforward neural network.

This neural network can be used to solve any problems where an input vector of values from 0-1 results in an output vector of values from 0-1.
To use a neural network you must create a Network and a Dataset

private static NeuralNetwork.Network net;
private static List<DataSet> dataSets; 

//Initialize Network and Dataset
void Awake()
{
    int numInputs, numHiddenLayers, numOutputs;
    net = new NeuralNetwork.Network(numInputs, numHiddenLayers, numOutputs);
    dataSets = new List<DataSet>();
}

You can add data points to the dataset using

dataSets.Add(new DataSet(double[] inputs, double[] desiredOutputs));

Train the network with by calling

net.Train(dataSets, MinimumError);

MinimumError is the mimimum desired error for the network (The network will run the same dataset multiple times if it does not have enough datapoints to hit the minimum error with one trial).

Finally, you can test an input

double[] testInput = {0, 1, 0.2, 0.13};
double[] results = net.Compute(testInput);



Sample Scenes

Color picking

This project has a demo scene showing the power of the network by using it to determine which color text is easiest to read on randomly colored backgrounds.
Alt text

Users can select the color easiest to read, and after a few trials ( > 10 ) the Neural Network will show its pick for 'easiest to read color' for the given background.

Jump

Here's another demo scene. Train the network by jumping from platform to platform (Use space). After some collected datasets the network will decide if the player has to jump or not. Image

unity-neural-network's People

Contributors

blueteak avatar marvpaul avatar jalae avatar j-bbr avatar

Watchers

 avatar

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.