How AI Works: Genetic Algorithms Part 1

in ai •  5 years ago  (edited)

How Artificial Intelligence Works

Part 1: Genetic Algorithms


Darwinia
Hi Steemit. So as I've said before, I'm really big into programming. While I was thinking of topics to write about for today, I remembered how much I struggled with learning about artificial intelligence, neural networks, fitness functions, and how all of it worked. So I decided to myself that I should make a simple tutorial on AI.

Quick Warning: I'm by no means an expert, all my info comes from MIT Open Course ware Lectures, my own brain, and random stuff I've read on the internet.

Evolution

So if you took Biology in high school, you're probably aware of evolution. It's based on three principles:

  • Organisms have different traits
  • Some traits do better than others in certain environments
  • Traits pass down from generation to generation
  • (Traits have a slight chance of mutation)

By themselves, or when one of these are missing, evolution simply can't happen. For example, even if organisms have different traits, and those traits pass down genetically, if all the traits are the same then no evolution can take place. Try it yourself, take out any part of those three aspects and nothing will change.

Now you may have noticed that despite me saying there's three aspects to evolution, theres a 4th bullet point that addresses mutation. Mutation isn't strictly necessary for evolution to occur, but without it then the neural network is limited by how much it grows. For example, monkeys who mated together, without mutation, would have never formed humans without mutation, since it's mutation that brought large brains, less fur, and bipedal movement.

Applying evolution to computers

Now let's say you want an AI that's really good at playing a game, say, Mario. You could start by making 1,000 versions of Mario, with different brains and algorithms generated randomly (this will be explained further in Part 2). You have all of the algorithms play the game, and see which one does the best (gets the farthest in the farthest amount of time). The ones that do the best are allowed to 'reproduce" (have their algorithms mix with those who did the best, while the worst are discarded. The second generation begins, with some being randomly generated, some being slightly mutated offspring, and some being the original, and the cycle continues for as long as necessary, hundreds or even thousands of generations, until an algorithm appears that is very, very good at what it does.

Normally, evolution would take hundreds of thousands of years for even slight improvements. However, computer generations can be as fast as the computer can allow, allowing for hundreds of thousands of generations in a few hours.

Now this is a pretty simplified version of how this works. You probably have several questions, like, how does the AI know what the goal is? I've heard of supervised and unsupervised learning, what are those? How do AI think? All of these questions and more will be answered in later posts.

Thanks for reading this, if you have any questions, suggestions, or criticisms, please feel free to let me know.

Sources:
https://en.wikipedia.org/wiki/Genetic_algorithmv
https://www.mathworks.com/help/gads/what-is-the-genetic-algorithm.html
All of CodeBullet's videos

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  


This post has been voted on by the SteemSTEM curation team and voting trail. It is elligible for support from @curie and @minnowbooster.

If you appreciate the work we are doing, then consider supporting our witness @stem.witness. Additional witness support to the curie witness would be appreciated as well.

For additional information please join us on the SteemSTEM discord and to get to know the rest of the community!

Please consider using the steemstem.io app and/or including @steemstem in the list of beneficiaries of this post. This could yield a stronger support from SteemSTEM.

ESTM Boosting refund to @bootlegbilly!
Due to one of these reasons:
1. Not posted from eSteem apps.
2. Already curated by eSteem team.
3. Need bit more improvement on quality of post.
4. Might be too old post.
5. User already received vote in last couple hours, you can try boosting again afterwhile.
Android, iOS, Windows, Mac, Linux
Learn more: https://esteem.app
Join our discord: https://discord.me/esteem

Congratulations @bootlegbilly! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 10 comments. Your next target is to reach 50 comments.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!