1 Intuition of artificial intelligence
This chapter covers
-
Definition of AI as we know it
-
Intuition of concepts that are applicable to AI
-
Problem types in computer science and AI, and their properties
-
Overview of the AI algorithms discussed in this book
-
Real-world uses for AI
What is artificial intelligence?
Intelligence is a mystery—a concept that has no agreed-upon definition. Philosophers, psychologists, scientists, and engineers all have different opinions about what it is and how it emerges. We see intelligence in nature around us, such as groups of living creatures working together, and we see intelligence in the way that humans think and behave. In general, things that are autonomous yet adaptive are considered to be intelligent. Autonomous means that something does not need to be provided constant instructions; and adaptive means that it can change its behavior as the environment or problem space changes. When we look at living organisms and machines, we see that the core element for operation is data. Visuals that we see are data; sounds that we hear are data; measurements of the things around us are data. We consume data, process it all, and make decisions based on it; so a fundamental understanding of the concepts surrounding data is important for understanding artificial intelligence (AI) algorithms.
Defining AI
Some people argue that we don’t understand what AI is because we struggle to define intelligence itself. Salvador Dalí believed that ambition is an attribute of intelligence; he said, “Intelligence without ambition is a bird without wings.” Albert Einstein believed that imagination is a big factor in intelligence; he said, “The true sign of intelligence is not knowledge, but imagination.” And Stephen Hawking said, “Intelligence is the ability to adapt,” which focuses on being able to adapt to changes in the world. These three great minds had different outlooks on intelligence. With no true definitive answer to intelligence yet, we at least know that we base our understanding of intelligence on humans as being the dominant (and most intelligent) species.
For the sake of our sanity, and to stick to the practical applications in this book, we will loosely define AI as a synthetic system that exhibits “intelligent” behavior. Instead of trying to define something as AI or not AI, let’s refer to the AI-likeness of it. Something might exhibit some aspects of intelligence because it helps us solve hard problems and provides value and utility. Usually, AI implementations that simulate vision, hearing, and other natural senses are seen to be AI-like. Solutions that are able to learn autonomously while adapting to new data and environments are also seen to be AI-likeness.
Here are some examples of things that exhibit AI-likeness:
-
A system that succeeds at playing many types of complex games
-
A cancer tumor detection system
-
A system that generates artwork based on little input
-
A self-driving car
Douglas Hofstadter said, “AI is whatever hasn’t been done yet.” In the examples just mentioned, a self-driving car may seem to be intelligent because it hasn’t been perfected yet. Similarly, a computer that adds numbers was seen to be intelligent a while ago but is taken for granted now.
The bottom line is that AI is an ambiguous term that means different things to different people, industries, and disciplines. The algorithms in this book have been classified as AI algorithms in the past or present; whether they enable a specific definition of AI or not doesn’t really matter. What matters is that they are useful for solving hard problems.
Understanding that data is core to AI algorithms
Data is the input to the wonderful algorithms that perform feats that almost appear to be magic. With the incorrect choice of data, poorly represented data, or missing data, algorithms perform poorly, so the outcome is only as good as the data provided. The world is filled with data, and that data exists in forms we can’t even sense. Data can represent values that are measured numerically, such as the current temperature in the Arctic, the number of fish in a pond, or your current age in days. All these examples involve capturing accurate numeric values based on facts. It’s difficult to misinterpret this data. The temperature at a specific location at a specific point in time is absolutely true and is not subject to any bias. This type of data is known as quantitative data.
Data can also represent values of observations, such as the smell of a flower or one’s level of agreement with a politician’s policies. This type of data is known as qualitative data and is sometimes difficult to interpret because it’s not an absolute truth, but a perception of someone’s truth. Figure 1.1 illustrates some examples of the quantitative and qualitative data around us.
Figure 1.1 Examples of data around us
Data is raw facts about things, so recordings of it usually have no bias. In the real world, however, data is collected, recorded, and related by people based on a specific context with a specific understanding of how the data may be used. The act of constructing meaningful insights to answer questions based on data is creating information. Furthermore, the act of utilizing information with experiences and consciously applying it creates knowledge. This is partly what we try to simulate with AI algorithms.
Figure 1.2 shows how quantitative and qualitative data can be interpreted. Standardized instruments such as clocks, calculators, and scales are usually used to measure quantitative data, whereas our senses of smell, sound, taste, touch, and sight, as well as our opinionated thoughts, are usually used to create qualitative data.
Figure 1.2 Qualitative data versus quantitative data
Data, information, and knowledge can be interpreted differently by different people, based on their level of understanding of that domain and their outlook on the world, and this fact has consequences for the quality of solutions—making the scientific aspect of creating technology hugely important. By following repeatable scientific processes to capture data, conduct experiments, and accurately report findings, we can ensure more accurate results and better solutions to problems when processing data with algorithms.
Viewing algorithms as instructions in recipes
We now have a loose definition of AI and an understanding of the importance of data. Because we will be exploring several AI algorithms throughout this book, it is useful to understand exactly what an algorithm is. An algorithm is a set of instructions and rules provided as a specification to accomplish a specific goal. Algorithms typically accept inputs, and after several finite steps in which the algorithm progresses through varying states, an output is produced.
Even something as simple as reading a book can be represented as an algorithm. Here’s an example of the steps involved in reading this book:
-
Find the book Grokking Artificial Intelligence Algorithms.
-
Open the book.
-
While unread pages remain,
-
Read page.
-
Turn to next page.
-
Think about what you have learned.
-
Think about how you can apply your learnings in the real world.
An algorithm can be viewed as a recipe, as seen in figure 1.3. Given some ingredients and tools as inputs, and instructions for creating a specific dish, a meal is the output.
Figure 1.3 An example showing that an algorithm is like a recipe
Algorithms are used for many different solutions. For example, we can enable live video chat across the world through compression algorithms, and we can navigate cities through map applications that use real-time routing algorithms. Even a simple “Hello World” program has many algorithms at play to translate the human-readable programming language into machine code and execute the instructions on the hardware. You can find algorithms everywhere if you look closely enough.
To illustrate something more closely related to the algorithms in this book, figure 1.4 shows a number-guessing-game algorithm represented as a flow chart. The computer generates a random number in a given range, and the player attempts to guess that number. Notice that the algorithm has discrete steps that perform an action ...