Unit 1 · Vectors

Lesson 04 · Available to read

Vectors as data

A house described as [size, rooms, age, price]: any fixed-order numerical record is a vector, the first link to machine learning.

A property listing contains several numerical attributes: 120 m², 3 rooms, 15 years old, $250,000. Arranged in a fixed order, they form a vector, [120, 3, 15, 250000]. Each attribute is called a feature, and the vector is a feature vector.

Encoding every house in a city this way places each one as a point in the same four-dimensional space. Houses with similar attributes correspond to nearby points.

This is the first connection to machine learning: patients, customers, images and words are all represented as feature vectors before a model can process them. The essential requirement is a consistent ordering. If the second component records the number of rooms for one house, it must do so for every house.

A house icon mapped to the column [120, 3, 15, 250,000] labelled size, rooms, age and price
Houses plotted by size and price; three similar houses cluster together

The takeaway

Any numerical record in a fixed order is a feature vector; this is how data enters machine learning.

Practice

0 of 4 attempted

  1. 1Apply

    Turn this apartment into a vector using the order [size m², bedrooms, floor, rent $]: 65 m², 2 bedrooms, 4th floor, $1,400 rent.

    Saved in this browser

  2. 2Explain in your own words

    Why must every vector in a dataset use the same order of entries?

    Saved in this browser

  3. 3Multiple choice

    Two houses are [120, 3, 15] and [118, 3, 14] (size, rooms, age). A third is [300, 7, 80]. Which pair is most similar?

  4. 4Apply

    Name two other kinds of things that could be turned into vectors for machine learning, and list three features for each.

    Saved in this browser