Skip to main content

Subsection 1.1 Personality Embeddings: What are you like?

To understand embeddings, we will start by thinking about how we might represent a person’s personality as a set of numbers.
On a scale of 0 to 100, how introverted/extraverted are you (where 0 is the most introverted, and 100 is the most extraverted)? Have you ever taken a personality test like MBTI -- or even better, the Big Five Personality Traits test? If you haven’t, these are tests that ask you a list of questions, then score you on a number of axes, introversion/extraversion being one of them.
Big Five test scores out of 100: openness to experience 79, agreeableness 75, conscientiousness 42, negative emotionality 50, and extraversion 58.
Figure 1.2. Example of the result of a Big Five Personality Trait test. Results from it have been shown to be at least somewhat predictive of life outcomes .
Consider a person with an introversion/extraversion score of 38/100. That score can be plotted as follows:
Jay’s extraversion score of 38 marked on a vertical scale from 0, introversion, to 100, extraversion, and stored in the first cell of a vector.
The same score can be rescaled to the range -1 to 1:
Jay’s extraversion score shown as -0.4 on a vertical scale from -1, introversion, to 1, extraversion, and stored in the first cell of a vector.
A single trait provides only a limited description of a person. Adding a second trait introduces another dimension:
Jay’s two trait scores, -0.4 and 0.8, represented both as an arrow from the origin pointing down and right and as the first two cells of a vector.
Figure 1.3. The two dimensions can be represented as a point on a graph, or as a vector from the origin to that point. Vector operations provide useful tools for comparing these representations.
The two dimensions can be represented as a sequence (vector) of two numbers: the first number represents the score for the first dimension, and the second number represents the score for the second dimension. This vector partially represents the personality of the example person and is called an embedding.
Comparing it with the vectors of two other people provides a way to identify the more similar personality:
Three personality vectors: Jay (-0.4, 0.8), Person 1 (-0.3, 0.2), and Person 2 (-0.5, -0.4). Jay and Person 1 point down and right; Person 2 points down and left.
Figure 1.4. Comparison of personality vectors for three people. The trait labels are omitted to illustrate that a vector can provide useful information even when the meaning of each dimension is unknown.
Looking at the vectors, we can see that Person #1 has a personality vector that is more similar to the Jay’s vector than does Person #2. Although Person #1’s vector isn’t as long as Jay’s, it is at least pointing in a similar direction.
We can use various mathematical methods to calculate the similarity between these vectors. One such method is cosine_similarity. It measures the cosine of the angle between two vectors, with values ranging from -1 (completely opposite) to 1 (identical). Any positive score indicates that the vectors are pointing in similar directions.
Cosine similarity compares Jay’s vector (-0.4, 0.8) with Person 1 (-0.3, 0.2), giving 0.87, and Person 2 (-0.5, -0.4), giving -0.20.
Figure 1.5. cosine similarity shows that Person #1’s vector is quite similar to the Jay vector (0.87). Person #2’s vector is less similar to Jay’s (-0.20).
Two dimensions still provide a limited description of personality. To get a more detailed characterisation, we can include all five dimensions of the Big Five:
Five trait scores for each person: Jay (-0.4, 0.8, 0.5, -0.2, 0.3), Person 1 (-0.3, 0.2, 0.3, -0.4, 0.9), and Person 2 (-0.5, -0.4, -0.2, 0.7, -0.1).
Five-dimensional vectors cannot be drawn as arrows on a two-dimensional graph without a projection. But the concept of cosine similarity works with any number of dimensions:
Comparing five-dimensional personality vectors gives a cosine similarity of 0.66 between Jay and Person 1 and -0.37 between Jay and Person 2.
Figure 1.6. Across the five dimensions Person #1 is still more similar to Jay than Person #2 is.
Although we have focused on personality traits, we can use the same approach to represent other concepts. We can define a number of traits that describe the concept, and then represent it as a vector of numbers. For example, we could define traits for a car such as speed, fuel efficiency, and comfort, and represent a specific car as a vector of numbers corresponding to those traits.