So you want to build an artificial intelligence. Maybe you want to automate a repetitive task. Maybe you want to enslave-slash-destroy humanity. Either way, here’s a quick, easy guide to offloading all your thinking from your fallible, squishy brain to your unstoppable silicon automaton.
1. Give it a goalHowever the automation algorithm works, you need to define a phase space for the machine and its task. This is something like ‘all possible images’ or ‘all legal chess moves’. Within that phase space, you then need to give it an objective. This could be something like ‘identify cats in this image,’ ‘win at chess,’ or ‘kill all humans.’ The more clearly you define the end state, the easier it is to nudge the AI to it.
2. Define a score functionIn order to navigate the phase space on the way to the correct answer, you need to have a way for your AI to distinguish good answers from bad ones – it needs to be able to navigate the phase space by assigning ‘scores’ to different locations in the phase space and comparing them.
Modern chess-playing computers are much better than ones from 20 years ago not just due to increased processing power. They’re also better because of more sophisticated score function algorithms: the modern ones are much better at assessing their current position on the board, and evaluating move options based on how the move improves their position (its score). It’s not enough to tell the AI to ‘checkmate the opponent’ because for most of a chess game that’s not your goal – your goal is to secure positions on the board and win pieces, and you need to program your AI to understand that.
3. Give it a way to evolve
Machine learning works by assigning scores to various states the bot can be in, and then giving it a way to update its score to inch closer to its goal. One example is a genetic algorithm, inspired by biological evolution. You start with a ‘population’ of algorithm variants, you assign them scores, you let them ‘mutate’ by randomly changing the algorithms a bit, then if the mutants’ scores are better, you update the population with the mutants.
Another example is a neural network, like the new champion crushing chess AI AlphaGo Zero. Here you create a network of ‘neurons’, and let them ‘light up’ in varying amounts corresponding to certain stimuli – this is the score function. They ‘evolve’ as the connections between the neurons change (they ‘re-wire’) as the network tries to improve its score function. With enough neurons and iterations these networks can behave in complex, smart ways even their creators can’t predict.
4. Throw processing power at itEven if you optimise your algorithm to need as few iterations as possible to achieve its goal, it never hurts to get some time on a supercomputer. AlphaGo wouldn’t have been able to master chess in a matter of hours without Google’s fancy new hardware with unparalleled speed. Likewise, you’ll need a lot of RAM to hack the Pentagon’s nuke codes!
5. Have fun!
As this is just the bare-bones introduction, I hope I’ve piqued your interest enough to learn this all in more detail. It’s a hot topic right now, so there’s a plethora of options for self-teaching the nitty-gritty of it all. Just remember to show me mercy when your unstoppable swarm intelligence AI ends our feeble human civilisation.
More from Chalkdust
On the cover: Hydrogen orbitalsFind out more about the weird shapes on the cover of Issue 08
Integration: It’s more than the sum of its partsDefining what exactly an integral is leads naturally to an explanation of how to handle approximating them.
Game, set, maths (no more tennis puns)No more Katie Steckles.
Thinking outside outside the boxRob Eastaway joins the dots.
Baking a Menger sponge spongeSam Hartburn bakes your favourite fractal
e to thee xZoe Griffiths on the life of e