<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joy</title>
    <description>The latest articles on DEV Community by Joy (@joy_1o1).</description>
    <link>https://dev.to/joy_1o1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4151835%2F885b57f1-4ce8-45f3-8280-75dbd4eb19c8.jpg</url>
      <title>DEV Community: Joy</title>
      <link>https://dev.to/joy_1o1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joy_1o1"/>
    <language>en</language>
    <item>
      <title>I Tried to Teach a Computer "Apple" (It Thought It Was a Fruit, an iPhone, and a Vector)</title>
      <dc:creator>Joy</dc:creator>
      <pubDate>Wed, 30 Sep 2026 12:37:57 +0000</pubDate>
      <link>https://dev.to/joy_1o1/i-tried-to-teach-a-computer-apple-it-thought-it-was-a-fruit-an-iphone-and-a-vector-3bhj</link>
      <guid>https://dev.to/joy_1o1/i-tried-to-teach-a-computer-apple-it-thought-it-was-a-fruit-an-iphone-and-a-vector-3bhj</guid>
      <description>&lt;p&gt;Hello, DEV Community! 🙌 It’s my first time writing here. &lt;/p&gt;

&lt;p&gt;As I was studying how models handle text today, I ran into a funny realization: &lt;strong&gt;computers don't understand human words at all. They only understand numbers.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So how do we explain to a model that a cat is a pet, an apple can be a fruit or a tech company?&lt;/p&gt;

&lt;p&gt;Here is what I learned today about &lt;strong&gt;Word Embedding&lt;/strong&gt;, explained from a pure logic and geometry perspective!&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The First step: Making a Massive List(One-Hot Encoding)
&lt;/h2&gt;

&lt;p&gt;If you ask a beginner programmer how to turn words into numbers, the most obvious idea is to give every single word a simple code or an index in a giant list. &lt;/p&gt;

&lt;p&gt;Imagine taking an entire dictionary of 100,000 words and marking &lt;code&gt;1&lt;/code&gt; for the word you want and &lt;code&gt;0&lt;/code&gt; for everything else.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cat&lt;/code&gt; = &lt;code&gt;[1, 0, 0, 0, ...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;dog&lt;/code&gt; = &lt;code&gt;[0, 1, 0, 0, ...]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;apple&lt;/code&gt; = &lt;code&gt;[0, 0, 1, 0, ...]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why this fails:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;It Wastes Endless Space:&lt;/strong&gt; You end up creating massive arrays full of useless zeros just to represent one tiny word. RIP RAM. 🪦&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Computers Got Zero "Street Smarts":&lt;/strong&gt; In pure math, these simple list positions have nothing in common. To the computer, &lt;code&gt;cat&lt;/code&gt; has as much in common with &lt;code&gt;dog&lt;/code&gt; as it does with &lt;code&gt;banana&lt;/code&gt;. It has no idea that two animals belong together.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  2. The Solution: Giving Words Map Coordinates
&lt;/h2&gt;

&lt;p&gt;Instead of a giant empty list, researchers like Mikolov et al. at Google introduced &lt;strong&gt;Word Embedding&lt;/strong&gt; (such as Word2Vec and GloVe).&lt;/p&gt;

&lt;p&gt;Think of it like plotting points on a map. In physics or math class, you plot points using X, Y, and Z coordinates. Word embedding does the exact same thing, except instead of 3 directions, they use 50 to 300 invisible dimensions!&lt;/p&gt;

&lt;p&gt;These dimensions represent hidden concepts like &lt;em&gt;is_animal&lt;/em&gt;, &lt;em&gt;is_food&lt;/em&gt;, &lt;em&gt;is_tech&lt;/em&gt;, or &lt;em&gt;grammatical_type&lt;/em&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"cat"&lt;/strong&gt; gets coordinates near animal concepts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"dog"&lt;/strong&gt; gets coordinates right next to "cat".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"apple"&lt;/strong&gt; gets pulled into a coordinate spot sitting right in between the fruit neighborhood and the iPhone neighborhood!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How does the computer learn these coordinates? By sliding a "context window" across millions of sentences on the internet. It observes which words consistently live as neighbors in the same sentences so if words appear in similar contexts, they get pulled toward the same coordinates in vector space.&lt;/p&gt;

&lt;p&gt;Because the computer reads millions of sentences, it notices which words "live" in the same neighborhoods.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Math Geometry Magic
&lt;/h2&gt;

&lt;p&gt;Because every word becomes a point in space, we can measure how close two words are by calculating the angle or distance between their points. &lt;/p&gt;

&lt;p&gt;If two words point in nearly the exact same direction, they share similar meanings!&lt;/p&gt;

&lt;h3&gt;
  
  
  Doing Algebra with Words
&lt;/h3&gt;

&lt;p&gt;My discovery today was that you can actually do math equations with word coordinates:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;King - Man + Woman = Queen&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This famous vector arithmetic concept was demonstrated in the original Word2Vec paper by Mikolov et al. (2013)."&lt;/p&gt;

&lt;p&gt;If you start at the coordinate for &lt;strong&gt;King&lt;/strong&gt;, subtract the "male" direction, and add the "female" direction, your new coordinate in space lands right on &lt;strong&gt;Queen&lt;/strong&gt;. 🤯&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Learning that word embedding are just coordinate maps helped me bridge the gap between machine language (a.k.a  math) and human language. &lt;/p&gt;

&lt;h2&gt;
  
  
  In any case, word embedding are nothing but high dimensional maps that make words street-smart. The idea of understanding text via coordinates really clicked with me!
&lt;/h2&gt;

&lt;h2&gt;
  
  
  References &amp;amp; Further Reading
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Mikolov, T., Chen, K., Corrado, G., &amp;amp; Dean, J. (2013).&lt;/strong&gt; &lt;em&gt;Efficient Estimation of Word Representations in Vector Space.&lt;/em&gt; &lt;a href="https://arxiv.org/abs/1301.3781" rel="noopener noreferrer"&gt;arXiv:1301.3781&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pennington, J., Socher, R., &amp;amp; Manning, C. D. (2014).&lt;/strong&gt; &lt;em&gt;GloVe: Global Vectors for Word Representation.&lt;/em&gt; &lt;a href="https://nlp.stanford.edu/projects/glove/" rel="noopener noreferrer"&gt;Stanford NLP&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alammar, J. (2019).&lt;/strong&gt; &lt;em&gt;The Illustrated Word2Vec.&lt;/em&gt; &lt;a href="https://jalammar.github.io/illustrated-word2vec/" rel="noopener noreferrer"&gt;jalammar.github.io&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
