<?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: Igihozo Gwiza Aline</title>
    <description>The latest articles on DEV Community by Igihozo Gwiza Aline (@igihozo_gwizaaline_e6790).</description>
    <link>https://dev.to/igihozo_gwizaaline_e6790</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%2F4151844%2F4e6b276a-ea70-49e9-9714-86cc17135716.png</url>
      <title>DEV Community: Igihozo Gwiza Aline</title>
      <link>https://dev.to/igihozo_gwizaaline_e6790</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/igihozo_gwizaaline_e6790"/>
    <language>en</language>
    <item>
      <title>From Pixels to Meaning: A Beginner's First Day in Computer Vision</title>
      <dc:creator>Igihozo Gwiza Aline</dc:creator>
      <pubDate>Tue, 13 Oct 2026 13:09:48 +0000</pubDate>
      <link>https://dev.to/igihozo_gwizaaline_e6790/from-pixels-to-meaning-a-beginners-first-day-in-computer-vision-eni</link>
      <guid>https://dev.to/igihozo_gwizaaline_e6790/from-pixels-to-meaning-a-beginners-first-day-in-computer-vision-eni</guid>
      <description>&lt;p&gt;Before the first day of computer vision, I thought it meant "teaching a computer to look at pictures, the way we do." By the end of the day I realised that sentence hides about six different questions. These are the ones I wrote down, with the answers that finally made sense to me.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Why is "seeing" hard for a computer?
&lt;/h2&gt;

&lt;p&gt;Because a computer doesn't receive a picture. It receives numbers.&lt;/p&gt;

&lt;p&gt;A photo is a grid of pixels, and each pixel is three numbers: how much red, green and blue light it has, each from 0 to 255. Our sample street photo is 1080 rows by 810 columns, so that is 1080 x 810 x 3 = &lt;strong&gt;2,624,400 numbers&lt;/strong&gt;. Somewhere in those numbers is a bus, but nothing in the file says "bus".&lt;/p&gt;

&lt;p&gt;Think of it like being handed a spreadsheet of 2.6 million cells and being asked what it shows. Computer vision is the work of getting from the spreadsheet to the meaning.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. What can computer vision actually do?
&lt;/h2&gt;

&lt;p&gt;I found it easier to remember the field as five jobs, from simplest to most detailed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Classification:&lt;/strong&gt; one label for the whole picture ("minibus").&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detection:&lt;/strong&gt; a box around each object ("1 bus, 4 people").&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Segmentation:&lt;/strong&gt; a label for every single pixel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OCR:&lt;/strong&gt; reading text inside an image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tracking:&lt;/strong&gt; following an object from frame to frame in a video.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same street photo can feed the first three, and each gives a different kind of answer. Choosing the right job matters. If you want to count motorcycles at a junction, a single label for the whole photo will not help you. You need detection.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. How does a computer find an edge?
&lt;/h2&gt;

&lt;p&gt;An edge is just a place where brightness changes quickly. To find one, the computer slides a small grid of weights, called a filter, across the image, multiplying and adding as it goes.&lt;/p&gt;

&lt;p&gt;You can see the whole idea in a few lines of NumPy, with no model and no download. Here is a tiny 6x6 "image" that is dark on the left and bright on the right:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;sobel_x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;

&lt;span class="n"&gt;flat_patch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   &lt;span class="c1"&gt;# all zeros: no change in brightness
&lt;/span&gt;&lt;span class="n"&gt;edge_patch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   &lt;span class="c1"&gt;# dark -&amp;gt; bright: an edge
&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;flat_patch&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;sobel_x&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;   &lt;span class="c1"&gt;# 0
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;edge_patch&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;sobel_x&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;   &lt;span class="c1"&gt;# 800
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where nothing changes, the answer is &lt;strong&gt;0&lt;/strong&gt;. Where the brightness jumps from left to right, the answer is &lt;strong&gt;800&lt;/strong&gt;. That big number is the computer's way of saying "something is happening here". Run the same filter over the whole photo and every edge lights up.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. So what does a CNN add?
&lt;/h2&gt;

&lt;p&gt;In that example I chose the weights. A Convolutional Neural Network (CNN) uses the same sliding-filter idea, but it &lt;strong&gt;learns the weights by itself&lt;/strong&gt; from thousands of labelled images.&lt;/p&gt;

&lt;p&gt;Early layers end up finding edges. Middle layers combine edges into textures and shapes. Later layers combine those into whole objects. I found this the most surprising part of the day: nobody tells the network what an edge is. It works that out because edges turn out to be useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. How can a detector find objects so quickly?
&lt;/h2&gt;

&lt;p&gt;Older detectors worked in two steps: first propose regions that might hold an object, then classify each region. That was accurate, but slow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;YOLO&lt;/strong&gt; ("You Only Look Once") does it in one pass. The whole image goes through the network once, and out come every box, label and confidence score together. It is fast enough for live video, and the small version we used is only about 5 MB.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;ultralytics&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;YOLO&lt;/span&gt;

&lt;span class="n"&gt;detector&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;YOLO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yolo11n.pt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;detector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bus.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;conf&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;box&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boxes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;box&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cls&lt;/span&gt;&lt;span class="p"&gt;)],&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;box&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;conf&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the sample photo it finds the bus (94% sure) and the people standing in front of it. The &lt;code&gt;conf&lt;/code&gt; value is a setting you choose, and it changes the result: lower it and you get more boxes with more mistakes, raise it and you get fewer but surer ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Does it work everywhere? What can go wrong?
&lt;/h2&gt;

&lt;p&gt;This was the question that stayed with me, because the answer is: not automatically.&lt;/p&gt;

&lt;p&gt;We made the same photo harder on purpose. In the dark, the model invented a skateboard. Upside down, it missed the bus. At very low resolution, it found nothing. The pixels were the same photo, but the conditions were different from what the model was trained on.&lt;/p&gt;

&lt;p&gt;That matters here, because many of these models were trained mostly on photos from other parts of the world. And yet computer vision is already being used in Africa:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nuru&lt;/strong&gt; helps farmers diagnose cassava disease from a leaf photo, offline, on a basic phone.&lt;/li&gt;
&lt;li&gt;In Nigeria, X-ray screening software helped find TB: 5,298 people were screened, and 85 with TB were found.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BLAIVA&lt;/strong&gt;, built by FabLab Rwanda in Kigali, is a wearable camera that describes objects, text and faces for people with low vision.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each of these, the useful question is not "does it work?" but "what happens to the person if it fails?" A wrong answer on a leaf photo and a wrong answer on an X-ray are not the same kind of mistake.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I take away
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A photo is height x width x 3 numbers.&lt;/li&gt;
&lt;li&gt;Filters find patterns, and CNNs learn their own filters.&lt;/li&gt;
&lt;li&gt;Classification, detection and segmentation answer different questions.&lt;/li&gt;
&lt;li&gt;A model is only as good as the data it has seen, so local data matters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next I want to learn how datasets are built, how to train my own small CNN in PyTorch, and how to test a model honestly. If you have tried a computer vision model on your own photos, I would love to hear what it got right and what it got wrong.&lt;/p&gt;

</description>
      <category>computervision</category>
      <category>python</category>
      <category>deeplearning</category>
    </item>
    <item>
      <title>What I Learned About Word Embeddings and Word2Vec</title>
      <dc:creator>Igihozo Gwiza Aline</dc:creator>
      <pubDate>Wed, 30 Sep 2026 13:15:45 +0000</pubDate>
      <link>https://dev.to/igihozo_gwizaaline_e6790/what-i-learned-about-word-embeddings-and-word2vec-2g83</link>
      <guid>https://dev.to/igihozo_gwizaaline_e6790/what-i-learned-about-word-embeddings-and-word2vec-2g83</guid>
      <description>&lt;p&gt;While learning Natural Language Processing (NLP), I came across a concept that helped me understand better how computers work with human language: &lt;strong&gt;word embeddings&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I read the &lt;em&gt;Dive into Deep Learning&lt;/em&gt; material on natural language processing, especially the section about word embeddings and Word2Vec. Before reading it, I knew that text usually needs to be converted into numbers before a machine learning model can process it, but I did not fully understand how the representation of a word could contain information about its relationship with other words.&lt;/p&gt;

&lt;p&gt;After going through the material, I understood word embeddings as a way of representing words using numerical vectors. Instead of treating a word as just a piece of text, we give it a position in a mathematical space. Words that are used in similar situations can have vectors that are closer to each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Are Word Embeddings Important?
&lt;/h2&gt;

&lt;p&gt;One of the first things I learned is that there are different ways of converting words into numbers.&lt;/p&gt;

&lt;p&gt;A simple method is &lt;strong&gt;one-hot encoding&lt;/strong&gt;. For example, if our vocabulary contains four words:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat
dog
car
house
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we could represent them like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat   → [1, 0, 0, 0]
dog   → [0, 1, 0, 0]
car   → [0, 0, 1, 0]
house → [0, 0, 0, 1]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells the computer which word we are talking about, but it does not really tell the computer how the words are related.&lt;/p&gt;

&lt;p&gt;For example, "cat" and "dog" are both animals, but their one-hot vectors do not show that relationship.&lt;/p&gt;

&lt;p&gt;This is where word embeddings become useful. Instead of giving every word an isolated position, embeddings can represent words in a way that allows relationships and similarities to be captured.&lt;/p&gt;

&lt;p&gt;A simplified example could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat → [0.21, 0.73, 0.45]
dog → [0.24, 0.70, 0.48]
car → [0.91, 0.12, 0.08]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These numbers are only for illustration. Real word embeddings normally have many more dimensions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Word2Vec?
&lt;/h2&gt;

&lt;p&gt;The embedding method I focused on was &lt;strong&gt;Word2Vec&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The main idea I took from the D2L material is that a word can be understood partly by looking at the words that appear around it. If two words regularly appear in similar contexts, their representations can become similar.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The child plays with a ball.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The boy plays with a ball.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The words "child" and "boy" occur in similar contexts. A model can learn from these patterns instead of someone manually telling it that the two words are related.&lt;/p&gt;

&lt;p&gt;Word2Vec has two main approaches: &lt;strong&gt;Skip-gram&lt;/strong&gt; and &lt;strong&gt;Continuous Bag of Words (CBOW)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;Skip-gram&lt;/strong&gt;, we start with a word and use it to predict words that appear around it.&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;CBOW&lt;/strong&gt;, we do the opposite: we use surrounding words to predict the word in the middle.&lt;/p&gt;

&lt;p&gt;A simple way I remember the difference is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Skip-gram:
center word → surrounding words

CBOW:
surrounding words → center word
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model learns during training, and the resulting numerical representations become the word embeddings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Seeing Similarity in Practice
&lt;/h2&gt;

&lt;p&gt;One thing I found interesting is that once words have been represented as vectors, we can compare those vectors.&lt;/p&gt;

&lt;p&gt;For example, with a pretrained Word2Vec model, we could use Python to find words that are similar to another word:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;similar_words&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;most_similar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;computer&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;topn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;word&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;similar_words&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;word&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output might look something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;software     0.78
technology   0.76
device       0.73
machine      0.71
internet     0.69
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The actual results depend on the particular pretrained model and the data it learned from.&lt;/p&gt;

&lt;p&gt;The important part for me is understanding what the similarity score represents. It gives us an indication of how close two words are in the learned vector space.&lt;/p&gt;

&lt;p&gt;Word embeddings can also be used for &lt;strong&gt;word analogies&lt;/strong&gt;. A well-known example is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;king - man + woman ≈ queen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What interested me here is that the model is not being given a rule saying "king relates to queen in this way." Instead, relationships can emerge from the patterns learned from large amounts of text.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Found Difficult
&lt;/h2&gt;

&lt;p&gt;The most difficult part for me was understanding what each individual number in a word vector actually means.&lt;/p&gt;

&lt;p&gt;At first, I thought that each dimension might have an obvious meaning. For example, I imagined that one number could represent whether a word was an animal, another could represent whether it was a person, and so on.&lt;/p&gt;

&lt;p&gt;But that is not really how it works.&lt;/p&gt;

&lt;p&gt;The information is distributed across the dimensions of the vector, which makes the representation useful but not always easy for humans to interpret.&lt;/p&gt;

&lt;p&gt;This was one of the things I found most interesting because it showed me that a machine learning model can learn useful patterns even when those patterns are not represented in a way that is easy for us to explain dimension by dimension.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Took Away
&lt;/h2&gt;

&lt;p&gt;My biggest takeaway from studying word embeddings is that &lt;strong&gt;the way we represent language matters&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A computer does not understand words in the same way humans do. We need to convert language into a form that a model can work with. Word embeddings provide a way to represent words as numbers while still preserving useful information about relationships between words.&lt;/p&gt;

&lt;p&gt;Word2Vec made this idea clearer to me because it learns from context. The model looks at how words are used and learns representations from those patterns.&lt;/p&gt;

&lt;p&gt;Reading the &lt;em&gt;Dive into Deep Learning&lt;/em&gt; material also helped me see that Word2Vec is only one part of the bigger picture of NLP. There are other approaches, including GloVe and subword embeddings, and modern NLP systems have developed much further.&lt;/p&gt;

&lt;p&gt;For me, the most important lesson is that NLP is not simply about giving text to a model. &lt;strong&gt;How we represent the text can have a major impact on what the model is able to learn.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Reference
&lt;/h3&gt;

&lt;p&gt;Zhang, A., Lipton, Z. C., Li, M., &amp;amp; Smola, A. J. &lt;em&gt;Dive into Deep Learning&lt;/em&gt;. Natural Language Processing: Pretraining — Word Embedding (word2vec). &lt;a href="https://d2l.ai/chapter_natural-language-processing-pretraining/word2vec.html" rel="noopener noreferrer"&gt;https://d2l.ai/chapter_natural-language-processing-pretraining/word2vec.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nlp</category>
      <category>machinelearning</category>
      <category>python</category>
      <category>embeddedword</category>
    </item>
  </channel>
</rss>
