<?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: Danil'</title>
    <description>The latest articles on DEV Community by Danil' (@dshy).</description>
    <link>https://dev.to/dshy</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%2F4084289%2F199d9e94-a591-4d6f-a891-35ad4f74b2f2.jpg</url>
      <title>DEV Community: Danil'</title>
      <link>https://dev.to/dshy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dshy"/>
    <language>en</language>
    <item>
      <title>Tokens: How Machines Break Language into Pieces</title>
      <dc:creator>Danil'</dc:creator>
      <pubDate>Fri, 28 Aug 2026 14:58:09 +0000</pubDate>
      <link>https://dev.to/dshy/tokens-how-machines-break-language-into-pieces-f2m</link>
      <guid>https://dev.to/dshy/tokens-how-machines-break-language-into-pieces-f2m</guid>
      <description>&lt;p&gt;Hello ♦&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Central idea of the article: How does a machine turn human language into something it can actually process? Tokenization doesn't teach a machine what language means. It gives language a structure that a machine can process mathematically.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Reading time:  7-10 minutes&lt;/p&gt;




&lt;h4&gt;
  
  
  What's the problem? A computer doesn't see words the way we do
&lt;/h4&gt;

&lt;p&gt;What do you see and feel when you read the sentence:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;I like the JDM vibe.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Maybe you imagine the aesthetics of 1990s Japan, cool cars, &lt;em&gt;The Fast and the Furious&lt;/em&gt;, and all that. You can build a mental image of the sentence and somehow &lt;em&gt;feel&lt;/em&gt; what it means.&lt;/p&gt;

&lt;p&gt;A language model, however, can't form such an image in the same way we do. It doesn't perceive words the way we do. For a language model, raw text is not yet a convenient mathematical representation.&lt;/p&gt;

&lt;p&gt;To the model, the raw text is just a wall of symbols.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq15rgh9n57aitpvuu9ll.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq15rgh9n57aitpvuu9ll.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  From Text to Something a Machine Can Process
&lt;/h4&gt;

&lt;p&gt;In my article about vectors, I talked about how data can be represented mathematically.&lt;/p&gt;

&lt;p&gt;For example, we can describe an apartment with a vector:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;x = [45, 1, 6, 1]&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;45&lt;/strong&gt; — area;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; — number of rooms;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;6&lt;/strong&gt; — floor;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;1&lt;/strong&gt; — distance from the city center;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwxl16qy1asxgbjaj0sc9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwxl16qy1asxgbjaj0sc9.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We decided ourselves which characteristics were important and turned them into numbers. With text, things get more complicated.&lt;/p&gt;

&lt;p&gt;For machine learning algorithms to work with text mathematically, we need to convert it into a numerical representation. But how can we turn abstract text into numbers without losing its meaning?&lt;/p&gt;

&lt;p&gt;The answer lies in &lt;strong&gt;tokenization&lt;/strong&gt; — the first and one of the key steps in how modern LLMs process text.&lt;/p&gt;

&lt;p&gt;What is a token?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A &lt;strong&gt;token&lt;/strong&gt; is a unit of text that a model treats as an element of its input sequence.&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;p&gt;&lt;em&gt;&lt;strong&gt;['I', ' like', ' the', ' JDM', ' vibe', '.']&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here, each element of the list is a token.&lt;/p&gt;

&lt;p&gt;But there's an important thing to keep in mind: &lt;strong&gt;a token is not necessarily a word.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example, the same sentence could, in principle, be split like this:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;['I', 'lik', 'e', ' the', ' J', 'DM', ' vi', 'be', '.']&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The exact way text is split depends on the tokenizer and its vocabulary.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why not simply use words?
&lt;/h4&gt;

&lt;p&gt;At first glance, it seems logical to use:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;one word = one token&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this approach, we create a vocabulary that our tokenizer can look up, where each word is assigned its own ID.&lt;/p&gt;

&lt;p&gt;But language is enormous. People constantly create new words, use names, technical terms, slang, abbreviations, typos, and different forms of the same word. This means we'd need to store an enormous number of words in the vocabulary, which is impractical.&lt;/p&gt;

&lt;p&gt;So a natural idea emerges:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Maybe we don't need to store every possible word. Maybe we can split words into smaller, reusable pieces.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Words are not always the smallest useful units
&lt;/h4&gt;

&lt;p&gt;As we saw earlier:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;['I', ' lik', 'e', ' the', ' J', 'DM', ' vi', 'be', '.']&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We can use smaller parts of words — recurring fragments of text.&lt;/p&gt;

&lt;p&gt;These fragments don't necessarily correspond to linguistic morphemes. Their purpose is not to be "correct parts of a word", but to serve as useful units for representing text.&lt;/p&gt;

&lt;p&gt;This allows a model to process words and sequences that it has never encountered as whole tokens by combining smaller pieces that are already in its vocabulary.&lt;/p&gt;

&lt;p&gt;But there are several other ways to split words into tokens.&lt;/p&gt;

&lt;h4&gt;
  
  
  Three ways to tokenize text
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3wx4ag3yhfoz0w56683e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3wx4ag3yhfoz0w56683e.png" alt=" " width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The most practical approach is &lt;strong&gt;subword-based tokenization&lt;/strong&gt;, which is why modern language models typically use different variants of subword tokenization.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tokenizer
&lt;/h3&gt;

&lt;p&gt;Now we have a separate component — the &lt;strong&gt;tokenizer&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Very roughly, its job can be illustrated like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftamzw2wgu4ukrqdnu09s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftamzw2wgu4ukrqdnu09s.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's important to understand:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A tokenizer is not a language model.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A tokenizer doesn't try to reason about a sentence or answer the user's question. It performs a much more specific task: &lt;strong&gt;converting text into tokens&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In other words, it turns text into a sequence of discrete units.&lt;/p&gt;

&lt;h4&gt;
  
  
  But tokens are still not numbers
&lt;/h4&gt;

&lt;p&gt;We have:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;['I', ' like', ' the', ' JDM', ' vibe', '.']&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But a neural network needs numerical data. That's why the tokenizer uses a special dictionary called a &lt;strong&gt;vocabulary&lt;/strong&gt;. Each token is assigned a specific identifier:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I&lt;/strong&gt; → 52&lt;br&gt;&lt;br&gt;
&lt;strong&gt;_like&lt;/strong&gt; → 58&lt;br&gt;&lt;br&gt;
&lt;strong&gt;_the&lt;/strong&gt; → 7005&lt;br&gt;&lt;br&gt;
&lt;strong&gt;_JDM&lt;/strong&gt; → 786&lt;br&gt;&lt;br&gt;
&lt;strong&gt;_vibe&lt;/strong&gt; → 5&lt;br&gt;&lt;br&gt;
&lt;strong&gt;.&lt;/strong&gt; → 4&lt;/p&gt;

&lt;p&gt;Now we've finally turned text into numbers. But this is where a very important trap appears.&lt;/p&gt;

&lt;h4&gt;
  
  
  A token ID is just an ID
&lt;/h4&gt;

&lt;p&gt;Let's look at two tokens:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JDM → 9231&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;vibe → 2711&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Can we say that "JDM" and "vibe" are similar because:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;|9231 − 2711| = 6520&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;And can we say that their numerical IDs tell us anything about their semantic relationship?&lt;/p&gt;

&lt;p&gt;Also no.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A token ID is just an identifier.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It answers the question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Which token is this?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But it doesn't answer the question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What does this token mean?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now we can see the complete pipeline:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"I like the JDM vibe" → ["I", " like", " the", " JDM", " vibe"] → [40, 1093, 279, 41723, 215]&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And that's what the process of converting text into numbers looks like!&lt;/p&gt;




&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;I hope you found something useful here.&lt;/p&gt;

&lt;p&gt;My vibe today:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frtjwsj3evwkh8d3ubc3k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frtjwsj3evwkh8d3ubc3k.png" alt=" " width="800" height="788"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Vectors in Machine Learning: More Than Just Lists of Numbers</title>
      <dc:creator>Danil'</dc:creator>
      <pubDate>Fri, 21 Aug 2026 09:19:07 +0000</pubDate>
      <link>https://dev.to/dshy/vectors-in-machine-learning-more-than-just-lists-of-numbers-2e6g</link>
      <guid>https://dev.to/dshy/vectors-in-machine-learning-more-than-just-lists-of-numbers-2e6g</guid>
      <description>&lt;p&gt;Hello ♦&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Central idea of the article: Machine learning works with data represented as numbers. Linear algebra gives us a language for reasoning about those numbers as geometric objects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Reading time  10 minutes&lt;/p&gt;




&lt;p&gt;The simplest data can be represented by a single number:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;&lt;em&gt;speed&lt;/em&gt;&lt;/strong&gt; of a car&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;&lt;em&gt;number&lt;/em&gt;&lt;/strong&gt; of disks&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;&lt;em&gt;mass&lt;/em&gt;&lt;/strong&gt; of a compressor&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnnm3mjr39ht2x8lamot4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnnm3mjr39ht2x8lamot4.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But why do we need to represent data as numbers? Obviously, to answer our questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How long will it take me to get from point A to point B?&lt;/li&gt;
&lt;li&gt;What is the maximum number of disks that can fit in a box?&lt;/li&gt;
&lt;li&gt;Will I be able to carry this compressor by myself?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You ask yourself questions like these every day, and numbers help you answer them and make the right decisions, so you don't have to suffer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally, I can get &lt;em&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/em&gt; hours of sleep because I'll get there &lt;em&gt;&lt;strong&gt;quickly&lt;/strong&gt;&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;So I need to buy &lt;em&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;/em&gt; disks — I can't fit any more in the box.&lt;/li&gt;
&lt;li&gt;I don't want to &lt;em&gt;&lt;strong&gt;strain my back&lt;/strong&gt;&lt;/em&gt;, so I'll ask Kamil to help me.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But what if we want to describe an object as a whole, rather than just its individual characteristics? For example, to estimate its value, efficiency, or something else.&lt;/p&gt;

&lt;p&gt;Let's consider some characteristics of a car:&lt;/p&gt;

&lt;p&gt;For example: mass = 1,500 kg, power = 200 hp, speed = 220 km/h.&lt;/p&gt;

&lt;p&gt;We could store these as three separate numbers, but then we lose the idea that these three values describe the same object.&lt;/p&gt;

&lt;p&gt;This leads to a natural idea: &lt;strong&gt;combine several numbers into a single structure.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A simple real-life analogy is a pencil case. People invented pencil cases to keep everything they need for studying in one place — from pencils to scissors. If we know we'll need scissors, pens, and pencils, we put them all in a pencil case rather than scattering them across separate pockets of a backpack.&lt;/p&gt;

&lt;p&gt;In a similar way, something happened with data: several related numbers came to be treated as a single mathematical object — ♦ &lt;strong&gt;a vector&lt;/strong&gt; ♦.&lt;/p&gt;

&lt;h3&gt;
  
  
  ♦ Vector ♦
&lt;/h3&gt;

&lt;p&gt;Originally, vectors did not exist as a separate mathematical concept. People worked with scalars — plain numbers. But as physics began to develop, scientists encountered quantities that had not only a magnitude, but also a direction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjo9xkjqazgetrevnmxvv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjo9xkjqazgetrevnmxvv.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;17th century (René Descartes):&lt;/strong&gt; He connected geometry with algebra by introducing the Cartesian coordinate system. A point in space could now be represented by a set of numbers: (x, y, z) in three-dimensional space and (x, y) in two-dimensional space. The coordinate system made it possible to represent the geometry of an object as a set of numbers.&lt;/p&gt;

&lt;p&gt;In other words, we can turn an object or its properties into a numerical representation.&lt;/p&gt;

&lt;h4&gt;
  
  
  Apartments:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fso4bn1ava1v8lwo9fuan.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fso4bn1ava1v8lwo9fuan.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's say we have two apartments that we rent out to tourists visiting the city. We also know that our friend Tomi, who owns 25 apartments, has no trouble renting out any of them.&lt;br&gt;
We'd like to understand why only one of our apartments is profitable — what's wrong with the other one?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apartment A&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Area: 35 m²&lt;/li&gt;
&lt;li&gt;2 rooms&lt;/li&gt;
&lt;li&gt;5th floor&lt;/li&gt;
&lt;li&gt;5 km from the city center&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Apartment B&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Area: 50 m²&lt;/li&gt;
&lt;li&gt;1 room&lt;/li&gt;
&lt;li&gt;2nd floor&lt;/li&gt;
&lt;li&gt;3 km from the city center&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Approximate characteristics of Tomi's apartments:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apartment B&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Area: 45 m²&lt;/li&gt;
&lt;li&gt;1 room&lt;/li&gt;
&lt;li&gt;6th floor&lt;/li&gt;
&lt;li&gt;1 km from the city center&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And there are approximately 25 apartments with similar characteristics.&lt;/p&gt;

&lt;p&gt;Let's try to represent all of this as a mathematical structure that describes the object as a whole — &lt;strong&gt;a vector&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;x_{1} = [35, 2, 5, 5]&lt;br&gt;
x_{2} = [50, 1, 2, 3] &lt;br&gt;
x_{3} = [45, 1, 6, 1]&lt;br&gt;
...&lt;br&gt;
x_{25} = [49, 1, 5, 1.2] &lt;/p&gt;

&lt;p&gt;We think about it, discuss it with our wife, and realize that people want to live closer to the city center so they can be closer to the city's main attractions. Tourists also generally don't need a lot of space. In other words, they don't need a two- or three-room apartment. For a family of three or four, a one-bedroom apartment is usually a perfectly acceptable option.&lt;/p&gt;

&lt;p&gt;Assuming that the key factors are &lt;strong&gt;the apartment's size&lt;/strong&gt; and &lt;strong&gt;its distance from the city center&lt;/strong&gt;, let's plot a graph with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;the &lt;strong&gt;x-axis&lt;/strong&gt; representing the apartment's area;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the &lt;strong&gt;y-axis&lt;/strong&gt; representing the distance from the city center.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn0lfbq2fifgoy2779dag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn0lfbq2fifgoy2779dag.png" alt=" " width="800" height="608"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking at a large amount of data in the form of lists, it's difficult to tell how far our apartments are from the ideal profile.&lt;/p&gt;

&lt;p&gt;Based on the two features we selected, &lt;strong&gt;Apartment B is closer to the typical profile of Tomi's apartments&lt;/strong&gt;. We should probably sell &lt;strong&gt;Apartment A&lt;/strong&gt; altogether, since it isn't a good fit for short-term rentals to tourists. It would be better suited for &lt;strong&gt;long-term rentals&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;In the 19th century, the ideas of &lt;strong&gt;vector calculus&lt;/strong&gt; developed further, particularly through the work of William Hamilton, Hermann Grassmann, James Clerk Maxwell, and other mathematicians and physicists.&lt;/p&gt;

&lt;p&gt;A vector was no longer just a pair of numbers or a point in space [3, 5]. It became an object that could be operated on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;addition;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;subtraction;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;multiplication by a scalar;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;dot product;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;calculating its magnitude;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;determining its direction.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;In other words, a vector turned out to be a convenient way to represent the structure and relationships between numerical quantities.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This means that we can do more than simply represent points in space, as we did with the apartments.&lt;/p&gt;

&lt;p&gt;For example, we have created a visual representation showing where our apartments are located.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6n7ixmpsshmm0ktwf55f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6n7ixmpsshmm0ktwf55f.png" alt=" " width="800" height="608"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But it would be useful to know the exact numbers — how different are our apartments?&lt;/p&gt;

&lt;p&gt;This is one of the advantages of vectors: we can calculate the differences easily and get the complete picture:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;visual representation + precise numbers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's calculate the average values for Tomi's apartments:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;44.48&lt;/strong&gt; — average area&lt;br&gt;&lt;br&gt;
&lt;strong&gt;1.12&lt;/strong&gt; — average distance from the city center&lt;/p&gt;

&lt;p&gt;Now let's compare our apartments with Tomi's average:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Apartment A:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;35 − 44.48 = &lt;strong&gt;−9.48 m²&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
5 − 1.12 = &lt;strong&gt;3.88 km&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Apartment B:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;50 − 44.48 = &lt;strong&gt;5.52 m²&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
3 − 1.12 = &lt;strong&gt;1.88 km&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The minus sign in the first case simply shows where Apartment A's area lies relative to the average area.&lt;/p&gt;

&lt;p&gt;Now let's visualize this average so that we can focus on a single object that represents all of Tomi's apartments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8ikmmt9mt13lpex3izfn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8ikmmt9mt13lpex3izfn.png" alt=" " width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ideally, we want to buy apartments whose characteristics are as close as possible to the green point.&lt;/p&gt;

&lt;p&gt;Analytically, we can calculate which apartment is closer to the green point:&lt;/p&gt;

&lt;p&gt;Apartment A: &lt;strong&gt;A = [35, 5]&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Apartment B: &lt;strong&gt;B = [50, 3]&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Average apartment: &lt;strong&gt;C = [44.48, 1.12]&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can calculate the distance:&lt;br&gt;
$d(A,C)=\sqrt{(35−44.48)^{2}+(5−1.12)^{2}​}$&lt;br&gt;
$d(B,C)=\sqrt{(50−44.48)^{2}+(3−1.12)^{2}}​$&lt;/p&gt;

&lt;p&gt;And if we can measure the distance between apartments, why not measure the distance between texts? Images? Users? Products? This could help us understand how similar they are.&lt;/p&gt;

&lt;p&gt;I think you've already noticed that the mathematical framework allows us to work not only with 2D or 3D vectors, but with &lt;strong&gt;n-dimensional vectors&lt;/strong&gt; as well. This is one of the biggest advantages of vectors: we can represent and analyze vectors with as many numbers as we need — or as many as our technical constraints allow.&lt;/p&gt;

&lt;p&gt;This means we can represent almost anything. From pixels to chemical structures.&lt;/p&gt;

&lt;p&gt;But there's an important point we need to stop and think about.&lt;/p&gt;

&lt;p&gt;We don't simply turn an object into numbers. &lt;strong&gt;We create a representation of that object, and the quality of this representation matters enormously.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For example, we could represent an apartment like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[50, 2, 7, 1.5]&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Or like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[2, 50, 7, 1.5]&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But if the order of the features hasn't been defined beforehand, this vector is meaningless.&lt;/p&gt;

&lt;p&gt;What I mean is that &lt;strong&gt;the numbers inside a vector don't mean anything by themselves&lt;/strong&gt;. Their meaning comes from what each position represents. A vector only makes sense when we define what each dimension represents.&lt;/p&gt;

&lt;p&gt;Or, in more mathematical terms:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A number by itself has no meaning until we fix a &lt;strong&gt;basis&lt;/strong&gt; — what each axis of the space represents.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The hardest part is often not doing mathematics on data. It is deciding what the data should look like mathematically.&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  ML
&lt;/h4&gt;

&lt;p&gt;ML uses vectors not just as convenient containers for numbers.&lt;/p&gt;

&lt;p&gt;In human terms:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Let's represent each object as a point in space and try to find patterns in how these points are arranged.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm8r7ok5if62auraosp1c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm8r7ok5if62auraosp1c.png" alt=" " width="800" height="846"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, as shown in the figure, let's try to determine which object represents text, which represents a number, and which represents sound.&lt;/p&gt;

&lt;p&gt;In other words, we encode the properties of an object as an &lt;strong&gt;ordered set of numbers — its coordinates&lt;/strong&gt;. This turns the object into a point in a multidimensional space. Machine learning algorithms can then look for &lt;strong&gt;spatial relationships&lt;/strong&gt;: distances between points, clusters, angles, and directions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The important idea behind vectors isn't that they store numbers. It's that they allow us to turn objects into points in a mathematical space where we can measure relationships between them.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;I hope you found something useful here.&lt;/p&gt;

&lt;p&gt;I’d describe my vibe today with this picture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyk1fz7k9hmncn7o8l291.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyk1fz7k9hmncn7o8l291.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>machinelearning</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
