Algorithms

What they are & why they matter

An algorithm is a list of step-by-step instructions designed to accomplish a specific task or solve a specific problem. When you think about it this way, algorithms are pervasive. A French onion soup recipe, for example, is an algorithm. Combine these inputs to generate an output. Algorithms basically work the same way with computers. Whether they’re converting binary numbers into letters so you can read what’s on your tablet screen or recommending stocks based on your risk tolerance, algorithms are fundamental in modern computing. This page will focus on computer algorithms.

A brief history of algorithms

Algorithms may feel like a new invention, but the term actually dates back a millennium to when Persian mathematician Muḥammad ibn Mūsā al-Khwārizmī (Latinized as “Algoritmi”) made significant contributions in mathematics. The concept was further embraced in the 1800s when German mathematician Carl Friedrich Gauss invented a simple algorithm to determine which day of the calendar year Easter falls on.

Algorithms made their computing debut in the mid-20th century, when famed British computer scientist Alan Turing devised a theory for how machines could execute a complex set of instructions. Although his crude chess-playing algorithm “Turochamp” never beat a human during Turing’s lifetime, it formed the basis for what we know today as artificial intelligence.

As the power of computing accelerated over subsequent decades, so too did the need for more complex algorithms. Today, algorithms are fundamental to modern computing, helping us drive from A to B, decide the next movie to watch or even fall in love.

Many computer programs are fundamentally a sequence of algorithms written in a way the computer can understand.

Manufacturing

Predictive analytics and AI deliver a winning customer experience

The Orlando Magic uses mobile app data and machine learning algorithms to personalize the fan experience and achieve a fourfold jump in app purchases.

Algorithms in today’s world

As algorithms replace more and more human decisions across society, some have the potential to change lives. For this reason, some argue that we should further explore fairness in algorithms, particularly in criminal justice and health care.

Curious who’s developing the algorithms that are transforming society before your very eyes? This Harvard Business Review white paper focuses on the human faces behind the computational and automation advancements that are pushing the world forward.

Algorithms can even help save the rainforest. By searching millions of images each day for early signs of deforestation, computer vision algorithms can help government policymakers and aid organizations intervene to protect endangered forests before it's too late.

The Netflix algorithm

When you watch Netflix, algorithms watch you. The Netflix Recommendation Engine, as it’s called, consists of sophisticated proprietary algorithms that take into account what the company knows about you to predict the likelihood that you will watch a certain title in its catalog. Today, 80% of Netflix screen time is achieved through personalization. Algorithm inputs include your viewing history, favorite genres and the time of day you watch. The more you watch Netflix, the more accurate the algorithms become, which encourages you to watch more Netflix, and so on. 

How algorithms work

Algorithms must have five properties in order to work:

  1. Inputs: Well-defined data that will be transformed during the computation. 
  2. Outputs: Data resulting from the computation. 

  3. Definiteness: Specific computational steps. 
  4. Effectiveness: Doable computational steps. 
  5. Finiteness: A finite number of steps.

That leads us to math-based and rule-based algorithms.

Math-based algorithms
Because most algorithms are numerical in nature, it’s no surprise that many are math based. Take the simplest example: 1 + 1 = 2. This is a math-based algorithm where the ones are the inputs and two is the output. Extrapolate this example and you get some of the most important algorithms used today, including algorithms that break down signals into frequencies, code computers and even determine the Google search ranking of a website.

Rule-based algorithms
As humans learn more about AI, we see that some things cannot be purely explained by math constructs. If you’re developing text analytics software, for example, and you need an algorithm to pluralize a noun, you can’t just add an “S” to each noun. Think of exceptions like matrix and matrices. We have rules for those special occasions. Rule-based algorithms are best for analyzing data containing a mix of numerical and qualitative attributes.

Of course, you can use more than one type of algorithm to solve a given problem – for example, predicting someone’s income. To perform this computation, you could use a math-based algorithm whereby you weight variables such as age, location, education, etc. You could also use a rule-based algorithm that predicts income by age and ZIP code, for example. So which is best?

That brings us to competing algorithms. Algorithms are often pitted against one another to see which is most effective. Getting back to our soup example, you can have competing recipes which all result in French onion soup. The same is true with computer algorithms. Maybe algorithm A is slower but more accurate than algorithm B. Yet B is easier to validate. The right algorithm for a given task comes down to the various criteria you use to judge it. Did it accomplish the task? Did it accomplish the task rapidly? Did it accomplish the effeciently?

Inspired by nature

Most AI projects today rely on multiple data science technologies. According to Gartner, using a combination of different AI techniques to achieve the best result is called composite AI.

Algorithms can be thought of as a shortcut to human thinking. As such, they’re often inspired by elements of nature. Genetic algorithms, for example, copy the biology of how organisms evolve over time. These algorithms will breed combination decision points together to create offspring with their parents’ traits. Likewise, neural networks are inspired by the biological brain and are used to solve certain different problems like computer vision and natural language processing.

Popular types of algorithms

Algorithms can reasonably be placed into basic and advanced categories.

Basic
You might not realize it, but algorithms power even the most basic computer functions. Here’s a look at three basic algorithms widely used today.

Compression algorithms
When most people use a computer, they’re doing something basic, like reading an article or viewing images. This is thanks to algorithms that compress files so they can be viewed, shared and restored. Think of a JPG file. When you’re viewing a picture of your nephew’s new treehouse, you’re actually looking at a bitmap image that’s been run through a lossy compression algorithm to convert millions of numeric representations of pixels into the smile-inducing image on your screen. 

Binary search algorithm
Binary search is a fast search algorithm that works on the basis of divide and conquer. Say you’re searching your laptop for 2020taxreturns.PDF. With a binary search, the algorithm picks an observation in the middle of the data set and checks to see if the subject_id found is the desired subject_id. If it is, the algorithm stops. If not, since the table is sorted, the algorithm can determine if the desired observation is above or below the one found and redefine the search range to be half of the original file. The algorithm then picks the observation in the middle of the new search range, and the process repeats until the PDF is found. Yep, you in fact underpaid state taxes last year. 

Multiplication algorithm
Algorithms get even simpler than above. In fact, one of the most popular algorithms is one that multiplies numbers. Almost anything you do with an algorithm requires two or more numbers to be multiplied. Even with a word-based field like text analytics, you’re evaluating things like word frequencies and document frequencies, and there’s often a multiplier in there. 

Advanced
On the opposite end of the spectrum are advanced algorithms. These build upon basic algorithms with new ideas. And they often involve processing huge data sets.

Machine learning algorithms
Machine learning uses algorithms that receive and analyze input data to predict output values within an acceptable range. What’s cool about these algorithms is they learn from other algorithms. As new data is fed to machine learning algorithms, they learn and optimize their operations to improve performance, developing intelligence over time. There are four types of machine learning algorithms: supervised, semisupervised, unsupervised and reinforcement.

Deep learning algorithms
Deep learning algorithms use multiple layers to progressively extract higher-level features from the input data. Emulating the human brain, these algorithms attempt to draw similar conclusions as humans by continually analyzing data using things called artificial neural networks. The output of these complex algorithms can be life changing, such as enabling self-driving cars or translating books from English to Arabic in the blink of an eye.

Gradient boosting algorithms
Predictive models help businesses do things like forecast sales and price merchandise based on expected demand. Gradient boosting is a powerful algorithm for building these predictive models. It works by boosting weak decision trees into strong decision trees, thereby improving the accuracy of a prediction. The algorithm is known for its speed and accuracy, especially with large and complex data sets. 

Which algorithm should you use?

Beginners typically want to know which algorithm to use. The answer depends on many factors, including:

  • The size, quality and nature of data. 
  • The available computational time. 
  • The urgency of the task. 
  • What you want to do with the data.

Even an experienced data scientist can’t tell which algorithm will perform best before trying different algorithms. When choosing an algorithm, it’s smart to take these aspects into account: accuracy, training time and ease of use. Many users put the accuracy first, while beginners tend to focus on algorithms they know best. When presented with a dataset, the first thing to consider is how to obtain results, no matter what those results might look like. Once you obtain results and become familiar with the data, you might choose to spend more time using more advanced algorithms to strengthen your understanding of the data, hence further improving the results. Learn more about selecting algorithms.

Next Steps

If you want to learn about Algorithms , SAS is the place to do it.

Only a decade ago, working with algorithms required an advanced degree and an encyclopedic understanding of mathematics and computer science. Today, the world’s most sophisticated algorithms are neatly rolled up into software so that even power users can deliver breakthrough work without having to tinker with formulas.  

One such solution is SAS® Visual Data Mining and Machine Learning. Within this product exist some of the most advanced algorithms on earth, allowing users of all backgrounds to solve complex analytical problems. The highly rated software offers an abundance of algorithms to help you do things like build predictive models and identify profitable business opportunities.

Conéctese con SAS y vea lo que podemos hacer por usted.

  翻译: