Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Halfrost Field | 11,971 | 2 months ago | 6 | cc-by-sa-4.0 | Go | |||||
✍🏻 这里是写博客的地方 —— Halfrost-Field 冰霜之地 | ||||||||||
Tbox | 4,380 | 6 hours ago | 26 | apache-2.0 | C | |||||
🎁 A glib-like multi-platform c library | ||||||||||
Ready For Tech Interview | 3,560 | a month ago | 3 | mit | ||||||
💻 신입 개발자로서 준비를 하기 위해 지식을 정리하는 공간 👨💻 | ||||||||||
Transfer Learning Library | 2,559 | 11 days ago | 2 | July 24, 2020 | 10 | mit | Python | |||
Transfer Learning Library for Domain Adaptation, Task Adaptation, and Domain Generalization | ||||||||||
Machine Learning With Ruby | 1,941 | 2 days ago | 6 | cc0-1.0 | Ruby | |||||
Curated list: Resources for machine learning in Ruby | ||||||||||
Machine Learning Flappy Bird | 1,443 | 5 years ago | 6 | mit | JavaScript | |||||
Machine Learning for Flappy Bird using Neural Network and Genetic Algorithm | ||||||||||
Neuralnetworks | 1,224 | 6 years ago | 18 | Java | ||||||
java deep learning algorithms and deep neural networks with gpu acceleration | ||||||||||
Pyclustering | 853 | 18 | 10 | 2 years ago | 46 | November 25, 2020 | 53 | bsd-3-clause | Python | |
pyclustring is a Python, C++ data mining library. | ||||||||||
Vega | 790 | 4 months ago | 15 | June 02, 2022 | 43 | other | Python | |||
AutoML tools chain | ||||||||||
Tutorial | 769 | a year ago | 2 | apache-2.0 | ||||||
Deeplearning Algorithms Tutorial |
Here is the source code for a HTML5 project that implements a machine learning algorithm in the Flappy Bird video game using neural networks and a genetic algorithm. The program teaches a little bird how to flap optimally in order to fly safely through barriers as long as possible.
The complete tutorial with much more details and demo you can find here:
http://www.askforgametask.com/tutorial/machine-learning-algorithm-flappy-bird
Here you can also watch a short video with a simple presentation of the algorithm:
https://www.youtube.com/watch?v=aeWmdojEJf0
All code is written in HTML5 using Phaser framework and Synaptic Neural Network library for neural network implementation.
To play the game, each unit (bird) has its own neural network consisted of the next 3 layers:
an input layer with 2 neurons presenting what a bird sees:
1) horizontal distance between the bird and the closest gap
2) height difference between the bird and the closest gap
a hidden layer with 6 neurons
an output layer with 1 neuron used to provide an action as follows:
if output > 0.5 then flap else do nothing
There is used Synaptic Neural Network library to implement entire artificial neural network instead of making a new one from the scratch.
The main concept of machine learning implemented in this program is based on the neuro-evolution form. It uses evolutionary algorithms such as a genetic algorithm to train artificial neural networks. Here are the main steps:
create a new population of 10 units (birds) with a random neural network
let all units play the game simultaneously by using their own neural networks
for each unit calculate its fitness function to measure its quality as:
fitness = total travelled distance - distance to the closest gap
when all units are killed, evaluate the current population to the next one using genetic algorithm operators (selection, crossover and mutation) as follows:
1. sort the units of the current population in decreasing order by their fitness ranking
2. select the top 4 units and mark them as the winners of the current population
3. the 4 winners are directly passed on to the next population
4. to fill the rest of the next population, create 6 offsprings as follows:
- 1 offspring is made by a crossover of two best winners
- 3 offsprings are made by a crossover of two random winners
- 2 offsprings are direct copy of two random winners
5. to add some variations, apply random mutations on each offspring.
go back to the step 2
Since the program is written in HTML5 using Phaser framework and Synaptic Neural Network library you need these files:
The entire game logic is implemented in gameplay.js file. It consists of the following classes:
App.Main
, the main routine with the following essential functions:
TreeGroup Class
, extended Phaser Group class to represent a moving barrier. This group contains a top and a bottom Tree sprite.
Tree Class
, extended Phaser Sprite class to represent a Tree sprite.
Bird Class
, extended Phaser Sprite class to represent a Bird sprite.
Text Class
, extended Phaser BitmapText class used for drawing text.
The genetic algorithm is implemented in genetic.js file which consists of the following class:
GeneticAlgorithm Class
, the main class to handle all genetic algorithm operations. It needs two parameters: max_units to set a total number of units in population and top_units to set a number of top units (winners) used for evolving population. Here are its essential functions: