Đại học Kinh tế Quốc dân – National Economics UniversityMICRO4ASIA
🏆 Arena
Sign inSign up
MICRO4ASIAThe six micro-credentials

Courses are delivered on the Limio learning platform. Limio

← Fundamental of Machine Learning

You are viewing a public preview

Sign in to save your progress, do assignments, join discussions and get feedback.

Sign in
Module 1: Data Preparation and Model Foundations

1.2 Data Types

Print / Save as PDF

1.2 Data Types

After this unit you will: be able to recognize which of the four common types a dataset belongs to.

Key Points

TypeExample in the lecture
Table (tabular)square_feet, num_floors, num_bedrooms, price (billion VND)
Texttitle, description, job_level (junior / senior / middle)
Imagespictures organized by class: airplane, automobile, bird, cat, deer
Audiowaveforms
  • Whatever the type, data must be represented as numbers before it is fed into a model.

Study notes

By the end of this lesson you can:

  • Name the four broad types of data used in machine learning: tabular, text, image and audio.
  • Read a tabular dataset as rows (examples) and columns (pieces of information), with one column as the value to predict.
  • Recognise that a table can contain a text column that needs extra processing.
  • Explain why this course focuses on tabular data and why every type must become numbers before modelling.

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.

Why data comes first

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.

The four broad types of data

TypeWhat it looks likeTypical examples
TabularRows and columns, like a spreadsheet or database tableSales records, customer databases, financial transactions
TextDocuments, articles, reviews, social media postsJob descriptions, product reviews
ImagePhotographs, scans, medical imagesThe CIFAR-10 dataset: airplane, automobile, bird, cat, deer
AudioSound over time, shown as waveformsVoice 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.

Tabular data: rows and columns

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.

  • Each row is one house: one individual example or observation.
  • Each column is one piece of information about that house.
  • One column is usually the thing we want to predict. Here it is 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.

Text inside a table

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.

Images and audio

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.

Worked example

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.

Common mistakes

  • Assuming tabular means only numbers. A table can contain text columns such as job descriptions, which need extra processing.
  • Forgetting to separate the target column. Keep the value you want to predict (here price) apart from the inputs.
  • Ignoring units. In the housing table price is in billion VND; mixing units across rows gives a model nonsense.
  • Thinking classical ML handles every data type equally well. Images and audio usually call for deep learning, which this course does not cover.

Summary

  • Garbage in, garbage out: data preparation comes before modelling.
  • The four broad data types are tabular, text, image and audio.
  • This course focuses on tabular data: rows are examples, columns are information, one column is the target.
  • A table can still contain rich text that needs further processing.
  • Every data type must be represented as numbers before it goes into a model.

Flashcards · 1.2 Data Types

8 words
WordMeaningExample
  • Garbage in, garbage out

    If the input data is messy or badly prepared, even the best algorithm will produce poor results.

    Duplicated, unformatted sales data gives an unreliable forecast.

  • Tabular data

    Data organised in rows and columns, like a spreadsheet or database table.

    A housing table with square_feet, num_floors, num_bedrooms, price.

  • Text data

    Data made of words and sentences, such as documents, reviews or job descriptions.

    The description column of a job postings table.

  • Image data

    Data made of pictures; each image is stored as a grid of pixel values.

    CIFAR-10 photos labelled airplane, automobile, bird, cat, deer.

  • Audio data

    Sound recorded over time, often shown as a waveform.

    Voice clips used for speech recognition.

  • Row (example)

    One individual observation in a table, such as one house.

    60 square feet, 4 floors, 3 bedrooms, 3.2 billion VND.

  • Column

    One piece of information recorded for every row of a table.

    num_bedrooms

  • CIFAR-10

    A famous image dataset of small labelled photos used to train image classifiers.

    Classes include airplane, bird, cat and deer.