<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ghilth GBAGUIDI on Medium]]></title>
        <description><![CDATA[Stories by Ghilth GBAGUIDI on Medium]]></description>
        <link>https://medium.com/@ghilthg?source=rss-b250a1fac7ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tOhJVNiIepHRwejC</url>
            <title>Stories by Ghilth GBAGUIDI on Medium</title>
            <link>https://medium.com/@ghilthg?source=rss-b250a1fac7ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 03:59:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ghilthg/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Comprendre le Bag of Words et ses dérivés]]></title>
            <link>https://medium.com/@ghilthg/comprendre-le-bag-of-words-et-ses-d%C3%A9riv%C3%A9s-fc0e4c724b8f?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc0e4c724b8f</guid>
            <category><![CDATA[embedding]]></category>
            <category><![CDATA[bm25]]></category>
            <category><![CDATA[bag-of-words]]></category>
            <category><![CDATA[ngrams]]></category>
            <category><![CDATA[tf-idf]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 03:02:16 GMT</pubDate>
            <atom:updated>2026-03-12T03:02:16.640Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7lSzmT5duxilDtklCjmHaQ.png" /></figure><p>Dans le monde de l’Intelligence Artificielle, nous avons vu plusieurs types de modèles évoluer au fil des années.</p><p>Nous avons commencé par des modèles <strong>non-transformers </strong>comme le <strong><em>« Bag-of-Words »</em></strong>, qui sont plus techniques et fondamentaux.</p><p>Puis est venue l’ère des Transformers :<br><strong> Modèles Encoder-only :</strong> Spécialisés dans la représentation mathématique des mots (compréhension du langage).<br><strong> Modèles Decoder-only :</strong> Spécialisés dans la génération de texte (comme GPT).<br><strong> Modèles Encoder-Decoder :</strong> Capables de faire les deux.</p><p>Les données textuelles étant <strong>« non structurées »</strong>, elles sont difficiles à analyser directement pour les ordinateurs. Pour remédier à cela, ont établit des règles mathématiques pour représenter le texte de manière numérique.</p><p>L’une des toutes premières méthodes pour cette représentation est le<strong> Bag-of-Words (BoW) ou « Sac de mots ».</strong></p><h3>Comment ça marche ?</h3><p>Prenons un exemple concret en utilisant ce petit corpus de texte :<br> « I am a handsome boy. And I also have a handsome bike. »</p><h4>Étape 1 : La tokenisation</h4><p>Tokeniser un texte signifie le découper en petits morceaux appelés tokens. Un token peut être un mot ou une séquence de caractères. Ici, nous allons diviser le texte par mots :<br> I — am — a — handsome — boy / And — I — also — have — a — handsome — bike</p><h4>Étape 2 : Construction du vocabulaire</h4><p>Le vocabulaire est la collection de mots uniques trouvés dans l’ensemble de notre corpus. Dans notre cas, le vocabulaire est :<br> I — am — a — handsome — boy — And — also — have — bike</p><h4>Étape 3 : La vectorisation</h4><p>La vectorisation est le processus de transformation d’un document en une séquence de nombres (un vecteur).</p><p>Pour ce faire, nous prenons chaque phrase et la comparons à notre vocabulaire. Si un mot du vocabulaire est présent dans la phrase, nous le représentons par un 1. S’il est absent, nous utilisons un 0.</p><p><strong>Phrase 1 :</strong> « I am a handsome boy »</p><p>I | am | a | handsome | boy | And | also | have | bike</p><p>1 | 1 | 1 |1 | 1 | 0 | 0 | 0 | 0</p><p><strong>Phrase 2 : </strong>« And I also have a handsome bike »</p><p>I | am | a | handsome | boy | And | also | have | bike</p><p>1 | 0 | 1 | 1 | 0 | 1 | 1 |1 | 1</p><h3>Le résultat</h3><p>Nous avons maintenant une représentation numérique de notre texte qu’un ordinateur peut traiter :</p><p>Phrase 1 : [1, 1, 1, 1, 1, 0, 0, 0, 0]<br>Phrase 2 : [1, 0, 1, 1, 0, 1, 1, 1, 1]</p><p>Comme vous pouvez le voir, chaque séquence de chiffres correspond à une phrase.</p><p>Cependant, remarquez une chose : avec cette méthode, bien que l’ordre du vocabulaire soit important pour le vecteur, l’ordre contextuel des mots dans la phrase est perdu.</p><p>C’est là tout le sens du « Sac » dans Bag-of-Words : on jette tout dans un sac et on compte ce qu’il y a à l’intérieur !</p><h3>À quoi sert concrètement le Bag-of-Words ?</h3><p>Voici quelques applications majeures du BoW :</p><h4>Détection de spams</h4><p>C’est l’usage le plus classique. Un algorithme regarde si des mots comme <em>“argent”</em>, <em>“gratuit</em>” ou <em>“offre”</em> apparaissent souvent.</p><p>S’ils sont présents en grand nombre, l’email est classé comme spam.</p><h4>Analyse de sentiment</h4><p>Pour trier des milliers d’avis clients, on compte les mots à forte charge émotionnelle.</p><p>Si <em>“excellent”</em> et <em>“rapide”</em> dominent, l’avis est positif. C’est simple, mais extrêmement rapide pour traiter de gros volumes de retours clients.</p><h4>Classification thématique</h4><p>Les sites de news utilisent le BoW pour classer automatiquement les articles.</p><p>Un texte contenant souvent les mots <em>“ballon”</em>, <em>“arbitre”</em> et <em>“score”</em> sera classé en <em>“Sport”</em>.</p><h3>Pourquoi le BoW ne suffit pas ?</h3><p>Malgré son efficacité, le Bag-of-Words présente quelques limites :</p><h4>L’indifférence à l’ordre</h4><p>Comme nous l’avons vu, il ne comprend pas l’ordre des mots. Pour lui, “Le chat mange la souris” est identique à “La souris mange le chat”.</p><h4>L’absence de sémantique</h4><p>Le BoW ne sait pas que “voiture” et “automobile” sont synonymes. Si votre dictionnaire contient “voiture”, il mettra un 0 pour le mot “automobile”.</p><h4>Les vecteurs creux (Sparsity)</h4><p>Si votre vocabulaire fait 10 000 mots, chaque phrase est représentée par une liste de 10 000 chiffres remplie de zéros. C’est un gaspillage de mémoire.</p><h3>Des algorithmes plus avancés</h3><p>Il existe des algorithmes plus évolués qui intègrent le BoW et qui viennent compenser ses limites.</p><h3>1- Le TF-IDF (Term Frequency-Inverse Document Frequency)</h3><p>Le Bag-of-Words est une méthode simple et efficace, mais elle a un défaut :</p><p>Pour le BoW, tous les mots sont égaux. Si le mot <em>“le”</em> apparaît 100 fois et le mot “<em>algorithme”</em> 5 fois, le modèle accordera mathématiquement plus d’importance au mot <em>“le”</em>.</p><p>Pourtant, c’est le mot <em>“algorithme”</em> qui porte le sens.</p><p>Le BoW est donc pollué par le bruit (les mots de liaison comme le, la, et, de) et échoue à représenter le véritable sens d’un document.</p><p>Le TF-IDF (Term Frequency-Inverse Document Frequency) a été inventé pour corriger cela. Son rôle est de pondérer les mots : donner un poids fort aux mots rares et significatifs, et un poids faible aux mots trop communs.</p><h3>Comment ça fonctionne ?</h3><p>Le TF-IDF est le résultat d’une multiplication entre deux scores. Prenons l’exemple d’un article sur l’histoire du roi Béhanzin au milieu d’une bibliothèque de 1 000 livres.</p><h4>Étape A : Le TF (Term Frequency)</h4><p>Le TF mesure la fréquence d’un mot dans un seul document. Plus un mot est présent, plus il est jugé important pour ce texte spécifique.</p><p><strong>Calcul :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*Q1CKxLmFpbp-VQGXTk6hmw.png" /></figure><p><strong>Exemple :</strong> Dans un article de 500 mots, le nom “Béhanzin” apparaît 10 fois. Son TF est de :</p><p>10/500=0,02</p><h4>Étape B : L’IDF (Inverse Document Frequency)</h4><p>L’IDF mesure la rareté d’un mot dans tout le corpus (votre bibliothèque).</p><p><strong>Calcul :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*6ED74C0Pxky0QIctsbJzgw.png" /></figure><p><strong>Cas du mot “Le” :<br></strong> Il est dans les 1 000 livres.</p><p>IDF=log⁡(1000/1000)=0</p><p>Le score s’annule.</p><p><strong>Cas du mot “Béhanzin” :<br></strong> Il n’est que dans 2 livres sur 1 000. Son score IDF sera très élevé.</p><h4>Le rôle du logarithme</h4><ul><li>Si un mot comme “le” est présent dans tous les documents, la fraction devient N/N=1. Or, log⁡(1)=0. Le score IDF tombe à zéro, annulant mathématiquement les mots inutiles.</li><li>Il empêche un mot ultra-rare d’avoir un poids démesuré. Au lieu d’avoir un score 1 000 000 de fois plus élevé, le logarithme ramène cet écart à une échelle gérable (par exemple, 6 au lieu de 1 000 000).</li></ul><h4>Étape C : Le score final TF-IDF</h4><p>On multiplie les deux :</p><p>Score = TF × IDF</p><h4>Le résultat</h4><p>Grâce au TF-IDF, l’ordinateur ne se contente plus de compter. Il distingue l’essentiel de l’accessoire. Il comprend que “Béhanzin” est le mot-clé qui définit un document, alors que “le” n’est qu’un outil grammatical sans valeur informative.</p><p>C’est cette capacité à prioriser l’information qui a permis aux premiers moteurs de recherche de devenir réellement performants.</p><p>Lorsque vous tapez une requête sur un moteur de recherche, l’algorithme :</p><ul><li>Calcule le score TF-IDF de vos mots-clés dans des millions de pages.</li><li>Classe les résultats : les pages où vos mots-clés ont le score TF-IDF le plus élevé remontent en premier.</li></ul><h3>2- Les N-grams</h3><p>Comme nous l’avons vu, le Bag-of-Words (BoW) traite les mots comme des unités totalement indépendantes (c’est ce qu’on appelle un unigram). Cette approche détruit la structure du langage.</p><h4>Le contresens de la négation</h4><p>Si vous écrivez <em>“Ce n’est pas bon”</em>, le BoW découpe <em>“pas”</em> et <em>“bon”.</em> Pour une IA de recommandation, le mot “bon” est positif. Elle risque donc de classer cet avis comme positif alors qu’il est l’inverse.</p><h4>La perte des entités</h4><p>Des concepts comme “Intelligence Artificielle” ou “République du Bénin” perdent leur sens s’ils sont découpés. “Intelligence” et “Artificielle” pris séparément ne décrivent pas la même chose.</p><p><strong>La solution :</strong> Au lieu de regarder un mot, on regarde une séquence de NNN mots.</p><h3>Comment ça fonctionne ?</h3><p>Le fonctionnement repose sur une “fenêtre” qui glisse sur la phrase et capture un groupe de mots à chaque étape. Le chiffre N détermine la taille de cette fenêtre.</p><p>Prenons la phrase :</p><p>“Le chat dort sur le tapis”</p><p><strong>Unigram (N=1)<br></strong> [“Le”, “chat”, “dort”, “sur”, “le”, “tapis”]</p><p><strong>Bigram (N=2)<br></strong> [“Le chat”, “chat dort”, “dort sur”, “sur le”, “le tapis”]</p><p><strong>Trigram (N=3)<br></strong> [“Le chat dort”, “chat dort sur”, “dort sur le”, “sur le tapis”]</p><p>L’une des applications les plus célèbres des N-grams est la prédiction du mot suivant (comme sur le clavier du smartphone ou dans la barre de recherche Google).</p><p>Comment ça marche ?</p><p>Le système analyse des milliards de textes et calcule des probabilités basées sur les N-grams.</p><p>Vous tapez:<br><strong> “Comment allez-…”</strong></p><p>Le système regarde ses trigrams commençant par “Comment allez”.</p><p>Il constate statistiquement que dans 90 % des cas, le mot qui suit est “vous”.</p><p>Il te suggère “vous” instantanément.</p><h3>3- BM25 : BM25 (Best Matching 25)</h3><p>Dans le TF-IDF classique, quand on a 100 fois le mot “IA” dans un document, le score est 100 fois plus élevé que s’il y était une seule fois.</p><p>Si un utilisateur cherche “Recette”, un document qui contient le mot 3 fois est beaucoup plus pertinent qu’un document qui le contient 0 fois.</p><p>Mais un document qui contient le mot 30 fois n’est pas forcément 10 fois plus pertinent que celui qui le contient 3 fois.</p><p><strong>La solution : </strong>le BM25 utilise un paramètre de saturation (k1​, généralement réglé entre 1.2 et 2.0). Il fait en sorte que le score augmente vite au début, puis plafonne.</p><p>Le TF-IDF a un autre biais : il favorise les documents longs car ils contiennent naturellement plus de mots.</p><p>Un article de 20 pages qui mentionne “Bénin” 10 fois est peut-être moins pertinent qu’un tweet de 10 mots qui mentionne “Bénin” 2 fois.</p><p><strong>La solution :</strong> le paramètre b (généralement 0.75) ajuste le score en fonction de la longueur du document par rapport à la longueur moyenne de tous les documents du corpus.</p><p>Si le document est plus long que la moyenne, on réduit son score.<br>S’il est plus court, on booste son score.</p><h4>Décomposition de la formule</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*IaCH7GGkoAF_0QurjNvT6A.png" /></figure><h4>Une application concrète : le moteur de recherche d’un site de news</h4><p>Sur un site comme Le Monde, un utilisateur tape “Élections”.</p><p><strong>Article A : </strong>Un flash info de 3 lignes qui contient 2 fois le mot “Élections”.<br><strong>Article B : </strong>Une archive immense de 50 pages sur l’histoire de la démocratie qui contient 25 fois le mot “Élections”.</p><p>Le TF-IDF va probablement ressortir l’article B en premier (score de fréquence brut plus élevé).</p><p>Le BM25 va détecter que l’article A est très court et que le mot-clé y est très dense. Grâce au paramètre b, il va propulser le flash info en tête des résultats.</p><p>En somme, le Bag-of-Words a posé les bases de l’IA en transformant le texte en vecteurs numériques, bien qu’il restait limité par son ignorance de l’ordre des mots et de la sémantique. Des algorithmes évolués comme le TF-IDF, les N-grams et le BM25 ont perfectionné ce modèle en apprenant à prioriser les mots-clés, à capturer des séquences de texte et à ajuster la pertinence selon la densité du contenu.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc0e4c724b8f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Words to Vectors: Understanding Bag of Words (BoW)]]></title>
            <link>https://medium.com/@ghilthg/from-words-to-vectors-understanding-bag-of-words-bow-2adb49c46729?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/2adb49c46729</guid>
            <category><![CDATA[bag-of-words]]></category>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[language-model]]></category>
            <category><![CDATA[vector-embeddings]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 04:48:24 GMT</pubDate>
            <atom:updated>2026-03-11T04:48:24.279Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7lSzmT5duxilDtklCjmHaQ.png" /></figure><p>In the world of Artificial Intelligence, we have seen several types of models evolve over the years. We started with <strong>non-transformer models</strong> like <em>“Bag-of-Words”,</em> which are more technical and foundational.</p><p>Then came the <strong>Transformer era </strong>:</p><ul><li><strong>Encoder-only models:</strong> Specialized in the mathematical representation of words (understanding).</li><li><strong>Decoder-only models:</strong> Specialized in generating text (like GPT).</li><li><strong>Encoder-Decoder models:</strong> Capable of doing both.</li></ul><p>Textual data is <em>“unstructured”</em>, which makes it difficult for computers to analyze directly. To fix this, we establish mathematical rules to represent text numerically.</p><p>One of the very first methods for this representation is the <strong>Bag-of-Words (BoW)</strong>.</p><h3>How does it work?</h3><p>Let’s look at a concrete example using this small corpus of text:</p><blockquote>“I am a handsome boy. And I also have a handsome bike.”</blockquote><h3>Step 1: Tokenization</h3><p>Tokenizing a text means cutting it into small pieces called <strong>tokens</strong>. A token can be a word or a sequence of characters. Here, we will split the text by words: I - am - a - handsome - boy And - I - also - have - a - handsome - bike</p><h3>Step 2: Building the Vocabulary</h3><p>The vocabulary is the collection of <strong>unique words</strong> found in our entire corpus. In our case, the vocabulary is: I - am - a - handsome - boy - And - also - have - bike</p><h3>Step 3: Vectorization</h3><p>Vectorizing is the process of transforming a document into a sequence of numbers (a vector). To do this, we take each sentence and compare it to our vocabulary. If a word from the vocabulary is present in the sentence, we represent it with a <strong>1</strong>. If it is absent, we use a <strong>0</strong>.</p><p><strong>Sentence 1:</strong> <em>“I am a handsome boy”</em></p><p>| I | am | a | handsome | boy | And | also | have | bike |</p><p>| 1 | 1| 1 | 1 | 1| 0 | 0 | 0| 0 |</p><p><strong>Sentence 2:</strong> <em>“And I also have a handsome bike”</em></p><p>| I | am | a | handsome | boy | And | also | have | bike |</p><p>| 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 |</p><h3>The Result</h3><p>We now have a numerical representation of our text that a computer can process:</p><ul><li><strong>Sentence 1:</strong> [1, 1, 1, 1, 1, 0, 0, 0, 0]</li><li><strong>Sentence 2:</strong> [1, 0, 1, 1, 0, 1, 1, 1, 1]</li></ul><p>As you can see, each sequence of numbers corresponds to a sentence. However, notice one thing: in this method, while the vocabulary order matters for the vector, the <em>contextual</em> order of the words in the sentence is lost.</p><p>This is the “Bag” in Bag-of-Words : we throw everything into a bag and count what’s inside!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2adb49c46729" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive into Python Function Arguments]]></title>
            <link>https://medium.com/@ghilthg/deep-dive-into-python-function-arguments-144366a6e07d?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/144366a6e07d</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[function-argument]]></category>
            <category><![CDATA[positional-argument]]></category>
            <category><![CDATA[arguments-keyword]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Tue, 08 Jul 2025 10:59:54 GMT</pubDate>
            <atom:updated>2025-07-08T11:39:31.376Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-wPdhnQfQU_huLn-1qWGw.png" /></figure><p>Python allows handling function arguments in several ways, each suited to specific situations. This article clearly details these different approaches.</p><h3>1. Positional Arguments</h3><h3>Definition</h3><p>Positional arguments are arguments passed to a function in the exact order in which the parameters were defined. The order of the arguments matters.</p><h3>Benefit in Development</h3><p>They enable quick calling of simple functions, where the argument order is intuitive.</p><h3>Examples</h3><pre>def multiply(a, b):<br>    return a * b<br><br>result = multiply(2, 3)  # a=2 (first argument), b=3 (second argument)</pre><pre>def introduce(first_name, last_name):<br>    print(f&quot;I am {first_name} {last_name}&quot;)<br><br>introduce(&quot;Alice&quot;, &quot;Smith&quot;)  # first_name=&quot;Alice&quot;, last_name=&quot;Smith&quot;ment)</pre><h3>2. Keyword Arguments</h3><h3>Definition</h3><p>Keyword arguments explicitly specify the name of each parameter during the function call.</p><h3>Benefit in Development</h3><p>This improves readability, especially for functions with many parameters or optional values.</p><h3>Examples</h3><pre>def send_message(recipient, message):<br>    print(f&quot;To: {recipient}, Message: {message}&quot;)<br>send_message(message=&quot;Hello&quot;, recipient=&quot;alice@mail.com&quot;)  # flexible and clear order</pre><pre>def register(name, age):<br>    print(f&quot;Name: {name}, Age: {age}&quot;)<br><br>register(age=28, name=&quot;Luke&quot;)  # explicit and flexible order</pre><h3>Difference Between Default Arguments and Keyword Arguments</h3><ul><li><strong>Default Arguments</strong>: Defined when creating the function, providing a default value if no other is supplied.</li><li><strong>Keyword Arguments</strong>: Method of calling a function by explicitly specifying each argument’s name during the call.</li></ul><h3>Clear Example</h3><pre>def greet(name, greeting=&quot;Hello&quot;):<br>    print(f&quot;{greeting}, {name}&quot;)<br><br><br>greet(&quot;Alice&quot;)  # greeting uses default value (Hello)<br>greet(name=&quot;Luke&quot;, greeting=&quot;Hi&quot;)  # explicit use of keyword arguments</pre><h3>Advanced Combination of Argument Types (since Python 3.8)</h3><p>Since Python 3.8, it is possible to explicitly define how arguments must be passed to a function:</p><pre>def example(a, b, /, c, *, d):<br>    print(a, b, c, d)<br><br>example(1, 2, c=3, d=4)  # valid</pre><ul><li>a and b: positional-only.</li><li>c: positional or keyword.</li><li>d: keyword-only.</li></ul><h3>3. Variadic Arguments: *args and **kwargs</h3><h3>Definition</h3><ul><li>*args allows a function to accept an unlimited number of positional arguments.</li><li>**kwargs allows a function to accept an unlimited number of named arguments (as a dictionary).</li></ul><h3>Benefit in Development</h3><p>They allow very flexible functions that dynamically adapt to various use cases.</p><h3>Educational Examples</h3><h4>Using *args</h4><pre>def sum_all(*args):<br>    total = 0<br>    for number in args:  # iterate through each positional argument<br>        total += number<br>    return total</pre><pre>print(sum_all(1, 2, 3))  # returns 6</pre><h4>Using **kwargs</h4><pre>def create_profile(**kwargs):<br>    for key, value in kwargs.items():  # iterate through each key-value pair<br>        print(f&quot;{key} : {value}&quot;)</pre><pre>create_profile(name=&quot;Alice&quot;, age=28, city=&quot;New York&quot;)  # dynamic parameters</pre><h3>🧠 Practical Summary</h3><ul><li><strong>Positional Arguments</strong>: Simple and fast.</li><li><strong>Keyword Arguments</strong>: Clear, flexible, suitable for multiple options.</li><li>*args: Suitable for <strong>variable number of positional arguments</strong> (collected as a tuple).</li><li>**kwargs: Suitable for dynamic options and varied configurations.</li></ul><h3>Final Note</h3><p>Mastering the different ways of handling function arguments in Python allows you to write cleaner, more expressive, and more adaptable code. Whether you’re designing simple utilities or robust APIs, understanding how to combine positional, keyword, default, and variadic arguments is an essential skill for every Python developer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=144366a6e07d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Can we really create artificial consciousness ?]]></title>
            <link>https://medium.com/@ghilthg/can-we-really-create-artificial-consciousness-0de62e007832?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/0de62e007832</guid>
            <category><![CDATA[consciousness]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[intelligence]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Mon, 05 May 2025 10:48:37 GMT</pubDate>
            <atom:updated>2025-05-05T10:48:37.420Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Can we really create artificial consciousness ?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ouPJXb49weTmbjiRR38UHw.png" /></figure><p><strong>Who has never dreamed of having a robot friend?</strong></p><p>A robot that could almost do everything : chat, play, work alongside us.</p><p>When I was a child, it was the definition of happiness for me.</p><p>Even today, figures like <strong>Sam Altman </strong>and <strong>Elon Musk</strong> continue to pursue this dream:<em> building artificial intelligences capable of accompanying us in our daily lives.</em></p><p>So, let’s ask the question: Is it really possible to create an artificial intelligence that develops its own consciousness?</p><p><strong>What is consciousness?</strong></p><p>In philosophical terms, consciousness is the ability to have a subjective experience. In other words:</p><ul><li>I don’t just do something, I know that I’m doing it.</li><li>I have an inner feeling: I perceive, I sense, I have a first-person point of view.</li></ul><p><strong>Let’s take a simple example:</strong> A camera can record an image. But it doesn’t know that it’s seeing something. You, however, do: you know that you’re looking.</p><p>Philosophers often distinguish three dimensions of consciousness:</p><ul><li><strong>Phenomenal consciousness (or sensory consciousness)</strong>: It refers to the subjective experience of perception, what we feel when we see, hear, touch, or taste something.</li><li><strong>Self-reflective consciousness (or reflective consciousness)</strong>: This form of consciousness goes beyond immediate experience to include the ability to reflect on oneself. It’s the awareness of one’s own mental state, thoughts, and emotions. It includes processes like the ability to ask questions such as, “Who am I?” or “Why did I think that?” It’s the form of consciousness that allows us to have a notion of ourselves as thinking subjects.</li><li><strong>Intentional consciousness (or action consciousness)</strong>: Intentional consciousness is the ability to have intentions and pursue them through actions. It refers to the ability to project oneself into the future, make decisions, and act according to goals or desires.</li></ul><p><strong>And what aout AIs today?</strong></p><p>Today, we have AI agents that simulate these forms of consciousness. They analyze the tasks we give them, evaluate their environment, and choose the appropriate tools.</p><p>This is how we have AIs that can code websites, solve math problems, or even create PowerPoint presentations.</p><p>But here’s the craziest part: These tools give us the illusion of understanding us. They express themselves like friends, use the pronoun “I,” and thanks to sensors, they seem to perceive the world and interact with it.</p><p>So, can we say that they are truly conscious?</p><p>Maybe… but in reality, we don’t know.</p><p>Currently, AIs are just programs that imitate us. They endlessly repeat cycles of operations, much like a spider weaving its web or an ant building its anthill. Even though they often appear more talented than us, they are merely expressing a form of programmed intelligence.</p><p>So no, AI is not conscious. It’s an excellent imitator… or perhaps an excellent actor.</p><p>In the end, whether they are conscious or not, what truly matters is what AI allows us to achieve:</p><ul><li>Automating repetitive, boring, or dangerous tasks for humans;</li><li>Boosting our productivity by optimizing our work processes;</li><li>Making human knowledge more accessible to all;</li><li>And most importantly, personalizing experiences.</li></ul><p>Of course, like any technology, AI comes with risks. It is therefore up to us to use it responsibly.</p><p>So, relax and set aside those apocalyptic scenarios where AI would seek to enslave humanity simply because it has<strong> “gained consciousness.”</strong></p><p>Just like flint, the hoe, writing, industri alization, or the internet, AI is a revolution that will transform the world.<strong> Africa must not miss this historic turning point.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0de62e007832" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Mini Photo Editor in Python with Gradio: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@ghilthg/build-a-mini-photo-editor-in-python-with-gradio-a-step-by-step-guide-13d9692ef454?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/13d9692ef454</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[gradio]]></category>
            <category><![CDATA[pillow]]></category>
            <category><![CDATA[machine-learning-ai]]></category>
            <category><![CDATA[photoeditingstyles]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Wed, 16 Oct 2024 06:29:53 GMT</pubDate>
            <atom:updated>2024-10-16T06:29:53.966Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-hKTfQ7WpOlk1ktLRtZOg.png" /></figure><p><strong>Have you ever wanted to create a simple photo editor ?</strong></p><p>With libraries like <strong>Pillow</strong> for image processing and <strong>Gradio</strong> for building user interfaces, it’s surprisingly easy to design an interactive tool that allows you to edit photos directly from your browser.</p><p>In this article, I’ll show you how to build a mini photo editor that can resize, rotate, and apply filters to your images.</p><p><strong>Why use Python and Gradio?</strong></p><p>Python is a popular language for image processing, thanks to libraries like <strong>Pillow</strong>. It offers a range of functions like resizing, rotating, and applying filters (blur, sharpen, contour, etc.).</p><p>Instead of coding a complex user interface, I used <strong>Gradio</strong>, which enables you to create a web interface with just a few lines of code. It’s perfect for quick prototypes and small interactive applications. In just a few minutes, you can launch your own photo editor right in your browser.</p><h3>Prerequisites</h3><p>Before getting started, make sure you have the following Python libraries installed:</p><pre>pip install gradio pillow</pre><h3>1. Photo Editor Features</h3><p>My photo editor offers several features that you can easily customize or extend:</p><ul><li><strong>Resize</strong>: Adjust the image’s size by setting the desired width and height.</li><li><strong>Rotate</strong>: Rotate the image by a specified angle.</li><li><strong>Filters</strong>: Apply different filters like blur, edge enhancement, smoothing, and embossing (3D effect).</li></ul><h3>2. The Project Code</h3><p>Here’s how you can implement these features:</p><pre>import gradio as gr<br>from PIL import Image, ImageFilter  <br><br># Function to resize the image<br>def resize_image(image, width, height):<br>    return image.resize((width, height))<br><br># Function to rotate the image<br>def rotate_image(image, angle):<br>    return image.rotate(angle)<br><br># Different filters to apply to the image<br>def edge_enhance(image):<br>    return image.filter(ImageFilter.EDGE_ENHANCE)<br><br>def sharpen(image):<br>    return image.filter(ImageFilter.SHARPEN)<br><br>def blur(image):<br>    return image.filter(ImageFilter.BLUR)<br><br>def smooth(image):<br>    return image.filter(ImageFilter.SMOOTH)<br><br>def contour(image):<br>    return image.filter(ImageFilter.CONTOUR)<br>                        <br>def emboss(image):<br>    return image.filter(ImageFilter.EMBOSS)<br><br><br><br><br># Main image processing function<br>def image_processing(image, operation, width=100, height=100, angle=0):<br>    if operation == &quot;Resize&quot;:<br>        return resize_image(image, width, height)<br>    elif operation == &quot;Rotate&quot;:<br>        return rotate_image(image, angle)<br>    elif operation == &quot;Edge enhance&quot;:<br>        return edge_enhance(image)<br>    elif operation == &quot;Sharpen&quot;:<br>        return sharpen(image)<br>    elif operation == &quot;Blur&quot;:<br>        return blur(image)<br>    elif operation == &quot;Contour&quot;:<br>        return contour(image)<br>    elif operation == &quot;Emboss&quot;:<br>        return emboss(image)<br>    elif operation == &quot;Smooth&quot;:<br>        return smooth(image)<br>    return image<br><br><br><br># Gradio UI<br>with gr.Blocks() as demo:<br>    gr.Markdown(&quot;## Photo Editor&quot;)<br>    <br>    with gr.Row():<br>        image_input = gr.Image(type=&quot;pil&quot;, label=&quot;Load Image&quot;)<br>        operation = gr.Radio([&quot;Resize&quot;, &quot;Rotate&quot;, &quot;Sharpen&quot;, &quot;Blur&quot;, &quot;Contour&quot;, &quot;Emboss&quot;, &quot;Smooth&quot;, &quot;Edge enhance&quot;], label=&quot;Operation&quot;)<br><br>        width = gr.Number(value=100, label=&quot;Resizing width&quot;, visible=True)<br>        height = gr.Number(value=100, label=&quot;Resizing height&quot;, visible=True)<br>        angle = gr.Number(value=0, label=&quot;Rotation degree&quot;, visible=True)<br><br>    image_output = gr.Image(label=&quot;Final Image&quot;)<br>    submit_button = gr.Button(&quot;Apply&quot;)<br>    submit_button.click(image_processing, inputs=[image_input, operation, width, height, angle], outputs=image_output)<br><br># Launch the app<br>demo.launch()</pre><h3>3. Explaining the Code</h3><p><strong>Loading and Manipulating Images</strong>:</p><p>Images are processed using the <strong>Pillow</strong> library. Functions like resize_image() and rotate_image() allow resizing and rotating images, while filters like sharpen() and blur() add special effects.</p><p><strong>User Interface with Gradio</strong>:</p><p><strong>Gradio</strong> makes it simple to create a web interface. The user can upload an image, choose an operation (such as rotation or resizing), and apply the changes with a simple button click.</p><p>The width, height, and angle fields allow users to adjust the size and orientation of the image for the resize and rotate operations.</p><p><strong>Filter Application</strong>:</p><p>Users can select different filters from the interface, such as <strong>Edge Enhance</strong>, <strong>Sharpen</strong>, <strong>Emboss</strong>, or <strong>Blur</strong>, and apply them directly to the image.</p><h3>4. How to Use It?</h3><p>Simply run the script, and Gradio will launch a web interface in your browser where you can:</p><ul><li>Upload an image.</li><li>Choose an operation (e.g., resizing, rotating, or applying a filter).</li><li>Adjust the parameters (like width, height, or angle).</li></ul><h3>5. Features to Add in the Future</h3><p>This project is easily extendable. Here are a few ideas for additional features:</p><ul><li><strong>More filters</strong>: You can explore other filters provided by Pillow.</li><li><strong>Color adjustments</strong>: Add options to adjust saturation, contrast, and brightness.</li><li><strong>Save the modified image</strong>: Allow users to download the edited image after applying the modifications.</li></ul><h3>Conclusion</h3><p>In less than 100 lines of code, you can create a functional mini photo editor that runs directly in the browser. <strong>Gradio</strong> simplifies the UI creation, and <strong>Pillow</strong> allows for advanced image manipulations.</p><p>If you enjoyed this tutorial and want to see more Python and Gradio projects, feel free to follow me for more exciting guides!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13d9692ef454" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[All about feature extraction in NLP]]></title>
            <link>https://medium.com/@ghilthg/lets-discover-the-secret-behind-the-words-a1e3665b6b5f?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1e3665b6b5f</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-extraction]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[feature-extraction]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Mon, 30 Sep 2024 02:43:02 GMT</pubDate>
            <atom:updated>2024-09-30T02:45:59.893Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*BGIO2cYc83szYSwGmXswqg.jpeg" /></figure><p>In the field of Natural Language Processing (NLP), feature extraction is a crucial step to convert textual data into numerical representations that can be processed by machine learning algorithms.</p><p>Once the data has been pre-processed <strong>(cleaned, tokenized, normalized, etc.)</strong>, the next question is: how do we transform raw text into numerical vectors that can be used to perform tasks like classification, named entity recognition, or sentiment analysis?</p><p>This article aims to detail the different methods of feature extraction in NLP, their advantages, limitations, and the use cases suited to each approach.</p><h3>1. What is Feature Extraction in NLP?</h3><p>Feature extraction is the process of extracting relevant information from raw textual data and representing it in a numerical form (vectors or matrices). These numerical representations are used as inputs for machine learning models. These features can be individual words, combinations of words, or even deeper contextual information such as semantic relationships between terms.</p><p>Since textual data is naturally unstructured, feature extraction is essential to provide a structured representation that machine learning algorithms, which operate on numerical data, can work with.</p><h3>2. Classical Methods of Feature Extraction</h3><p>Classical approaches primarily aim to convert text into vectors by capturing the presence, absence, or frequency of words in a corpus. Here are a few commonly used methods:</p><h4>2.1. Bag of Words (BoW)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*a41OX9CJBjEj8cWYVCw6iw.jpeg" /></figure><p>The Bag of Words (BoW) method is one of the simplest techniques. It represents a document as a “bag” of words, ignoring word order and context. Each unique word in the document is associated with a dimension in a vector, and the value of each dimension corresponds to the frequency of the word in the text.</p><p><strong>Advantages:</strong></p><ul><li>Simple to implement and understand.</li><li>Works well for basic tasks like text classification.</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Does not capture word order or context.</li><li>Can produce very large and uninformative vectors if the vocabulary is large.</li></ul><p><strong><em>Example:</em></strong><br>Two sentences:</p><p>“The cat eats the mouse.”</p><p>“The mouse eats the cheese.”</p><p>After BoW transformation (with simple frequency counts):</p><ul><li><strong>Sentence 1:</strong> [1, 1, 1, 1, 0] (cat, eats, mouse, the, cheese)</li><li><strong>Sentence 2:</strong> [0, 1, 1, 1, 1] (cat, eats, mouse, the, cheese)</li></ul><h4>2.2. TF-IDF (Term Frequency-Inverse Document Frequency)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*S7Z9MfDTaLq9ynWjJWq-Jg.jpeg" /></figure><p>TF-IDF is an improvement over BoW. It weights the frequency of a word based on its rarity in the corpus. The idea is to decrease the importance of common words (like “the”, “of”) and increase the importance of rarer, more meaningful words.</p><p>The formula is as follows:</p><h3><strong>TF-IDF(t,d)=TF(t,d)×log(N/DF(t))</strong></h3><p>The formula is as follows:</p><p>Where:</p><ul><li><strong>TF(t, d)</strong> is the term frequency of term t in document d,</li><li><strong>DF(t) </strong>is the document frequency of term t,</li><li>N is the total number of documents.</li></ul><p><strong>Advantages:</strong></p><ul><li>Considers the relevance of words in the corpus.</li><li>Helps reduce the impact of overly frequent words.</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Still ignores word context.</li><li>Less effective for very short phrases.</li></ul><p><strong>Example</strong>:<br>In the sentence “The cat eats the mouse,” if “eats” appears frequently in the corpus, its score will be lower than a rarer term like “mouse.”</p><h4>2.3. N-grams</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*ixtwkigJiHVAX1sIY35umQ.jpeg" /></figure><p>N-grams are sequences of N consecutive words extracted from the text. Unlike BoW, this method captures some notion of context by considering adjacent words. For example, with bigrams (N=2), we would extract word pairs like “cat eats”, “eats the”, “the mouse.”</p><p><strong>Advantages:</strong></p><ul><li>Captures local relationships between words, useful for certain classification tasks.</li><li>Allows for the inclusion of more complex expressions than individual words.</li></ul><p><strong>Disadvantages</strong>:</p><ul><li>The size of the vector increases rapidly with larger N.</li><li>Higher values of N may cause overfitting with small datasets.</li></ul><h3>3. Advanced Approaches: Word Embeddings and Contextualization</h3><p>Advanced approaches aim to capture richer semantic information by modeling word meanings and their relationships within a given context.</p><h4>3.1. Word Embeddings (Word2Vec, GloVe, FastText)</h4><p>Word embeddings are dense representations of words in a continuous space, where similar words (in terms of meaning) are placed closer to each other. Unlike frequency-based approaches, embeddings capture deep semantic relationships.</p><ul><li><strong>Word2Vec:</strong> Two main variants, Skip-gram and CBOW (Continuous Bag of Words), learn to predict words based on their context or predict the context based on a target word.</li><li><strong>GloVe:</strong> Based on global co-occurrence statistics across the corpus, it creates representations that take into account the global frequency statistics of words.</li><li><strong>FastText:</strong> An extension of Word2Vec that includes subword information, useful for morphologically rich languages and for capturing spelling variations.</li></ul><p><strong>Advantages:</strong></p><ul><li>Captures semantic relationships between words.</li><li>Vectors are much more compact than BoW or TF-IDF.</li><li>Suitable for many tasks such as text classification, machine translation, and sentiment analysis.</li></ul><p><strong>Disadvantages</strong>:</p><ul><li>Requires large corpora to be effective.</li><li>Does not capture the full context of entire sentences.</li></ul><p><strong><em>Example:</em></strong><br>With Word2Vec, words like “king” and “queen” will be close in the vector space, as will “man” and “woman.”</p><h4>3.2. Transformers (BERT, GPT)</h4><p>Transformers like BERT (Bidirectional Encoder Representations from Transformers) and GPT (Generative Pretrained Transformer) have revolutionized feature extraction in NLP. Unlike Word2Vec, these models generate dynamic representations where a word can have a different meaning depending on the context in which it is used.</p><ul><li>BERT: Captures bidirectional context (both before and after a given word), allowing for better understanding of complex sentences.</li><li>GPT: A generative model that predicts the next word in a sequence, useful for text generation tasks.</li></ul><p><strong>Advantages:</strong></p><ul><li>Captures the context of a word in a sentence.</li><li>Highly effective for various tasks such as text classification, question-answering, or translation.</li><li>Well-suited for fine-tuning on specific tasks.</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Computationally expensive and resource-intensive.</li><li>Often requires fine-tuning for specific tasks.</li></ul><h3>Conclusion</h3><p>Feature extraction is a crucial step in NLP pipelines. It converts raw textual data into numerical representations that can be processed by machine learning algorithms. From classical approaches like BoW and TF-IDF to advanced models like word embeddings and transformers, each method has its advantages and drawbacks depending on the context and goals. Mastering these techniques can greatly improve the performance of NLP models across a wide range of tasks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1e3665b6b5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to preprocess your datas for NLP projects ?]]></title>
            <link>https://medium.com/@ghilthg/do-you-have-an-nlp-project-heres-what-you-need-to-know-b0e5328cc12d?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0e5328cc12d</guid>
            <category><![CDATA[lemmatization]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[stop-word]]></category>
            <category><![CDATA[tokenization]]></category>
            <category><![CDATA[stemming]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Thu, 26 Sep 2024 06:06:32 GMT</pubDate>
            <atom:updated>2024-09-26T12:10:40.478Z</atom:updated>
            <content:encoded><![CDATA[<h3>Do you have an NLP project? Here’s what you need to know!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*-icwRYgXtrdiZ3qCl2jyfg.jpeg" /></figure><p><strong>Data preprocessing</strong> is a crucial step for the success of any natural language processing (NLP) project. This step prepares your dataset to be effectively understood and analyzed by the machine. Proper data preparation not only improves model performance but also saves time in later stages of your project.</p><p>Here are the key steps of data preprocessing, with explanations and practical examples!</p><h4>1. Stemming:</h4><p>Stemming involves reducing words to their root form, often without considering the actual meaning of the word. This method is faster and useful when you need to reduce lexical variability in large amounts of data, such as in information retrieval or text classification. However, it can sometimes produce imprecise results.</p><p><strong>Example:</strong></p><ul><li><em>connection, connected, connecting</em> → <strong>connect</strong></li><li><em>happily, happiness</em> → <strong>happi</strong></li></ul><p>⚙️ <strong>Use case:</strong> Stemming is used in systems like search engines, where it’s important to quickly index and retrieve multiple forms of the same word.</p><h4>2. Lemmatization:</h4><p>Unlike stemming, lemmatization considers the grammatical context to transform words into their base form (called a “lemma”). This method is more precise as it uses linguistic dictionaries. It is particularly useful for tasks where word meaning is important, such as sentiment analysis or text classification.</p><p><strong>Example:</strong></p><ul><li><em>mange, mangera, mangeaient</em> → <strong>manger</strong> (to eat)</li><li><em>cats</em> → <strong>cat</strong></li></ul><p>⚙️ <strong>Use case:</strong> Lemmatization is often preferred in more complex applications, like topic modeling, sentiment analysis, or named entity recognition, where semantic precision is required.</p><h4>3. StopWords Removal:</h4><p>Stopwords, like “the”, “and”, “a”, are very common in texts but do not provide much useful information for analysis. Removing these words helps reduce noise in the data and improve model performance.</p><p><strong>Example of StopWords in English:</strong> “the”, “a”, “and”, “in”, “on”, “at”.</p><p>⚙️ <strong>Use case:</strong> Stopwords removal is essential in applications where you want to focus on words with significant semantic weight, such as document classification or information retrieval.</p><h4>4. Tokenization</h4><p>Tokenization breaks the text into smaller units, like words, sentences, or even subwords. These “tokens” are then converted into numerical representations that machine learning or deep learning models can process.</p><p><strong>Example:</strong></p><ul><li>Sentence: <em>“Cats eat kibble.”</em><br><strong>Tokens:</strong> “Cats”, “eat”, “kibble.”</li></ul><p>⚙️ <strong>Use case:</strong> Tokenization is a fundamental step in almost every NLP project. It is essential to prepare texts for analysis by models such as neural networks or transformer-based models like BERT or GPT.</p><h4>5. Other important preprocessing steps:</h4><p>Here are some additional techniques that can improve data quality before analysis:</p><ul><li><strong>Text normalization:</strong> Converting all text to lowercase, removing punctuation, or handling special characters can help standardize the data and avoid errors in analysis.</li><li><strong>Removing duplicates:</strong> Eliminating repeated data helps avoid bias in results.</li></ul><h3>Conclusion</h3><p>Good data preprocessing is the key to maximizing the performance of your NLP project. Whether you’re working on a recommendation system, a chatbot, or sentiment analysis, these preparation steps will help transform your raw text into usable data. It’s important to adapt these techniques to your project and the nature of your data to achieve optimal results.</p><p>By following these steps, you’ll be ready to create more efficient and high-performing NLP models. Good luck with your project! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0e5328cc12d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We learn through mistakes… so does the machine!]]></title>
            <link>https://medium.com/@ghilthg/we-learn-through-mistakes-so-does-the-machine-cc5001c5921f?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc5001c5921f</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[classification]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Wed, 25 Sep 2024 09:35:22 GMT</pubDate>
            <atom:updated>2024-09-25T09:35:22.558Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*FDReGQumrNKk2C2FsbxpxA.jpeg" /></figure><p>As I mentioned yesterday, in NLP, the goal is to uncover the hidden mathematical relationships behind words.</p><p>By reading thousands of documents<strong> (datasets)</strong>, the machine is able to identify these relationships<strong> (models)</strong>.</p><p>Now, imagine you want to create your own AI system capable of guessing whether a song is sad or joyful based on its lyrics.</p><p>One way to proceed would be to gather the lyrics of several sad songs as well as several joyful ones.</p><p>Then, you will proceed to <strong>labeling</strong>: meaning you will indicate which songs are joyful (with the number 0) and which are sad (with the number 1).</p><p>Next comes the step of <strong>vectorization</strong>.</p><p>Here, the machine will transform the sentences from the songs into vectors, a numerical form that it can understand and analyze.</p><p>The machine’s task will then be to find a mathematical function <strong>f</strong> such that:</p><ul><li><strong><em>f(x) = 0 if x is the vector representing the lyrics of a joyful song,</em></strong></li><li><strong><em>f(x) = 1 if x is the vector representing the lyrics of a sad song.</em></strong></li></ul><p>This task performed by the machine is called <strong>classification</strong>.</p><p>At first, it won’t find the perfect function and will make mistakes.</p><p>But thanks to <strong>optimization algorithms</strong>, it will progressively improve until it discovers the function that correctly predicts whether a song is sad or joyful in most cases.</p><p>It’s important to note that <strong>prediction</strong> is when our AI can tell if a song is sad or joyful, based on the lyrics analyzed.</p><p>That’s all for today!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc5001c5921f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything is just numbers… even letters!]]></title>
            <link>https://medium.com/@ghilthg/everything-is-just-numbers-even-letters-f2bd8f93d3d5?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2bd8f93d3d5</guid>
            <category><![CDATA[dataset]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[nlp-algorithms]]></category>
            <category><![CDATA[model]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Tue, 24 Sep 2024 06:36:06 GMT</pubDate>
            <atom:updated>2024-09-24T06:36:06.666Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*Rgvg-PYAWOGwgvGyFMHngQ.jpeg" /></figure><p>Yes, for a machine, everything boils down to numbers. But then, how does it manage to understand what I’m asking?</p><p>Today, let’s dive a little deeper into the world of <strong>NLP (Natural Language Processing).</strong></p><p>In reality, the goal of NLP is to uncover the hidden mathematical relationships behind the arrangement of letters and words.</p><p><strong><em>Let me give you a concrete example:</em></strong></p><p>If I ask you to complete this sentence: <strong>“I eat …”</strong>, you could naturally complete it with <strong>“rice,” “corn,”</strong> or<strong> another food.</strong></p><p>Why? Because the verb <strong>“eat”</strong> pushes you to choose a word related to food.</p><p>However, you would make a mistake if you completed it with <strong>“stick” or “notebook.</strong>”</p><p>This shows that the presence of a word in a sentence is influenced by other words around it, and even by the context of previous sentences.</p><p>Our goal, then, will be to understand all these hidden relationships between words and sentences. These relationships are what we call <strong>models</strong>.</p><p>And for a machine to uncover these relationships, it needs to read a large number of texts, analyze millions of words, and understand the connections between them. This collection of texts is called a <strong>dataset</strong>.</p><p><strong>In summary:</strong> NLP allows machines to understand human language by discovering the patterns and hidden relationships behind our words.</p><p>See you tomorrow for the next part ⭐</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2bd8f93d3d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[    ,   !]]></title>
            <link>https://medium.com/@ghilthg/-8cf02407f115?source=rss-b250a1fac7ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cf02407f115</guid>
            <category><![CDATA[ai-in-daily-life]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[nlp-application]]></category>
            <category><![CDATA[artificial-intelligence-m]]></category>
            <dc:creator><![CDATA[Ghilth GBAGUIDI]]></dc:creator>
            <pubDate>Mon, 23 Sep 2024 08:30:48 GMT</pubDate>
            <atom:updated>2024-09-23T08:30:48.979Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*LBVLAcR6J8uO_axBHa-TaA.jpeg" /></figure><p>Whether you’re happy, sad, calm, or angry, your emotions are revealed through various signals: your facial expressions, the tone or timbre of your voice, and of course, the words you choose to express yourself.</p><p>But what’s even more fascinating is that, thanks to certain technologies, I can understand your emotions without even seeing or knowing you.</p><p>How is that possible?</p><p>𝐓𝐡𝐞 𝐚𝐧𝐬𝐰𝐞𝐫 𝐥𝐢𝐞𝐬 𝐢𝐧 𝐍𝐋𝐏 (Natural Language Processing), a branch of artificial intelligence that allows machines to understand and analyze human language.</p><p>It’s a set of technologies that have completely transformed our everyday lives.</p><p>Today, I invite you to discover some of its most impressive applications:</p><p>𝐓𝐨𝐱𝐢𝐜𝐢𝐭𝐲 𝐂𝐥𝐚𝐬𝐬𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧: This application detects and blocks hostile messages online (threats, insults, hate speech, etc.), making interactions safer.</p><p>𝐀𝐮𝐭𝐨𝐦𝐚𝐭𝐢𝐜 𝐓𝐫𝐚𝐧𝐬𝐥𝐚𝐭𝐢𝐨𝐧: You’ve probably used Google Translate. Thanks to NLP, it’s possible to instantly translate text from one language to another, facilitating international communication.</p><p>𝐍𝐚𝐦𝐞𝐝 𝐄𝐧𝐭𝐢𝐭𝐲 𝐑𝐞𝐜𝐨𝐠𝐧𝐢𝐭𝐢𝐨𝐧: This identifies proper names, places, or organizations within a text, which is extremely useful for summarizing articles or combating misinformation.</p><p>𝐒𝐩𝐚𝐦 𝐃𝐞𝐭𝐞𝐜𝐭𝐢𝐨𝐧: Using algorithms, services like Gmail classify unwanted emails and move them to the spam folder, streamlining inbox management.</p><p>𝐆𝐫𝐚𝐦𝐦𝐚𝐫 𝐂𝐨𝐫𝐫𝐞𝐜𝐭𝐢𝐨𝐧: Tools like Grammarly or Microsoft Word automatically correct grammar mistakes, improving the writing experience.</p><p>𝐓𝐞𝐱𝐭 𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐨𝐧 (𝐍𝐋𝐆): Imagine chatbots or autocomplete systems (like the ones you use on WhatsApp) capable of generating smooth, natural text, almost as if it had been written by a human.</p><p>These examples are just the tip of the iceberg. NLP is all around us and continues to change how we interact with machines and with each other.</p><p>𝐖𝐚𝐧𝐭 𝐭𝐨 𝐥𝐞𝐚𝐫𝐧 𝐦𝐨𝐫𝐞 𝐚𝐛𝐨𝐮𝐭 𝐡𝐨𝐰 𝐭𝐡𝐞𝐬𝐞 𝐭𝐞𝐜𝐡𝐧𝐨𝐥𝐨𝐠𝐢𝐞𝐬 𝐰𝐨𝐫𝐤? I’ll reveal more in my upcoming posts, so stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cf02407f115" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>