What is an Algorithm?
Algorithm. The word alone has a mysticism, musicality, an allure.
For people working in the social media sphere, the word can invoke fear or excitement. Some creators exclaim “the YouTube algorithm has put me on the main page” while others lament “I don’t understand why the algorithm isn’t promoting my posts anymore”. The seemingly mysterious workings of the algorithms that surround us in everyday life can be awe-inspiring or even intimidating but for people, like me, who have heard the word ‘algorithm’ so many times we feel we surely understand what the word means, but don’t; this post is for you.
So what is an algorithm? Examples in our everyday lives are locating a book in a library, organising our documents by date or alphabetically, following the steps to tie our shoelaces and many more. The most helpful example to understand what an algorithm is may be following a step-by-step recipe.
But how is an algorithm like a recipe? Well, an algorithm is essentially an exact list of instructions and has ‘ingredients’ in the form of inputs. Algorithms are used to solve a problem, and just like following your lasagne recipe will resolve your hangry outbursts, implementing an algorithm will automate and perform step-by-step tasks and when the computation is executed, produce an output (or lasagne).
But how do they work? Are all algorithms the same? Simply put, algorithms are not ‘one-size-fits-all’ and they are designed with a particular task in mind. For example, a ‘search engine algorithm’ takes strings of keywords and parameters as input and searches its associated databases for relevant webpages and returns results. Additional settings or hyperparameters are applied to algorithms (nowadays algorithms can even extract semantic meaning from text to apply genres) to optimize output. A ‘sorting’ algorithm will rearrange data structures. There are encryption algorithms and algorithms to generate ‘random numbers’. ‘Brute-force’ algorithms will iterate all possible solutions to your problem through exhaustion, like that one friend (me) who goes through all of your options before coming to the ‘perfect’ decision. This particular type of algorithm is simple and very consistent but also very slow. Your choice of algorithm will depend on your business problem but also your available time, capital, computing power and the data you are inputting.
So no, not all algorithms are created equally, and not all are supervised! Machine learning refers to the branch of AI that endeavors to mimic the human brain. It involves the training of computer systems to learn and adapt (without following explicit instructions) by using algorithms and statistical models to analyze patterns in data. The success of your Machine Learning model will actually depend on the quality of your data and the testing performed to optimize it. This testing of models and algorithms can be performed while supervised by a human person, who can control the inputs of the data and set the ‘target’ for the output or this can be completely unsupervised where the computer system will is given unlabeled date and allowed to discover patterns and insight without instruction or guidance. There is a middle ground of ‘semi-supervised’ learning and finally reinforcement learning, which I liken to ‘good dog, bad dog’ training in a painfully unscientific way of explaining things. Essentially the computer system is ‘punished’ or ‘rewarded’ based on its output and learns through trial and error.
Recommendation algorithms suggest or recommend products to us consumers. Sometimes this algorithm (especially when you are a new user) only has your gender, age, location to go off of and will give you some very uncharacteristic recommendations. Collaborative filtering algorithms will recommend items to consumers based on what similar users bought. You can see this in action on Amazon with their ‘other people who bought this item also bought’ and sometimes you may wonder if you have a long lost twin out there but it is really an algorithm in action grouping you with other account users of similar taste across the world. Netflix recommendations are an algorithm.
By no means is this an extensive explanation of algorithms, more of an introduction to those coming from a similar non-scientific or mathematic background. Machine Learning based disease diagnosis and algorithms are already helping professionals in the medical field to diagnose patients quicker, fingerprinting algorithms aid detectives in solving crimes not to mention DNA algorithms that bring long lost family members together. Algorithms and algorithmic thinking is all around us and while it is seemingly such a vast term an algorithm is basically a procedure for solving a problem, taking input and then following an exact list of instructions to produce an output. Or a lasagne.
I hope this was helpful to someone out there and if you have any feedback, correction or suggestions please comment below.
Ádh mór - Megan 👾