To consider the question of what vectors are, it helps to be a mathematician, or at least someone who’s comfortable thinking in a mathematical way.
If that’s not you, which it probably isn’t if you’re an ecommerce marketing manager or exec, no worries. The Web is chock full of detailed, colorfully illustrated information about vectors.
For a starting point, the Math Is Fun site, written to help elementary-through-high-school kids but welcoming to non-techies of all ages (and, there’ll be no quizzes), does a great job of summing up the concept.
So, quick disclaimer…this blog post isn’t about to exhaustively present everything (or in some cases, anything) about vectors and vector analysis and vector graphics. No. We’re not going into the weeds on vectors. This is a post meant to highlight vector-enhanced search technology, after all. Rest assured, you know how to Google if you need details.
Meanwhile, here’s our best shot at the topic.
Standard numbers are the components of a vector. The components show influence in a given direction of the vector.
Mathematicians refer to the visualization of vectors by talking about components in a coordinate system. In a two-dimensional plane, a vector logically has two components, while in a three-dimensional one, it has (you guessed it) three.
Geometrically, a vector often encompasses coordinates in an n-dimensional space (n refers to the quantity of dimensions, for instance, two). It signifies the position of a coordinate in an n-dimensional space.
In the Cartesian coordinate system, vector quantities are represented in a space with an x axis — a horizontal straight line — and a y axis — a vertical straight line that’s perpendicular to the x axis.
A given vector looks pretty simple, like a straight line capped by an arrowhead. The direction of a vector in rudimentary illustrations shows the length of the line “optimistically” slanting up at an angle, from left to right.
Vectors are typically designated in boldface (e.g., vector a and vector b).
The magnitude of a vector is indicated by a vertical bar on each side of the vector, like this: |a|.
There are various types of vectors, including:
So that’s a (somewhat rambling) math-based explanation of a vector.
Now let’s go in the opposite direction for a broader picture — what does Merriam-Webster use as its plain-English assessment of vectors?
The dictionary’s official definition is “a quantity that has magnitude and direction and that is usually represented by a line segment with the given direction and with a length representing the magnitude.”
Here are a few more data points about vectors:
Another way of describing a vector like it’s a scientific thing is this: A tuple that has scalars (numbers or values from a dataset).
According to Britannica, examples of scalars include density, energy, volume, time, and mass.
The thing to know about scalars is that they don’t possess magnitude; they just “scale” vectors up and down.
A quantity that doesn’t rely on direction is a scalar quantity, according to NASA.
How do vector operations work, besides the fact that in vector math, you can use real numbers and get the results of applying vector addition, vector subtraction, and multiplication of vectors?
For programming, vectors are an effective way to organize and store objects and object collections in containers for use in machine-learning applications. They’re used for various scenarios, such as when supervised and unsupervised learning algorithms are applied to create recommendations.
One of the most-cited examples of vectors in machine learning is support vector machines (SVMs). In this scenario, a supervised algorithm solves problems by applying classification.
Before feeding data into a machine-learning model, it is “vectorized” — converted into numbers representing a point or point sequence in the vector space.
The vectors in machine learning signify input data, including bias and weight. In the same way, output from a machine-learning model (for example, a predicted class), can be put into vector format.
A lowercase v is used to designate a vector. The magnitude of the vector (its length), as well as its origin and direction, are labeled. When training a machine-learning algorithm, the target variable may be represented by a lowercase y.
Now let’s look at the role of vectors in something concrete that you may be interested in: vector search.
Modern applications of vector functionality are a help for letting website users do broad-based searches and get accurate recommendations, personalization, answers to their FAQs, and more.
With semantic search, data to provide in search results can be identified using approximate nearest neighbor (ANN) algorithms.
In a machine-learning context, vector search is able to look at unstructured data — such as what’s in text, photos, or audio — and translate its context and meaning into numeric representation. This vectorization — converting words into numbers — lets the information be used for automating synonyms, clustering documents, detecting meaning and intent in search queries, and ranking search results.
Embeddings are n-dimensional vectors created by deep-learning algorithms to assign semantic definition to input. Other objects, like documents, images, video, and audio, can also be embedded. Machine-learning tasks have improved substantially thanks to embedding.
One of the challenges in working with vectors in machine learning is their size: they tend to be very long and require specialized databases and GPU management. To address this problem, neural hashing can use neural networks to compress them. The result: processing can be up to 500 times faster than when using standard vector calculations, and these hashed vectors can be run on commodity hardware.
Vector search is an effective new technology that works well for broad-based searches. Traditional keyword search, however, still provides the best results for searches that involve someone’s specific intentions.
For example, when someone enters “Levi’s” in a traditional keyword search-engine box, they’d see search results for only that brand — a relatively narrow information window. By contrast, a shopper’s broad-based vector search would return a wider array of similar results, like perhaps other brands that have a similar look and items in the same conceptual category.
If you want to offer your users the best search capabilities, how do you get around this challenge? You put the two together, of course.
That’s exactly what Algolia does. For the most relevant, fastest searching, we use a hybrid approach of both vector and keyword search, ensuring that your users get the best results for both exact-match queries and broad, long-tail queries. Our innovative NeuralSearch technology also scales to meet the needs of any size dataset.
That’s it for our discussion of vectors and how their presence is transforming the search industry. Want to put vectors to work on your business’s behalf? Contact us to learn how Algolia can help get you pointed in the right direction, toward higher ROI, with smart search.
Catherine Dee
Search and Discovery writerPowered by Algolia AI Recommendations