Giter Site home page Giter Site logo

machinelearning's Introduction

MachineLearning

This repository is simply a collection of a few of my experiments with AI.

It includes the following:

  • A perceptron with hill climbing and gradient descent
  • A basic Feedforward Nerual Network with genetics and gradient descent
  • Flappy Bird AI implemented with Genetic Learning on my feedforward neural net
  • A TicTacToe AI implemented with a Minimax tree
  • A Connect4 AI implemented with a Minimax tree with Alpha Beta pruning and monte-carlo tree search on the value
  • A Checkers AI implemented with a Minimax tree with Alpha Beta pruning a feed forward value Neural Network which is trained from monte-carlo tree search
  • A Markov Chain which can analyze scripts or books and then recreate stories from said scripts (including some sample Game of Thrones scripts).
  • A genetic algorithm which tries to replicate a source image using only non-overlapping triangles and quads, described in more detail below.

Projects I have finished but are not included in this repository for different reasons:

  • A Snake AI that plays in a 20x20 board and is trained with a Feed Forward Neural Network by taking in two 1x10 slices of the board around it's head as inputs

Genetic Quad-Based Abstract Art Generator AI

->

->

The Algorithm

The generator starts with a single quad with the size of the screen, with a random color. At a high level, this algorithm works by mutating the color and verticies of quads, and by splitting quads into smaller sub-quads every once in a while.

Mutations are only accepted if the average "color difference" between each pixel in the source image and each pixel in the newly generated image (the loss) is lower with the mutation than without.

Each iteration until complete (by a timer), it does the following. For each member in the population (populationSize times).

  • Randomly mutate zero or more verticies by pushing them a random small distance in a random direction. Some extra trigonometry logic is included to prevent the quads from pushing out of bounds of their neighbors. Impacted by the positionMutationRate parameter.

  • Randomly mutate the color of zero or more of the quads. This is accomplished by randomly offsetting the RGB values. Impacted by the colorMutationRate.

  • If a current split threshold has been reached, split each quad perfectly into 4 sub-quads (with the same colors).

The mutation with the lowest loss in the population is selected as the basis for the population in the next round.

machinelearning's People

Contributors

ryanalameddine avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.