Vector & Vector DB

A vector is a mathematical object with one direction and one size. This direction and magnitude are usually expressed by a list of numbers. A vector is a series of numbers, but these numbers refer to a certain direction, distance, or other measure.

Vector Examples:

* Direction and Distance: Let a car go 3 meters forward and 4 meters to the right. We can write this movement as follows: [3, 4]. So, 3 units go forward and 4 units go right. Here we have two numbers of our vector: 3 and 4.
• Location: If we want to specify the position where an object is located, for example, an object is 5 meters above and 2 meters to the right, we can express this situation as follows: [5, 2].
* Weather: Let’s say the air temperature in a city is 30°C, the wind speed is 10 km/h and the humidity is 50%. We can also show these data with a vector as follows: [30, 10, 50]. Here, three different data are expressed by the numbers 30 (temperature), 10 (wind speed), 50 (humidity).

Decoupling the Difference Between Scalar and Vector:
* A scalar is just a number and has no direction. So it refers only to greatness. For example, things like 5, 30°C, 100 km are a scalar. It just means greatness.
• A vector is a list of numbers and expresses size and direction. That is, for example, the vector [3, 4] expresses both magnitude (3 and 4) and direction (3 units forward, 4 units to the right). Each element of the vector represents a dimension.

Let’s Decipher the Difference Between Scalar and Vector Again:
* Scalar: There is magnitude, there is no direction. For example: 20 km (size but no direction).
* Vector: There is Magnitude and Direction. For example: [3, 4] (3 units to go forward and 4 units to the right).

In summary: The scalar is just a number (magnitude), while the vector is a series of numbers, and the numbers in this series express both magnitude and direction (or other properties).

What is a Vector Database (Vector DB)?

A vector database is a kind of database in which data is stored in vectors and you can quickly query on these vectors. The aim here is to represent the data in a numerical way and to make similarity searches between these data very Decently.

What is a Vector Database Useful For?
* Similarity Searches: For example, by comparing vectors belonging to a word or phrase, it can be used to find similar sentences or words.
* Clustering: It can be used to group similar data.
* Recommendation Systems: When recommending similar products or content to the user, a recommendation can be made by calculating the similarity between the vectors.Dec.

Vector Database Example Scenario:

Let’s say you are building a book recommendation system. The user has read a book and written a comment about this book. You have converted the content of this comment to a numerical vector by embedding (vectorization). You have saved the vector of that book in the database.

Then, when another user writes a comment about another book, you extract the vector of that comment. Then, you recommend similar books by comparing the vector of that comment with the vectors of other comments in the database.

Popular Vector Database Tools:

1. Facebook AI Similarity Search (FAISS): This library, developed by Facebook, is used to perform quick similarity searches on big data.
2. Pinecone: It is a cloud-based, fast and scalable vector database.
3. Weaviate: It is both an open source and a cloud-based vector database. You can easily manage and query your own data.
4. Milvus: A database that can perform large-scale, fast vector searches.

Yorum gönder