Change Location Europe - Flag EUR
Mouser Europe - Flag Mouser Europe

Incoterms: DDP is available to customers in EU Member States.
All prices include duty and customs fees on select shipping methods.

Incoterms: DDU applies to most non-EU customers.
Duty, customs fees and taxes are collected at time of delivery.

Please confirm your currency selection:

Euros are accepted for payment only in EU member states these countries.

US Dollars
USD is accepted in all countries.

Other currency options may also be available - see
Mouser Worldwide.

Bench Talk for Design Engineers

Bench Talk


Bench Talk for Design Engineers | The Official Blog of Mouser Electronics

Programming Decoded: AI vs. Algorithms vs. ML Stephen Cassar

(Source: SeaRick1/

The words artificial intelligence (AI), machine learning (ML), and algorithm are too often misused, confused and misunderstood. They’re used interchangeably even though they have fixed meanings. Unfortunately, these meanings, if not grasped, can add layers of confusion in a rapidly evolving area that is already complex enough.  Here’s a look at algorithms, artificial intelligence, and machine-learning basics, what they are, how and where they are used, and why each was created. We will start with algorithms since they form the foundation for AI and ML.


Simply put, an algorithm is a set of rules to be followed when performing calculations or solving a specific problem and contains a sequence of steps in order to arrive at a solution. While most of us relate algorithms to instructions given to a computer, they can also represent a simple recipe you may use for your dinner tonight.

Algorithms work by acting as shortcuts that tell a computer what to do next, giving these instructions by using “and,” “or,” or “not,” statements. They can be extremely simple (Figure 1), or outrageously complex.

Figure 1. A simple algorithm for finding the largest number in a randomly ordered list of numbers. (Source: Wikipedia)

In Figure 1, the high-level description for the algorithm is:

  1. If there are no numbers in the set, then there is no highest number.
  2. Assume the first number in the set is the largest number in the set.
  3. For each remaining number in the set: if this number is larger than the current largest number, consider this number to be the largest number in the set.
  4. When there are no numbers left in the set to iterate over, consider the current largest number to be the largest number of the set.

The instructions can be explicitly programmed, however, other algorithms allow computers to learn on their own, as with machine learning. Before discussing ML, let’s cover the broader subject of Artificial Intelligence.

Artificial Intelligence

Artificial Intelligence (AI) combines sets of algorithms to handle unforeseen circumstances. AI is an umbrella and machine learning and deep learning (DL) are subsets. AI systems interact with users in a natural way. Amazon, Google, and Apple are at the forefront of harnessing AI and the unstructured data at its heart.

In 2018, there was a big push towards human parity for reading comprehension. Developers leveraged supervised learning and labeled examples to train AI models to perform such specific concrete target tasks as image classification. One year later, a new AI trend emerged. Self-supervised learning was used to help models form an understanding of the rich contextual semantics of language through readily available relevant content. One way this breakthrough approach helps models learn is by reading text, masking different words, and predicting them based on the remaining text.

Leveraging this self-supervised-learning, Microsoft’s Turing model reached a new high-water mark of 17 billion parameters in 2020, enabling a variety of practical language modeling tasks including summarization, contextual prediction and question answering. The Microsoft Turing model’s deep foundational grasp of human language enables it to derive the intended meaning and accurately respond to real-time conversations, and questions from a document.

As AI systems learn, accuracy improves. Expectations are that the number of parameters will be into the trillions within a few years making it easier for AI to assist users and deliver incredible accuracy not found with structured data alone. How does this learning leading to unprecedented accuracy take place?

Machine Learning

Machine learning uses structured data input and algorithms to make assumptions, reevaluate the data, and reconfigure the original algorithms based on newly discovered conditions (Figure 2). It does this without human intervention, hence the term machine learning. Because a ML system processes a lot of data very quickly, it has the advantage of discovering all possible patterns and solutions at a speed and capability no human could attain.

Complex systems present complex challenges, however. Because ML relies so heavily on assumptions, systems can quickly go down the wrong path, leading to unexpected behavior and results. One example is Uber’s self-driving pilot program failure in 2018 after incorrect assumptions resulted in a pedestrian being killed.

Figure 2. Machine learning involves computer algorithms that automatically improve based on experience. The algorithms build a model based on sample or training data, with the goal of making predictions (learning). (Source: Wikipedia)

ML examples abound. Take, for instance, credit card fraud detection. Should credit card usage fall outside a predicted pattern for that card holder, the user is asked to verify the legitimacy of suspect transactions. The ML system then further adapts and modifies its understanding of acceptable usage patterns.   

Machine-learning can have a range of outcomes that can all be correct, but many of the outcomes might not be predictable at the outset. There are also many reasons that an ML project falls short on accuracy.

What Could Go Wrong?

One reason that most artificial intelligence experiments fail is that they lack early-stage guidance so they can learn inference. Machines deal in zeroes and ones. Ambiguity does not work. For example, consider the concept of pain. A child needs a coach to tell her “If you touch the stove it will hurt and that’s bad.” Or, along the same lines, “if you are going to run, you will likely be sore. You will hurt, and that’s good.” Inference helps a ML system tell the difference between positive and negative results. As seen with the Uber example, this becomes even more important in deep learning because without feedback from a type of coach, the system may make the wrong assumption. Until sufficient learning occurs, the machine must be guided through ambiguous results. If a question can be answered as “maybe” instead of “yes” or “no” more questions must be asked!

Another challenge is that, if there was endless time and unlimited funds, routines would be built with every possible combination and condition, and not stop there. It would be reasonable to think about ways that the conditions and combinations may change in the future. It is common to make a routine too rigid, resulting in an inflexible data stream.

Inference is everything in learning. As an engine gets smarter, correction becomes possible. A seemingly clear entry of half-and-half on a grocery list, if not corrected by a user, will show up twice as “half”. However, if the user corrects the entry, the engine will consider the correction, and possibly the same correction from 10,000 others, and the default will be to accept half-and-half as a valid item. It’s like teaching a child how to speak English. Understanding the meaning of a word and then understanding that when you put one word with another word, amid these conditions, the meaning may change.

All of the rules and regulations must exist for the algorithm to work properly. The algorithm has no common sense and no idea of things that are obviously wrong—the program simply does not understand it. An algorithm needs to be perfect with very specific and clear action plans to work. And therein lies the rub.

In summary, when you look at the nature of these very words, it’s clear they should not be used interchangeably. Instead, it’s best to view in the following way: an algorithm is the formula or instructions for solving a problem, AI uses data and algorithms to ignite action and complete tasks. Machine learning, on the other hand, is an application of AI, synonymous with automatic learning based on previous data and history. While algorithms are the foundation for AI and ML, the latter are the foundation for our future.

« Back

Stephen is often invited to advise Fortune 100 companies in overall Product Strategies and Architecture Design especially as it pertains to Workflow Management, eCommerce, Artificial Intelligence and Machine Learning, bringing with him an objective view of current processes and recommending small shifts in strategy that yield big long term results and immediate ROI.

As CTO / Chief System Architect, Stephen brings an in-depth knowledge of what it takes to build successful Software-as-a-Service platforms, often combining multiple legacy systems to achieve a secure, unified view of complex datasets, through scalable cloud-based architectures.

All Authors

Show More Show More
View Blogs by Date