🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Machine Learning Notes
Topic #37

Vector Space

A vector space is the full set of vectors reachable by adding and scaling a chosen set of "basis" vectors. In ML, the number of features in your dataset defines the dimension of the space every data point lives in.

Basis and Dimension

A basis is the smallest set of vectors that can combine (via addition and scalar multiplication) to reach every point in the space. The number of vectors in a basis is the space's dimension.

\[ \text{standard basis for } \mathbb{R}^2:\quad \hat{e}_1 = [1,0], \quad \hat{e}_2 = [0,1] \] \[ \text{any vector } [a,b] = a\hat{e}_1 + b\hat{e}_2 \]

Any 2D vector \([a,b]\) can be built from these two basis vectors — which is why 2D space needs exactly 2 basis vectors, not more, not fewer.

Why This Matters for ML: Feature Space

A dataset with 20 features doesn't just have "20 columns" — each data point is a vector in a 20-dimensional vector space. This reframing is what makes concepts like distance, similarity and dimensionality reduction precise: KNN measures distance in this space, PCA finds a lower-dimensional subspace that still captures most of the data's structure.

Span — What a Set of Vectors Can and Can't Reach

import numpy as np

# Two vectors that are NOT parallel span all of 2D space (any point is reachable)
v1 = np.array([1, 0])
v2 = np.array([0, 1])

# Two PARALLEL vectors only span a 1D line — you can never reach off that line
v3 = np.array([2, 4])
v4 = np.array([1, 2])   # v4 is just 0.5 * v3 -- same direction, no new information

This directly explains why highly correlated features add little new information — two nearly-parallel feature vectors span almost the same subspace, so one of them is close to redundant.

Common Mistakes

  • Treating "more features" as automatically "more information" — if new features are linear combinations of existing ones, they add dimension count without adding real span/information.
  • Confusing the number of features (columns) with the true dimensionality of the meaningful signal in the data — this is exactly the gap dimensionality reduction exploits.

Interview Relevance

Q: "What does it mean for a dataset to have 'intrinsic dimensionality' lower than its feature count?" It means the real information in the data can be captured by fewer directions (a smaller basis) than the number of raw features — highly correlated or redundant features inflate the feature count without expanding the space the data actually occupies.

Practice Question

Two features, "temperature in Celsius" and "temperature in Fahrenheit," are included in a dataset. Explain, using the idea of span, why these two columns add almost no new dimensionality to the feature space.

Want to go beyond the notes?

Join CodingNow 2.0's Machine Learning course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Vector Space – FAQs

Quick answers about learning Vector Space in Machine Learning.

This free note from CodingNow 2.0 explains Vector Space in Machine Learning — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Machine Learning topic on CodingNow 2.0, including Vector Space, is 100% free with no signup required.
With focused practice, most students grasp Vector Space in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now