Connect with us


What is an algorithm?



Mashable’s series Algorithms explores the mysterious lines of code that increasingly control our lives — and our futures.

“The Algorithm” is impenetrable. It’s mysterious, it’s all-knowing, it’s omnipotent. Except that it’s not. 

An algorithm is a simple concept that, today, has many complex manifestations. Algorithms’ central and opaque position at the heart of social networks cause some to view algorithms in general with a sort of mystical reverence. Algorithms have become synonymous with something highly technical and difficult to understand, that is either an arbiter of objective truth, or, on the other end of the spectrum, something wholly untrustworthy.

But when people refer to “the algorithm” — whether Facebook’s or another tech company’s recommendation algorithm, or just “algorithms” in general — do they really know what it means? Judging by the term is used and misused, most likely not. As Mashable embarks on our exploration of algorithms, we wanted to get something straight right off the bat: What is an algorithm, anyway?

Mashable spoke with Pedro Domingos, a computer science professor at the University of Washington who has also written about the ever-growing role algorithms play in our lives. Before you go being alternatively impressed by or distrusting of the next computer algorithm you encounter, get back to basics on the concept that’s powering our world. 

1. An algorithm is a set of very specific instructions

How to bake a cake, find the sum of two plus two, or even run a country according to the U.S. Constitution are all examples of algorithms. Why? Because, according to Domingos, the definition of an algorithm is “a sequence of instructions.” That’s it! 

Today, an algorithm usually refers to “a sequence of instructions that tells a computer what to do.” A computer program is an algorithm, written in a computer programming language, that a computer can understand and execute. 

Algorithms written for computers also have to be extremely precise, often using the instructions “if,” “then,” and “else.” For example, a self-driving car might run on an algorithm for navigating that says “IF the directions say turn left, THEN turn left.” See how specific you have to be to make a computer follow a seemingly simple set of instructions?

In the popular imagination, have come to dominate our idea of what an algorithm is. That is, when many people think about or refer to algorithms, they’re referencing something like what TV show Netflix thinks you might like, or which international travelers . While these are extremely complicated algorithms, at their hearts, they’re still just a set of instructions a computer follows to complete a specified task. 

“With computers, the algorithm can get vastly more complex,” Domingos said. “Addition is an algorithm that’s defined in a few lines of text. Computers can have algorithms that take millions of lines to define.”

2. People wrote and used algorithms long before computers even existed

As early as the Babylonian era, humans were writing algorithms to help them do the mathematical equations that allowed them to manage their agricultural society. 

“There were algorithms before computers, because you don’t need a computer to execute an algorithm, the algorithm can be executed by a person,” Domingos said.

Algorithms using computers first rose to prominence in the mid-20th century, when the military began writing formulas for, say, determining where to aim a missile at a moving object. The concept then moved into business administration, with computers running formulas for administering payroll and such, and in science, for tracking the movements in the sky. 

A turning point for modern algorithms came when Larry Page and Sergei Brin wrote the . Instead of just relying on information within a page to determine how relevant it was to a search term, the search engine algorithm incorporated a host of other signals that would help it surface the best results. Most notably, how many other links pointed to the article, and how reputable those articles were, based on how many links pointed to those pages, and so on. That was a powerful sign of relevance. And the rest is history. 

3. Today, you can find algorithms everywhere

While we might think of algorithms as mathematical equations, algorithms, according to Domingos, “can compute anything from anything, there might be no numbers involved at all.” One prominent and extremely complex algorithm is the algorithm that governs the . It’s an equation that Facebook uses to determine what pieces of content to show its users as they scroll; in other words, a set of instructions to decide what goes on the News Feed.

“There’s no end of things that Facebook could put on your News Feed but it has to choose.”

“There’s no end of things that Facebook could put on your News Feed but it has to choose,” Domingos said. “And it’s usually a combination of things like how much do you care about the people that produced directly or indirectly that post? How close are they to you in your social network, how relevant it is in its own terms because of the subject, and also how recent.”

Facebook, Google, Amazon, and other big tech companies all rely on algorithms to serve content and products to their customers. But there are also algorithms throughout your life that you might not be aware of. 

For example, Domingos explained that an algorithm governs how your dishwasher knows when it’s time to transition from washing to drying, or how your car regulates fuel intake and knows when its tank is full while at the gas station, or how shadows appear in a digitally animated movie to perfectly replicate the sun in the real world.

“Clearly, every time you interact with the computer, or you’re on the internet, there’s algorithms involved,” Domingos said. “But these days algorithms are also involved in just about everything.”

4. The most complex algorithms use machine learning

As we learned, an algorithm typically has to be written in “excruciating detail” for a computer to understand what to do. However, that’s not the case when the people who write algorithms incorporate machine learning — a type of artificial intelligence — which leads to the most sophisticated algorithms.

“In traditional programming, a human being has to write down every little detail of what the other has to do, and that is very time consuming, very costly,” Domingos said. “Machine learning is the computer discovering its own algorithms instead of being told what to do.”

Put another way, machine learning is when a programmer feeds a program some raw data as a starting point, then submits the end point of what an organized, classified version of that data looks like, and leaves it up to the program to figure out how to get from point A to point B. Consider an onion: A human who knows how to cook can turn that onion from a pungent raw sphere into strips of caramelized goodness. In a traditional algorithm, a programmer would write every single step of the cooking instructions. But in an algorithm developed by artificial intelligence, given the end point as a goal, the program would figure out how to get from raw to caramelized itself. Hence, the machine learned. 

These types of algorithms become even more powerful when a human being wouldn’t know how to get from point A to point B. For example, a human process like being able to recognize that a cat is a cat takes so much complicated brain power that it would be impossible to write out step by step. But by giving a program a bunch of images of a cat, and images that are not a cat, and showing the desired endpoint as categorizing a cat image as a cat, the computer can learn to execute that process itself.

“It’s the computer learning to program itself instead of having to be programmed by people.”

“It’s the computer learning to program itself instead of having to be programmed by people,” Domingos said. “This, of course, is extraordinarily powerful when it works, because now you can, you know, create very powerful, very complex algorithms with very little human intervention.” It’s also very funny when it doesn’t work.

5. Despite the term’s recent cache, algorithms aren’t magic

Thanks to the sheer amount of data algorithms process, it might seem like they’re all-knowing mystery boxes built to reveal secrets. However, remember that an algorithm just means a set of instructions. What’s more, humans create algorithms, which means they can be flawed.

“There’s also a lot of misconceptions about algorithms, partly because people don’t really see what’s going on inside the computer,” Domingos said. “A very common one is that people think that algorithms are somehow perfect.”

Domingos explained that programmers spend enormous amounts of time fixing mistakes in algorithms so that the lines of code produce the appropriate results. However, humans don’t always catch those mistakes. What’s more, an algorithm is based around the output a human wants to see, or what that human is optimizing for. Take a hiring algorithm, which ostensibly should find the best candidate for a job. If a human sets the instructions to look at qualifications that aren’t necessarily relevant to a job (say, university pedigree), just because the algorithm then says “candidate A is the best person,” doesn’t make it the truth.

Often, that’s because of bias. And problems with bias can get even worse with algorithms that utilize artificial intelligence.

“In traditional programming you have to worry about the biases of the programmer,” Domingos said. “In machine learning, mainly, you have to worry about the biases that come from the data.”

For example, a hiring algorithm powered by machine learning might use as its starting point a bunch of resumes of candidates, and as its output the resumes of people who were hired in the past. However, most tech companies are not racially diverse. So an automated algorithm that makes hiring recommendations could mirror that real world inequality.

Studies that artificial intelligence can mirror the gender and race stereotypes of the humans that train them. In one study, an algorithm that produced word associations used the entirety of the English language on the web as its training data to learn associations between words. Thanks to the biases that exist in our world, the algorithm determined that female names were more associated with the arts, while male names were more associated with math and science. Studies like these show that algorithms are not inherently neutral, perfect, or malevolent: They simply do what the humans and data that train them say to do. In short, they’re just as flawed as we are.

6. Algorithms are ushering in a technological revolution

Algorithms may be imperfect, but they are nonetheless transforming our world. 

“All these things that we take for granted like the web and social media, and on and on, they wouldn’t exist without algorithms,” Domingos said.

“Algorithms are doing for mental work what the Industrial Revolution did for manual work.” 

As these automated sets of instructions become more and more widespread — from your dishwasher to the government’s supercomputers — humans have the ability to exercise our knowledge more quickly and efficiently than ever before. Domingos views that as nothing short of revolutionary.

“Algorithms are doing for mental work what the Industrial Revolution did for manual work,” Domingos said. “Algorithms are the automation of intelligence. And if you think about that, this is a very powerful thing: to do something that used to take, you know, human thinking and labor to do, now can be done by an algorithm.”

Algorithms are here to stay. But how we design them — biased or equitable, helpful or harmful — and how much we unquestionably accept their presence, is up to us.

Continue Reading
Advertisement Find your dream job