Skip to main content

Command Palette

Search for a command to run...

Vector in ML

Updated
2 min read

Vector is an ordered array of numbers (or data point) representing features of object like text, image, or audio.

These high dimensional numerical representations, or embeddings, captures semantic meaning, allowing algos to measure similarities, and identifying relationships.
It helps basically to process unstructured data for examples like recommendation systems and LLMs

Now let’s understand what above definition means.

How vector is represented?
example like tables length and breadth (in inch) might be:
V = (48,16)
in higher dimensions vector will have large components such as:

V = (x1,x2,x3,x4,…….xN)

Now you can simply create a vector in python using NumPy

Import numpy as np

V = np.array([48,16])

Print(“Vectors:”,v)

# Similarly, a matrix is also an example of a vector.

Types of Vectors in Machine Learning.
Row and Column Vectors row vector is v = (x1, x2,x3 ) it is one-dimensional array

Zero Vector

A vector with all elements is 0. It is useful in optimization and denote origin in vector space.

v = (0,0,0)

Unit Vector

A vector of magnitude 1. It is majorly used for direction

Sparse Vector

In this vector it majorly consists of zeros and used in text analysis and recommendation system

Dense Vector
In this vector it consists of non-zero elements and used in image processing and deep learning

Key operations are performed using NumPy or PyTorch to perform core mathematical operations in python
these operations are dot product, scalar multiplication, vector addition/subtraction, Normalization. we will deep dive in coming blogs.

Why vectors are used in Ml.

Because of its properties which can be utilised to create

Feature Representation
As we learned vectors represents data point in numerical forms. Like in Natural language processing words are translated into word vectors using library in python you can also achieve using word2vec

Similarity Measurement Now feature representation of word vectors enables us to measure distance of vectors using Euclidean Distance or Cosine Similarity Algorithms in Ml.

Transformations and Projections.
Vectors enable mathematical operations such as rotation, scaling and translation.
example used in principal component analysis.

Application of vectors

Linear Regression

Neural Networks

Embeddings

Ask questions and what do you think about Vectors in comment X

What’s Next .... we will deep dive into how word2Vec library works and helps in finding feature representation Stay Tuned and Subscribe