Giter Site home page Giter Site logo

pico-nn's Introduction

pico-nn

A pico-8 based neural network with genetic algorithms.

itch.io page

Lexaloffle BBS post

Getting started

Just copy code from here and use it in pico-8 or other lua app.

You also can download pico-8 carts from Itch or Lexaloffle BBS.

Also note that nn's draw function won't work in other lua applications, because its using pico-8's built-in functions.

Usage

A simple example on how to use it:

function _init()
    layers = {3, 5, 3}
    net = nn:new(layers)
    net:init_neurons()
    net:init_weights()
end

function _update()
	local input = {0.2, 0.5, 0.4}
	local output = net:feed_forward(input)
	local class = get_class(output)

	if class == 1 then
		-- do some action
	elseif class == 2 then
		-- do some other action
	else 
		-- do a completely different action
	end

	net:addfit(1 / 60)

	-- network mutation
	if condition then
		net:mutate()
	end
end

function _draw()
	local x, y = 4, 4
	local w, h = 120, 64
	net:draw(x, y, w, h)
end

Todo

  • Figure out a way to save trained model
  • ...and a way to load it

pico-nn's People

Contributors

vbrydik 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.