What Is Data? The Atoms of the Digital Universe
Chapter 1: What Is Data? The Atoms of the Digital Universe
Imagine you wake up tomorrow, plug in your favorite tablet, and discover that it has forgotten everything. It no longer remembers the alphabet, the numbers, the words you spoke last week, the shape of your face, or the melody of the song you played on repeat. It does not know what a cat looks like, what "hot" means, or how to turn the screen on. Could it do *anything* useful at all? Almost certainly not. A computer without data is like a chef without ingredients, a writer without letters, a telescope without stars to look at. The screen would light up, the circuits would hum, but the machine would have nothing to think about.
This is the secret at the heart of every artificial intelligence system you have ever touched: a model is only as intelligent as the data it has been shown. Before there is any "learning," before there is any pattern, before there is any answer, there must be data. In this chapter, we are going to take that single word — *data* — and crack it open like a geologist cracking open a rock. We will see what is really inside, why some data is tidy and some data is messy, and why the difference between a clever AI and a foolish one often comes down to nothing more mysterious than the quality of the raw material that was poured into it.
By the end of this chapter, you will be able to look at a photograph, a sentence, a spreadsheet, or a temperature reading and say, with confidence, "I see data here, and I understand what kind it is." You will also know the four big characteristics that data scientists use to judge whether a stream of information is fit for the demanding job of training modern AI. And you will have already touched a real public dataset with your own eyes, the way a young apprentice touches a real tool for the first time.
Let's begin.
---
1.1 A Computer With Nothing to Read
Suppose we built the most powerful computer ever designed. We gave it a processor running at a billion operations per second, we filled it with enough memory to hold a small country's library, and we connected it to the fastest network ever invented. Then we asked it one simple question: "What is 2 plus 2?" Would it answer four?
It would not. It would not answer anything. It would sit there, humming politely, because it has never been told the symbol `2` means the quantity two, never been told the symbol `+` means to add, and never been told the symbol `=` should be followed by an answer. Every one of those facts had to arrive as *data*: a stream of bytes that someone, somewhere, recorded and fed into the machine.
This is true of every task computers perform, no matter how magical it seems.
- When a voice assistant understands your request, it is matching the sound waves you spoke against a giant pile of audio recordings it was shown during training. The audio recordings are the data.
- When a phone unlocks because it recognizes your face, it is comparing the pixels of your face to the pixels of faces it has been shown before. The pixels are the data.
- When a self-driving car stops at a red light, it is recognizing the red blob against the dark background because it has been shown thousands of pictures of red lights in thousands of conditions. The pictures are the data.
Strip the data away, and the cleverness vanishes. This is why the very first question any AI engineer must answer is not "What algorithm should I use?" but "What data do I have, and is it good enough?"
A useful working definition, and the one we will use throughout this book, is the following:
> Data is any recorded fact, signal, or observation that a computer can read.
The word "recorded" is doing important work here. A dream you had last night is not data, because no machine has stored it. A feeling of hunger is not data, because it lives only inside your body. But the moment you speak the words "I am hungry" into a microphone, the sound becomes a wiggle in the air, the microphone turns the wiggle into voltage, the voltage is sampled into numbers, and those numbers are saved to a file. *Now* it is data. The transformation from a private experience to a storable, shareable, machine-readable thing is the moment data is born.
The word "signal" is also important. A signal is something that changes over time, like the temperature in your room, the pulse in your wrist, or the brightness of a star. Sensors are little devices that turn physical signals into electrical ones, and from there into numbers. Every time a sensor writes down a number, it is producing data.
The word "observation" is the most general. It includes anything a person or a machine has chosen to note down. "The sky is blue today" is an observation. "The customer bought three apples" is an observation. "The car traveled 47.3 miles per hour" is an observation. Once an observation is written down in a form a computer can parse, it has become data.
You can think of data as the universe's way of whispering facts to a machine. The machine cannot see, hear, taste, smell, or feel the way you do. It can only *read*. Our entire job, as the alchemists of this book, is to gather those whispers, clean them, mix them, and feed them into systems that turn whispers into wisdom.
---
1.2 The Five Senses of a Machine: Forms of Data
Human beings experience the world through five senses: sight, sound, touch, taste, and smell. A computer, in a similar way, experiences the world through five common forms of data. When you learn to recognize these five forms, you can look at almost any technology and immediately say, "Ah, that is sensing *this* kind of data, and that is why it works the way it does."
1. Numbers (Numerical Data)
The most natural form of data for a computer is the number. Numbers are exact, easy to compare, easy to combine, and easy to plot on a graph. When you see a weather report saying the temperature is 18 degrees Celsius, that "18" is a single piece of numerical data. When a bank records that you deposited $250 on Tuesday and withdrew $40 on Wednesday, those are two more pieces of numerical data.
Numbers come in two flavors, and it is worth learning the difference.
- **Integers** are whole numbers with no fractional part: $-7$, $0$, $42$, $1000000$. They are great for counting things. "There are 3 cookies on the plate." "I have 10 fingers."
- **Floating-point numbers** (or "floats") are numbers with a decimal point: $3.14159$, $-0.0004$, $98.6$. They are great for measuring things. "The cookie is 4.2 centimeters wide." "The room is 22.7 degrees warm."
When a scientist says a value is *discrete*, they mean it can only take certain allowed values, like the integers. When a scientist says a value is *continuous*, they mean it can take any value in a range, like a temperature. Computers do not store continuous values perfectly, because a real number like $\pi$ has infinitely many digits; they approximate them with floats, which are usually good enough.
Numerical data is the easiest kind for an algorithm to chew on. Many classical machine learning models, like linear regression and decision trees, were originally designed to consume numbers and only numbers. Even when we feed them text or images, we usually convert those into numbers first. We will see that trick in section 1.4.
2. Text (Textual Data)
The second form of data is text: words, sentences, paragraphs, books, chat messages, product reviews, encyclopedia entries, and tweets. Text is trickier than numbers because the same word can mean different things in different contexts, and the same idea can be expressed in countless different wordings. The sentence "The movie was good" and the sentence "I did not dislike the film" carry the same feeling but use very different words.
A computer does not understand English the way you do. To a computer, the word "cat" is just a sequence of three characters, or — once it has been encoded into numbers — three codes like $99$,