You are viewing a public preview
Sign in to save your progress, do assignments, join discussions and get feedback.
After this unit you will: be able to recognize which of the four common types a dataset belongs to.
| Type | Example in the lecture |
|---|---|
| Table (tabular) | square_feet, num_floors, num_bedrooms, price (billion VND) |
| Text | title, description, job_level (junior / senior / middle) |
| Images | pictures organized by class: airplane, automobile, bird, cat, deer |
| Audio | waveforms |
By the end of this lesson you can:
Key idea: Before you train any model you must understand and prepare your data: garbage in, garbage out. Most classical machine learning works on tabular data, where each row is one example and each column is one piece of information about it.
Module 1 is about the data side of machine learning. Even the best algorithm produces poor results if the data is messy or badly structured. That is the meaning of the old saying garbage in, garbage out. So the first skill is to recognise what kind of data you have.
| Type | What it looks like | Typical examples |
|---|---|---|
| Tabular | Rows and columns, like a spreadsheet or database table | Sales records, customer databases, financial transactions |
| Text | Documents, articles, reviews, social media posts | Job descriptions, product reviews |
| Image | Photographs, scans, medical images | The CIFAR-10 dataset: airplane, automobile, bird, cat, deer |
| Audio | Sound over time, shown as waveforms | Voice recordings, music, sound clips |
This course focuses mainly on tabular data. It is the most common starting point for classical machine learning and the most common kind of data in business. Image and audio data usually need deep learning and neural networks, which are beyond this course, but it helps to know where they fit in the bigger picture.
The lecture's main example is a small housing table with the columns square_feet, num_floors, num_bedrooms and price (in billion VND). The first house has 60 square feet, 4 floors, 3 bedrooms and a price of 3.2 billion VND.
price.Almost every problem in this course can be written in this shape: rows are examples, columns are what we know about them, plus one column we are trying to predict. Get comfortable reading tables this way.
The second example is a table of job postings with the columns title, description and job_level (for example game developer is junior, data scientist is senior, front-end developer is middle). It is still a table, but the description column holds full sentences, not simple numbers or short categories. Tabular data is not always clean numeric columns. A text column needs further processing before a model can use it. Real-world data is usually messier than teaching examples.
CIFAR-10 is a famous image dataset in which each small photo carries a label saying what it shows. A model trained on it learns to look at a new photo and guess its category. Audio is shown as waveforms, the shape of sound over time; models trained on audio do speech recognition, speaker identification or music genre classification. Whatever the type, a model only works with numbers: an image is a grid of pixel values and a sound clip is a sequence of amplitude values.
Build the housing table in pandas and separate the information we know (inputs) from the value we want to predict. The bedroom counts match the lecture's table; the other values after the first row are illustrative.
import pandas as pd
houses = pd.DataFrame({
"square_feet": [60, 45, 80, 65],
"num_floors": [4, 3, 5, 4],
"num_bedrooms": [3, 2, 4, 3],
"price": [3.2, 2.5, 4.1, 2.9], # billion VND
})
print(houses.shape) # (rows, columns)
X = houses.drop(columns="price") # what we know about each house
y = houses["price"] # what we want to predict
print(X.columns.tolist())
print(y.tolist())
Expected output:
(4, 4)
['square_feet', 'num_floors', 'num_bedrooms']
[3.2, 2.5, 4.1, 2.9]
There are 4 rows (4 houses) and 4 columns. After the split, X holds the three input columns and y holds the prices.
price) apart from the inputs.price is in billion VND; mixing units across rows gives a model nonsense.Flashcards · 1.2 Data Types
8 wordsIf the input data is messy or badly prepared, even the best algorithm will produce poor results.
Data organised in rows and columns, like a spreadsheet or database table.
Data made of words and sentences, such as documents, reviews or job descriptions.
Data made of pictures; each image is stored as a grid of pixel values.
Sound recorded over time, often shown as a waveform.
One individual observation in a table, such as one house.
One piece of information recorded for every row of a table.
A famous image dataset of small labelled photos used to train image classifiers.