<?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 Ilyes Rezgui on Medium]]></title>
        <description><![CDATA[Stories by Ilyes Rezgui on Medium]]></description>
        <link>https://medium.com/@ilyesrezgui46?source=rss-d5646e6099cc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uirvgk_cGPX3r7WZD_3n9A.jpeg</url>
            <title>Stories by Ilyes Rezgui on Medium</title>
            <link>https://medium.com/@ilyesrezgui46?source=rss-d5646e6099cc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:50:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ilyesrezgui46/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[The COCO dataset: All you need to know]]></title>
            <link>https://medium.com/@ilyesrezgui46/the-coco-dataset-all-you-need-to-know-ae465c780bb5?source=rss-d5646e6099cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae465c780bb5</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[coco]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ml-so-good]]></category>
            <dc:creator><![CDATA[Ilyes Rezgui]]></dc:creator>
            <pubDate>Sun, 18 Feb 2024 15:34:43 GMT</pubDate>
            <atom:updated>2024-02-18T15:34:43.873Z</atom:updated>
            <content:encoded><![CDATA[<h4>Intorduction</h4><p>The computer vision research community relies on standardized datasets to assess the efficacy of novel models and enhancements to existing ones. These datasets function as universally applicable benchmarks, facilitating comparisons across different models. This methodology enables the evaluation of the relative effectiveness of various models, shedding light on their comparative performance.</p><p>In this article, we explore the Common Objects in Context (COCO) dataset, a prominent illustration of a benchmarking dataset widely employed in the computer vision research community.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/0*nz_h0N2V6l2A_Zbv" /><figcaption>Source : <a href="https://cocodataset.org/#home">COCO</a></figcaption></figure><p>Released by Microsoft in 2015, the MS COCO dataset is a comprehensive collection crafted for tasks such as object detection, image segmentation, and captioning. Esteemed across the fields of machine learning and computer vision, this dataset finds widespread adoption among experts undertaking diverse computer vision projects. In the realm of computer vision, a foundational goal is to comprehend visual scenes, encompassing activities such as identifying present objects, precisely locating them in 2D and 3D space, ascertaining object attributes, and elucidating relationships between objects. As a result, the MS COCO dataset stands as a valuable asset for training algorithms focused on object detection and classification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/0*V4gKKTh3N8Qatu36" /><figcaption>Source: <a href="https://arxiv.org/pdf/1405.0312.pdf">Paper</a></figcaption></figure><h4><strong>Use-case:</strong></h4><p>The COCO dataset stands out as a versatile resource catering to a range of computer vision tasks. Its frequent utilization extends to applications such as object detection, semantic segmentation, and keypoint detection. In the following section, we will delve into each of these problem types to foster a comprehensive understanding.</p><ul><li><strong>Object detection with COCO: </strong>Every object contained in the dataset comes with annotations comprising a bounding box and an associated class label.</li><li><strong>Keypoint detection with COCO: </strong>In keypoint detection, human subjects undergo annotation with key points of significance, encompassing joints such as the elbow and knee. These key points play a crucial role in tracking specific movements, enabling tasks like distinguishing whether a person is standing or sitting down. The COCO dataset encompasses annotations for over 250,000 individuals, each annotated with their respective keypoints.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/0*VsGpdNDCt4NILAAs" /><figcaption>Source : <a href="https://cocodataset.org/?ref=blog.roboflow.com#keypoints-2020">COCO 2020 Keypoint Detection Task</a></figcaption></figure><ul><li><strong>Semantic Segmentation with COCO:</strong>Semantic segmentation entails the process of labeling object boundaries with masks and assigning class labels to objects. This methodology facilitates the accurate identification of the locations of various objects within a photo or video, providing a finer level of detail in the analysis of visual content.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C65AheuR-pU8zep_" /><figcaption>Source : <a href="https://cocodataset.org/?ref=blog.roboflow.com#panoptic-2020">Semantics segmentation</a></figcaption></figure><h4>Classes :</h4><p>The COCO dataset encompasses a diverse set of 80 class labels, including:</p><p>‘person’, ‘bicycle’, ‘car’, ‘motorcycle’, ‘airplane’, ‘bus’, ‘train’, ‘truck’, ‘boat’, ‘traffic light’, ‘fire hydrant’, ‘stop sign’, ‘parking meter’, ‘bench’, ‘bird’, ‘cat’, ‘dog’, ‘horse’, ‘sheep’, ‘cow’, ‘elephant’, ‘bear’, ‘zebra’, ‘giraffe’, ‘backpack’, ‘umbrella’, ‘handbag’, ‘tie’, ‘suitcase’, ‘frisbee’, ‘skis’,’snowboard’, ‘sports ball’, ‘kite’, ‘baseball bat’, ‘baseball glove’, ‘skateboard’, ‘surfboard’, ‘tennis racket’, ‘bottle’, ‘wine glass’, ‘cup’, ‘fork’, ‘knife’, ‘spoon’, ‘bowl’, ‘banana’, ‘apple’, ‘sandwich’, ‘orange’, ‘broccoli’, ‘carrot’, ‘hot dog’, ‘pizza’, ‘donut’, ‘cake’, ‘chair’, ‘couch’, ‘potted plant’, ‘bed’, ‘dining table’, ‘toilet’, ‘tv’, ‘laptop’, ‘mouse’, ‘remote’, ‘keyboard’, ‘cell phone’, ‘microwave’, ‘oven’, ‘toaster’, ‘sink’, ‘refrigerator’, ‘book’, ‘clock’, ‘vase’, ‘scissors’, ‘teddy bear’, ‘hair dryer’, ‘toothbrush’.</p><h4>Dataset Format:</h4><p>A COCO dataset comprises five key sections, each providing essential information for the dataset:</p><p>Info: Offers general information about the dataset.</p><pre>&quot;info&quot;: {<br>  &quot;year&quot;: int,<br>  &quot;version&quot;: str,<br>  &quot;description&quot;: str,<br>  &quot;contributor&quot;: str,<br>  &quot;url&quot;: str,<br>  &quot;date_created&quot;: datetime<br>}</pre><p>Licenses: Provides details about the licenses governing the images in the dataset.</p><pre>&quot;licenses&quot;: [<br>  {<br>    &quot;id&quot;: int,<br>    &quot;name&quot;: str,<br>    &quot;url&quot;: str<br>  }<br>]</pre><p>Images: Contains a comprehensive list of all the images in the dataset.</p><pre>&quot;images&quot;: [<br>  {<br>    &quot;id&quot;: int,<br>    &quot;width&quot;: int,<br>    &quot;height&quot;: int,<br>    &quot;file_name&quot;: str,<br>    &quot;license&quot;: int,<br>    &quot;flickr_url&quot;: str,<br>    &quot;coco_url&quot;: str,<br>    &quot;date_captured&quot;: datetime<br>  }<br>]</pre><p>Annotations: Encompasses a detailed list of annotations, including bounding boxes, for all images in the dataset.</p><pre>&quot;annotations&quot;: [<br>  {<br>    &quot;id&quot;: int,<br>    &quot;image_id&quot;: int,<br>    &quot;category_id&quot;: int,<br>    &quot;segmentation&quot;: RLE or [polygon],<br>    &quot;area&quot;: float,<br>    &quot;bbox&quot;: [x, y, width, height],<br>    &quot;iscrowd&quot;: 0 or 1<br>  }<br>]</pre><p>Categories: Provides a comprehensive list of label categories used within the dataset.</p><pre>&quot;categories&quot;: [<br>  {<br>    &quot;id&quot;: int,<br>    &quot;name&quot;: str,<br>    &quot;supercategory&quot;: str,<br>    &quot;isthing&quot;: int,<br>    &quot;color&quot;: list<br>  }<br>]</pre><h4>Conclusion:</h4><p>In summary, the COCO dataset is a prominent and extensively utilized benchmark within the field of computer vision. This dataset offers a diverse collection of images, meticulously annotated to support various tasks, including object detection, segmentation, and image captioning. Its comprehensive nature and wide adoption make it a valuable resource for advancing research and development in computer vision applications</p><h4><a href="https://medium.com/mlearning-ai/community-mlearning-ai-art-machine-learning-innovators-b81ec864118a">Medium’s Boost</a> / <a href="https://open.substack.com/pub/mlearning/p/gpt-i-dont-know-ai-confidence-llm-mystery?r=z7zu8&amp;utm_campaign=post&amp;utm_medium=web">Find AI’s Honest Limits</a> / <a href="https://open.substack.com/pub/mlearning/p/a-free-alternative-to-the-paid-gpts?r=z7zu8&amp;utm_campaign=post&amp;utm_medium=web">FREE GPT salternative</a></h4><p><a href="https://medium.com/mlearning-ai/mlearning-ai-submission-suggestions-b51e2b130bfb">Mlearning.ai Submission Suggestions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae465c780bb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fuzzy Cognetive Maps to improve the Genetic Algorithm for community detection]]></title>
            <link>https://medium.com/@ilyesrezgui46/fuzzy-cognetive-maps-to-improve-the-genetic-algorithm-for-community-detection-06c9f87dfc5e?source=rss-d5646e6099cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/06c9f87dfc5e</guid>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[genetic-algorithm]]></category>
            <category><![CDATA[community-detection]]></category>
            <category><![CDATA[clustering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Ilyes Rezgui]]></dc:creator>
            <pubDate>Sun, 18 Feb 2024 08:46:27 GMT</pubDate>
            <atom:updated>2024-02-18T08:46:27.006Z</atom:updated>
            <content:encoded><![CDATA[<p>Explanation of the Paper <a href="https://link.springer.com/chapter/10.1007/978-981-15-6584-7_39">Fuzzy Cognitive Map-Based Genetic Algorithm for Community Detection</a>.</p><h4>Introduction</h4><ul><li>Detecting communities is an active area of research.</li><li>Detecting communities in networks can be done using the genetic Algorithm(GA).</li><li>Many approaches are trying to improve the performance of GA in detecting communities.</li><li>Fuzzy cognetive maps are applied in this paper to reduce convergence time.</li></ul><h4><strong>History of the Field</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Osr9GF4O1u6Upw8RIRW9SA.png" /><figcaption>Source: Author</figcaption></figure><h4>Community Detection:</h4><p>In this section our interest is community detection. So let’s dive in.</p><p>A community is a group of densly connected nodes in a network. Nodes of the same community share similar properties.</p><p>Community detection helps in understanding individual units better. Moreover, It can help in studying problems of specefic communities (ex: “Diabetes” and “Obesity”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ytNdefUQptIxa8FJ.png" /><figcaption>Source: <a href="https://bigdata.oden.utexas.edu/project/graph-clustering/">Communities</a></figcaption></figure><h4>Fuzzy Cognetive Maps (FCM):</h4><p>An FCM is a weighted directed graph where Nodes represent concepts and Edges represent Relationships between concepts. Edges can also be refered to as weights. They can be Positive or negative in an FCM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bRRtetilpDyJGx67awCA3g.png" /><figcaption>Source:<a href="https://link.springer.com/chapter/10.1007/978-981-15-6584-7_39"> Paper</a></figcaption></figure><ul><li><strong>W_ij &gt; 0 : the concepts C_i and C_j are related.</strong></li><li><strong>W_ij =&lt; 0 : the concepts C_i and C_j are not related.</strong></li></ul><h4>The Genetic Algorithm (GA):</h4><p>GAs are Based on Darwin’s theory “Survival of the fittest”. a Genetic Algorithm is a set of optimization techniques inspired by the biological evolution process that can be used to detect communities in a given network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/0*KWy_IdLsWUSD742t.jpg" /><figcaption>Source: <a href="https://binaryterms.com/genetic-algorithm-in-data-mining.html">GA</a></figcaption></figure><p>In a Genetic Algorithm :</p><p><strong>1- </strong>we choose a random number of communiti es that we want to detect and affect the nodes of the network randomly across these communities.</p><p>2- Now an evaluation of the fitness of the clustering (community detection) is performed. Different metrics are available but the most used one is modularity.</p><p>3- Ranking of chromosomes (Clustering configuration) is done with each iteration. That assures that best clustering configuration is on the top of the list and has maximum modularity.</p><p>4- The genetic algorithm allows a set of genetic operations between chromosomes. (Crossover &amp; Mutation)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*ubCFyvq3jmUPPVw5-3n4rA.png" /><figcaption>Source:<a href="https://link.springer.com/chapter/10.1007/978-981-15-6584-7_39"> Paper</a></figcaption></figure><p>5- The genetic Algorithm is iterative. It loops until the terminating condition is met.</p><p>6-Once the finishing condition is met, The chromosome (clustering configuration) with highest modularity is returned as Results.</p><h4>Proposed Approach in the Paper:</h4><p>In the paper Fuzzy Cognitive M aps (FCM) are used to determine the number of Communities before running the Genetic Algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*te8ycT4Cx6h7G8eLE6cq6g.png" /><figcaption>Source:<a href="https://link.springer.com/chapter/10.1007/978-981-15-6584-7_39"> Paper</a></figcaption></figure><blockquote>=&gt; No more Random initialization of clusters number, Instead it is set to the value of Focal nodes determined by FCM</blockquote><p>Example + Steps:</p><p><strong>1 — Calculate an initial state vector:</strong></p><p>For each node “v” in the network calculate the betweeness centralarity g(v).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*-usFcATdsWyLD8BlAKlu0w.png" /><figcaption>Source:<a href="https://link.springer.com/chapter/10.1007/978-981-15-6584-7_39"> Paper</a></figcaption></figure><p>σ_st(v): The total number of shortest paths from the node “s” to the node “t” and that passes by the node “v”.</p><p>σ_st: The total number of shortest paths from the node “s” to the node “t”.</p><p><strong>2 — Iterate until convergence:</strong></p><p>keep multiplying the initial state vector ‘A’ by the weight matrix ‘W’ until convergence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oHTNoc_mQ8DLC5FakQnwvg.png" /><figcaption>Source: Author</figcaption></figure><p><strong>3 — Determine the focal nodes:</strong></p><p>Once we have the final vector state we calculate its mean value. Then We count the number of values in the final vector state that are &gt;= than the mean value calculated. This is the number of focal nodes determined.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*dSUysi7vZo22wJIZVSPnNQ.png" /><figcaption>Source : <a href="https://link.springer.com/chapter/10.1007/978-981-15-6584-7_39">Paper</a></figcaption></figure><p>For example if we have this state vector. and caluclate its mean value we’ll get an apporximate value of 0.77. Now we check the number of elements in the vector that are greater or equal than 0.77 and we’ll get 5 as a result.</p><p>=&gt; 5 focal nodes are determined.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*66gjmUBD7XA4gcd9PIOY5g.png" /><figcaption>Source : <a href="https://link.springer.com/chapter/10.1007/978-981-15-6584-7_39">Paper</a></figcaption></figure><p>Once the number of focal nodes is determined, the genetic algorithm is initialized by attributing nodes randomly to communitites in the range of the determined number of focal nodes.</p><p><strong>Experimental Results:</strong></p><p>Experimentation was done on an intel I7 system with 32GB of RAM and NVIDIA GeForce GTX 1050 GPU.</p><p>8 different Benchmark Dataset were tested. and are shown in the next figure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*8sn9AXCrNx9p3uOTjXYcQg.png" /><figcaption>Source : <a href="https://link.springer.com/chapter/10.1007/978-981-15-6584-7_39">Paper</a></figcaption></figure><p>Computational complexity was computed for GA community detection and FCM-based GA community detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*xTLfuet5zqDIZ0TEZjywWA.png" /><figcaption>Source : <a href="https://link.springer.com/chapter/10.1007/978-981-15-6584-7_39">Paper</a></figcaption></figure><p>Emperical results states that incorporating fuzzy cognitive maps in genetic algorithms for community detection reduces significantly convergence time.</p><h4>Conclusion:</h4><p>A genetic algorithm-based approach with the use of the FCM tool was presented in this paper. The initial number of communities calculated by the FCM improved significantly the overall computational time of the algorithm.</p><h4>🟠 <a href="https://medium.com/mlearning-ai/community-mlearning-ai-art-machine-learning-innovators-b81ec864118a">Medium’s Boost</a> / <a href="https://open.substack.com/pub/mlearning/p/gpt-i-dont-know-ai-confidence-llm-mystery?r=z7zu8&amp;utm_campaign=post&amp;utm_medium=web">Find AI’s Honest Limits</a> / <a href="https://open.substack.com/pub/mlearning/p/a-free-alternative-to-the-paid-gpts?r=z7zu8&amp;utm_campaign=post&amp;utm_medium=web">FREE GPT salternative</a></h4><p><a href="https://medium.com/mlearning-ai/mlearning-ai-submission-suggestions-b51e2b130bfb">Mlearning.ai Submission Suggestions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=06c9f87dfc5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Green Software Development: Paving the Way for Sustainable Coding]]></title>
            <link>https://generativeai.pub/green-software-development-paving-the-way-for-sustainable-coding-450047a45e20?source=rss-d5646e6099cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/450047a45e20</guid>
            <category><![CDATA[green-energy]]></category>
            <category><![CDATA[sustainability]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[energy]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ilyes Rezgui]]></dc:creator>
            <pubDate>Tue, 29 Aug 2023 07:54:05 GMT</pubDate>
            <atom:updated>2023-08-29T07:54:05.525Z</atom:updated>
            <content:encoded><![CDATA[<h4>1-Introduction</h4><p>The environmental impact of software development is frequently ignored in a society that is becoming more and more computerized. Our digital experiences’ servers, data centers, and other hardware produce a sizable amount of carbon emissions. The software development community is adopting a new paradigm called “Green Software Development” as the need to combat climate change becomes more pressing. This strategy focuses on developing software that is environmentally friendly, energy-efficient, and sustainable. We will discuss the main tenets of green software development in this post, as well as how it contributes to a more sustainable future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eFlarMgCSRWHa7_Tztotxg.jpeg" /><figcaption>Photo by cottonbro studio: <a href="https://www.pexels.com/photo/hands-typing-on-a-laptop-keyboard-5474294/">https://www.pexels.com/photo/hands-typing-on-a-laptop-keyboard-5474294/</a></figcaption></figure><h4><strong>2- Green House Gases</strong></h4><p>At the heart of the urgency for Green Software Development lies the profound impact of greenhouse gases on the Earth’s delicate atmospheric balance. These gases, such as carbon dioxide, methane, and nitrous oxide, act like a blanket in the atmosphere, trapping heat and causing the planet’s temperature to rise — a phenomenon commonly referred to as the greenhouse effect. The increasing concentration of these gases, largely due to human activities like burning fossil fuels and deforestation, has led to global warming, sea level rise, and extreme weather events. Greenhouse gases not only disrupt ecosystems but also pose threats to food security, water resources, and human health. By advocating for energy-efficient algorithms, optimized code, and sustainable software practices, Green Software Development directly contributes to the reduction of carbon emissions, making it an essential part of the broader effort to combat climate change and protect our planet’s fragile atmospheric equilibrium.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QH0b1i2sRHDUlYdng6lQkw.jpeg" /><figcaption>Photo by Pixabay: <a href="https://www.pexels.com/photo/planet-earth-220201/">https://www.pexels.com/photo/planet-earth-220201/</a></figcaption></figure><h4>3- The Carbon Footprint of Software</h4><p>Software has a larger carbon impact than just its code. It covers every stage of software creation and deployment, as well as ongoing maintenance and eventual retirement. Data centers need a tremendous amount of energy for cooling, networking, and compute as they host applications and services. Some estimates place the information and communications technology (ICT) business on par with the aviation sector in terms of its contribution to global carbon emissions, which is between two and three percent. This insight has motivated the software sector to look for greener options.</p><h4>4- Key Principles of Green Software Development</h4><p>There are numerous approaches to enhance your sustainably written code.</p><ul><li><strong>Efficient Algorithms and Optimized Code: </strong>The foundation of Green Software Development lies in creating efficient algorithms and writing optimized code. Algorithms that require fewer computational resources lead to reduced energy consumption, faster execution times, and minimized hardware strain. Code optimization reduces unnecessary computation cycles, resulting in reduced energy consumption and better performance.</li><li><strong>Resource-Efficient Design:</strong> Green software designers prioritize resource efficiency. This involves minimizing memory usage, reducing network requests, and optimizing storage. By writing code that requires fewer resources, developers can contribute to lower energy consumption and decreased hardware wear and tear.</li><li><strong>Minimalism and Simplicity:</strong> Adopting a minimalist approach to software design can significantly impact its carbon footprint. Bloatware and feature-heavy applications tend to demand more resources. Simplifying user interfaces and focusing on essential functionalities not only enhances the user experience but also conserves energy.</li><li><strong>Lifecycle Management</strong>: Green Software Development involves considering the entire lifecycle of software. Starting from adopting a working methodlogy that enables easy updates and maintenance.</li></ul><h4>5- Practices for Sustainable Coding:</h4><ul><li><strong>Collaborative Development: </strong>Open-source collaboration and shared code libraries can promote code reuse, reducing redundancy and the need for additional energy resources.</li><li><strong>Automated Testing and Deployment:</strong>Implementing automated testing and deployment pipelines enhances software quality and reduces the risk of resource-intensive emergency fixes.</li><li><strong>Cloud Computing:</strong> Cloud platforms offer scalable resources, allowing developers to provision exactly what they need. Cloud providers often optimize resource allocation, leading to energy efficiency benefits.</li><li><strong>Renewable Energy-Powered Hosting:</strong> Choosing data centers powered by renewable energy sources, such as solar or wind, can significantly reduce the environmental impact of software hosting.</li></ul><h4>6-Conclusion:</h4><p>Embracing Green Software Development not only benefits the environment but also provides tangible advantages for developers and businesses. Energy-efficient software typically performs better, leading to improved user experiences and reduced operational costs. Additionally, companies that prioritize sustainability demonstrate social responsibility, which can enhance their reputation and attract environmentally conscious users and investors.</p><p>Thank you for reading and see you in another article !!!</p><ul><li><strong><em>If you enjoyed this, </em></strong><a href="https://medium.com/@ilyesrezgui46"><strong><em>follow me on Medium</em></strong></a><strong><em> for more.</em></strong></li><li><strong><em>Want to collaborate? Let’s connect on </em></strong><a href="https://www.linkedin.com/in/ilyes-rezgui-2926aa195/"><strong><em>LinkedIn</em></strong></a><strong><em> .</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*x5YrconRNZcRcYiG.png" /></figure><p><strong>This story is published on </strong><a href="https://generativeai.pub/"><strong>Generative AI</strong></a><strong>. Connect with us on </strong><a href="https://www.linkedin.com/company/generative-ai-publication"><strong>LinkedIn</strong></a><strong> to get the latest AI stories and insights right in your feed. Let’s shape the future of AI together!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*o7xwCsrIkadweHCr.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=450047a45e20" width="1" height="1" alt=""><hr><p><a href="https://generativeai.pub/green-software-development-paving-the-way-for-sustainable-coding-450047a45e20">Green Software Development: Paving the Way for Sustainable Coding</a> was originally published in <a href="https://generativeai.pub/">Generative AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kanban: Managing Your Software Development Lifecycle.]]></title>
            <link>https://medium.com/@ilyesrezgui46/kanban-managing-your-software-development-lifecycle-470796641b26?source=rss-d5646e6099cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/470796641b26</guid>
            <category><![CDATA[work]]></category>
            <category><![CDATA[kanban]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Ilyes Rezgui]]></dc:creator>
            <pubDate>Sun, 27 Aug 2023 19:13:53 GMT</pubDate>
            <atom:updated>2023-08-27T19:13:53.142Z</atom:updated>
            <content:encoded><![CDATA[<h4>Applying Kanban methodology for an R&amp;D project.</h4><h4>1- Introduction :</h4><p>Every software development team shares a common concern: meeting deadlines. However, two prevalent issues that frequently arise during the process are insufficient specifications and unexpected changes in requirements. As a result, selecting the right working methodology becomes vital in achieving effective project management and successfully meeting the objectives within the specified time frames. This post aims to explore the kanban Agile methodology, and analyze its application on a reallife example .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eN_FkRisWAME2aO_Q_nuAQ.jpeg" /><figcaption>Photo by fauxels: <a href="https://www.pexels.com/photo/top-view-photo-of-group-of-people-using-macbook-while-discussing-3182773/">https://www.pexels.com/photo/top-view-photo-of-group-of-people-using-macbook-while-discussing-3182773/</a></figcaption></figure><h4>2- Agile :</h4><p>Agile methodology is a flexible and iterative approach to software development that prioritizes adaptability, collaboration, and customer-centricity. Rooted in the values and principles outlined in the Agile Manifesto, this methodology emphasizes delivering incremental value to users through short development cycles known as sprints. Agile methodologies, such as Scrum and Kanban, promote close collaboration between cross-functional teams and stakeholders, ensuring that changing requirements can be accommodated efficiently. Regular feedback loops enable teams to respond promptly to user needs, enhancing product quality and user satisfaction. Continuous improvement is at the heart of Agile, with teams reflecting on their processes during regular retrospectives to refine their practices. By fostering a dynamic and responsive development environment, Agile methodology empowers teams to navigate complexities and uncertainties inherent in software projects, delivering products that align closely with user expectations.</p><h4>3- Kanban:</h4><p>Kanban is an Agile methodology that focuses on visualizing work, optimizing flow, and managing work-in-progress (WIP) to improve efficiency and deliver value. Unlike methodologies like Scrum, which use fixed-duration time-boxed iterations called sprints, Kanban employs a more continuous and flexible approach to development. To better understand how it works keep reading !</p><ul><li>In Kanban, work is represented as tasks or work items on a visual board, typically divided into columns that represent different stages of the workflow. These columns might include stages like “To Do,” “In Progress,” “Testing,” and “Done.” Each task or work item moves through these columns as it progresses.</li><li>Sprints are not a standard component of Kanban as they are in Scrum. Instead, Kanban operates on a pull-based system, where new work items are pulled into the workflow as capacity becomes available. This helps prevent overloading the team and promotes a smoother flow of work.</li><li>However, some teams that use Kanban might choose to incorporate a sprint-like concept called “cadences” or “iterations.” These are regular intervals during which certain activities occur, such as planning, reviewing, and retrospectives. While tasks can still be completed and moved through the workflow continuously, these cadences provide a rhythm for the team to pause and reflect on their process, much like Scrum’s ceremonies.</li><li>The absence of fixed-duration sprints in Kanban allows for more flexibility in handling changing priorities and workloads. It’s particularly useful for teams that have unpredictable workstreams or a need for continuous delivery.</li></ul><p>In summary, while sprints are not a core component of Kanban methodology, some teams using Kanban might adopt similar practices like iterations or cadences to introduce a structured rhythm while maintaining the adaptability and flow-centric nature of Kanban.</p><h4>3- Real life Example :</h4><p>During the internship marking the culmination of my academic journey, I found myself entrusted with the creation of a code translation system. This endeavor was an R&amp;D project that defied conventional predefining, with the specifics of tasks and their respective durations remaining elusive. Amidst this uncertainty, we were commitmed to an Agile management methodology, although the precise manifestation of that methodology remained an open question. After a meticulous concideration , the compass pointed towards Kanban, for its inherent responsiveness and flexibility. Our approach revolved around a dichotomy: the tasks were divided into the domains of Research and Development. The former encompassed the realm of literature review and data collection, acting as the foundation for informed decisions. The latter were about module creation, exhaustive testing, architectural modeling, and an array of other development facets. The very essence of Kanban’s event-driven and adaptable nature provided the framework for navigating this intricate terrain. A snapshot of the Kanban board that we developed is displayed in the following illustration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qNk4-tUeDvRcROaCFtpwlg.png" /><figcaption>Source : author</figcaption></figure><h4>4-Conclusion:</h4><p>In conclusion, the adoption of Kanban was not merely a pragmatic choice; it was a philosophy that adapted gracefully to the project’s ever-shifting landscape. Kanban’s emphasis on collaboration, adaptability, and continuous improvement redefined our approach to project management.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=470796641b26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Years of Computer Science Higher Education: A Graduate’s Perspective]]></title>
            <link>https://medium.com/@ilyesrezgui46/3-years-of-computer-science-higher-education-a-graduates-perspective-9736225203af?source=rss-d5646e6099cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/9736225203af</guid>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[university]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[college]]></category>
            <category><![CDATA[internships]]></category>
            <dc:creator><![CDATA[Ilyes Rezgui]]></dc:creator>
            <pubDate>Sat, 29 Jul 2023 00:04:27 GMT</pubDate>
            <atom:updated>2023-07-29T00:04:27.319Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you curious about the knowledge and skills acquired during a computer science degree at a top university in Tunisia ? If so, you’re in for a treat! as in this article I will give you an overview of my personal experience at the higher institute of computer science tunis-manar.</p><h3>1- Background: Highschool and college acceptance:</h3><p>My name is Ilyes REZGUI, and I hail from Tunisia, a vibrant country in North Africa. Between 2017 and 2020, I had the privilege of immersing myself in the world of computer science during my high school years, majoring in algorithms and data structures, mathematics, and physics.</p><p>Despite the challenges posed by the COVID-19 pandemic, I managed to persevere, and my efforts bore fruit as I successfully obtained my baccalaureate degree in computer science ranking first in my class . To my delight, I secured the 64th position nationwide among 6,684 candidates for the year 2020.</p><p>With my results in hand, I set my sights on finding the perfect educational institution that aligns with my aspirations and career goals. After careful consideration, I chose to pursue a bachelor’s degree in computer science at the Higher Institute of Computer Science Tunis-Manar.</p><p>I applied, and I got accepted!</p><h3>2- College :</h3><p>In the following section, I will divide the content into two subsections, providing insights into both college life and the subjects I studied. The first subsection will delve into my experiences and adventures during college life, while the second subsection will focus on the diverse range of subjects I encountered and explored throughout my academic journey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*AYrXxrRiuHlFmM8a.png" /><figcaption>College Logo (Source: <a href="https://fr.wikipedia.org/wiki/Institut_sup%C3%A9rieur_d%27informatique_%28Tunisie%29">ISI</a>)</figcaption></figure><blockquote><em>College Life :</em></blockquote><p>Reflecting on my college journey, I find it fascinating how it evolved from a simple beginning into a highly enriching and fulfilling experience. As I engaged with various college communities and faculty members, the opportunities for growth and learning multiplied.</p><p>The institute provided an array of clubs and associations, catering to diverse interests, such as the Google Developers Club, IEEE Club, Art Clubs, Enactus, JCI, Open Source Club, Entrepreneurship Club, and more.</p><p>During my first year, I actively participated in FREEways ISI, where I honed my problem-solving and web development skills. It was a valuable experience that offered challenges and learning opportunities and allowed me to connect with like minded people.</p><blockquote><em>Academia :</em></blockquote><p>Our comprehensive 3-year program is designed to provide you with a well-rounded introduction to various domains within the IT world. It covers the following subjects:</p><ol><li><strong>Graphs and optimization: </strong>This subject was about developing and writing optimization solutions for linear problems, like determining the accurate values to minimize or maximize the profit of a specific linear equation. Additionally, the course covered various Graph problems and optimization algorithms, such as Dijkstra’s algorithm.</li><li><strong>Operating Systems :</strong> The curriculum provides valuable hands-on experience, allowing students to work with terminal commands for file and directory manipulation on both windows and Linux. Additionally, the course covers ordonnancing (scheduling) and process allocation in memory, providing insights into the management of system resources and processes within the operating system environment.</li><li><strong>Logical Systems and Computer Architecture: </strong>Students delve into the fundamentals of logical operations, binary coding, decoding, and electronic circuits, gaining insights into the underlying principles of computer architecture.</li><li><strong>Multimedia:</strong> This course focuses on the treatment of signals and explores the processing of images, sounds, and videos, providing a foundation in multimedia technologies.</li><li><strong>Formal Logic:</strong> Students are exposed to formal logic, enhancing their reasoning and problem-solving skills in the context of logical operations.</li><li><strong>Algorithmics and Data Structures :</strong> This course starts from working with basic data structures likes variables to harder ones like trees, stacks and queues.</li><li><strong>C Programming:</strong> Students learn the C programming language, with a focus on introducing pointers, linked lists, doubly linked lists and applying the knowledge learned in the algorithmics and data structures course.</li><li><strong>Python Programming:</strong> This course handled the basics of python programming, loops, conditions, lists, dictionaries, files, etc…</li><li><strong>Big Data:</strong> This course introduced us to the world of big data and its management using the Hadoop framework. That mainly discussed the MAP-Reduce method and was taught using Python.</li><li><strong>Machine Learning:</strong> We learned and practiced a couple of supervised and unsupervised machine learning models, linear regression, logistic regression, decision trees, and KNNs.</li><li><strong>Artificial intelligence and games: </strong>This course was mainly about searching algorithms, we learned about DFS, BFS,A*, and the MIN-MAX algorithms and we got the chance to build them using Python as a project.</li><li><strong>Java programming :</strong> We were introduced to different concepts through this course with a primary focus on object-oriented programming (OOP). Specifically, we delved into essential OOP principles such as polymorphism, encapsulation, and more.</li><li><strong>UML Design: </strong>In this course, we learned how to design diagrams for software before building it. We covered various types of diagrams like Use Case Diagrams, Class Diagrams, Activity Diagrams, Sequence Diagrams, and Object Diagrams. These diagrams helped us plan and visualize the software’s functionalities, structure, and interactions, making the development process more organized and efficient.</li><li><strong>ERP: </strong>For this class we learned business modeling using BPMN and using the Bonita-soft software, moreover, we learned how to use the Odoo platform to build an ERP system.</li><li><strong>Service oriented architeture: </strong>This course was simply about APIs’ use, in fact, we leanred about REST and SOAP APIs and had the chnace to practice with them both.</li><li><strong>Distributed programming:</strong> In this Java-based course, we explored distributed systems. We learned about handling exceptions, threading, and multithreading. The focus was on managing multiple threads and scheduling them efficiently across resources and data structures. By the end of the course, we were prepared to develop robust software for distributed environments.</li><li><strong>Mobile development: </strong>During this course we developed a small java-based (Android studio) mobile application.</li><li><strong>Web Development: </strong>Unfortuantly we didn’ t get to work with frameworks during this one semester course. All what we did was learning the basics : HTML5, CSS3, Java-script and PHP. We luckily had the chnace to develop 2 websites using these technologies.</li><li><strong>Computer vision: </strong>We learned how to use algorithms and techniques to enable computers to interpret and understand visual information from images.</li><li><strong>Networks: </strong>This curriculum covered various networking concepts, including network models (like the OSI and TCP/IP models), routing, switching, and network security. We learned how to configure and troubleshoot network devices and gained a foundational understanding of network design and administration.</li><li><strong>Data-bases :</strong>This course spanned four semesters, each covering different topics. We learned about Oracle Architectures, SQL scripting language, PL-SQL, data warehouses, and more.</li><li><strong>Probability and statistics: </strong>During this course, we built upon the concepts we learned in high school and had the opportunity to practice using R Studio.</li><li><strong>Algebra :</strong>In this course, we focused on polynomials and learned how to work with them, understanding their properties and performing operations. We also explored linear applications, vectorial spaces and Series expansion.</li><li><strong>Calculus :</strong> In this course, we continued our exploration of derivatives and integrals, but with more challenging functions. We also learned about numerical series and how to analyze their patterns.</li><li><strong>French: </strong>As part of our language curriculum, students have the opportunity to apply their french knowledge to different domains. We learn about digital law, management and more.</li><li><strong>English:</strong> The program includes English language courses, enabling students to enhance their communication skills and ensuring their readiness for the professional world.</li><li><strong>Ergonomy:</strong> This course covered the essentials of building ergonomic interfaces. Moreover, we have learned about cognitive psychology and how the human brain works in the context of, how it treats information.</li><li><strong>Language theory: </strong>The course provided us with a deeper understanding of language hierarchies and the expressive power of different language classes. We also explored topics like regular expressions, finite automats and more.</li><li><strong>Compiling: </strong>The course covered the different phases of the compilation process, such as lexical analysis, syntax analysis, semantic analysis, code generation, and optimization. We also explored various compiler tools and techniques used to transform source code into efficient and executable programs.</li><li><strong>Testing</strong>: In this course, we learned both manual and automated testing techniques. We practiced manual testing to thoroughly evaluate software, and we also explored automated testing using Selenium in Java.</li><li><strong>Cloud and VMs: </strong>In the cloud part of the course, we learned about private, public, and hybrid clouds. We also explored SAAS, PAAS, and IAAS. For virtual machines (VMs), we learned how to create and manage them, and we also worked with Docker images for deploying applications efficiently.</li></ol><h3>3- End-Of-Studies Project :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*ZZK1WoQyr9QEyO7S.jpeg" /></figure><p>Internship (source:author)</p><p>To obtain our national bachelor’s degree in computer science, we are required to complete an internship of at least three months at a company or research laboratory. For my internship, I joined Linedata services for four months, where I worked on an exciting Research and Development project. My task was to develop a code translation system capable of converting Java code to C# and vice versa.</p><p>During the internship, I was also required to write a comprehensive report in either English or French, documenting the entire internship process. Additionally, I had to defend my project in front of a jury. Thankfully, my presentation skills were effective, allowing me to pitch and present my project well. As a result, I received an excellent mark for my end-of-studies project.</p><h3>4- Was it worth it:</h3><p>To be completely honest, my college experience underwent a significant transformation over time. Initially, it wasn’t the most enjoyable journey as I grappled with the increasing academic challenges and the fatigue from commuting. The added pressure of the COVID-19 crisis further exacerbated the stress during my first year, making it a tough hurdle to overcome. However, despite the initial difficulties, things gradually improved as I progressed into my second and third years.</p><p>As I became more familiar with the university environment, a positive change took place. I started to form strong bonds with my professors and fellow students, and the support network around me grew stronger. Making good friends and developing a sense of responsibility played a crucial role in nurturing a healthier approach to managing my mental well-being while still excelling academically and socially.</p><p>It seemed as though I found a point of balance, where I could maintain a harmonious equilibrium between my academic commitments and personal life. This newfound sense of equilibrium contributed to the betterment of my college experience. The challenges I faced initially allowed me to grow and adapt, ultimately leading to a more fulfilling and enjoyable journey through the latter years of college.</p><p>Now, upon completing my degree, I can confidently say that the entire college experience was undeniably worth it. The growth, learning, and personal development I experienced were invaluable, making the challenges I faced at the outset seem like necessary stepping stones to reach this fulfilling outcome.</p><p>Thank you for reading, see you in another article !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9736225203af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhance Your GPT Experience: Tiktoken Unveiled — Free Token Counting for Prompts (with Python Code!)]]></title>
            <link>https://medium.com/@ilyesrezgui46/enhance-your-gpt-experience-tiktoken-unveiled-free-token-counting-for-prompts-with-python-code-51851883825b?source=rss-d5646e6099cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/51851883825b</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[token]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ml-so-good]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Ilyes Rezgui]]></dc:creator>
            <pubDate>Fri, 07 Jul 2023 22:00:34 GMT</pubDate>
            <atom:updated>2023-07-31T18:48:25.251Z</atom:updated>
            <content:encoded><![CDATA[<h3>Enhance Your GPT Experience: Tiktoken Unveiled — Free Token Counting for Prompts (with Python Code!)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LqHzX0Y_LBiHlaZGtxuimQ.png" /><figcaption>Source : <a href="https://www.corporate-games.fr/utiliser-chatgpt-comme-pro/">chatgpt</a></figcaption></figure><p>If you’re a developer who is working with the OpenAI API and who is in need to determine the length of their prompt, then you came to the right place. In this blog post, we’re gonna walk you through how to calculate the number of tokens of a given text using the open-source tiktoken tokenizer of OpenAI.</p><h4>1- What are tokens</h4><p>Tokens are units that represent frequently encountered character sequences. When working with the OpenAI models, tokens are considered the most basic units that the model uses to compute the length of a prompt. For instance, when the term “tokenization” is examined, it can be broken down using a defined grammar into “token” and “ization”, whereas a common short word like “sun” is treated as a single token.</p><p>you can try the UI provided by OpenAi to calculate tokens by clicking this <a href="https://platform.openai.com/tokenizer">link</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*37RB9ACJi1WAbML_5fdI9w.png" /><figcaption>Figure 2: tokenization example on OpenAi’s UI (Source : author)</figcaption></figure><p>Once tokens are identified they’re mapped into Ids with the help of a defined grammar. you can think of it as a dictionary of keys/values where each token/key is mapped into an integer/value that represents it. <br>for the example of the word “tokenization” we can define the two tokens “token” and “ization” where “token” is identified by the integer 30001, and “ization” is identified by the integer 1634.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*kBoDwfJAhhgkUx0lO2tYFw.png" /><figcaption>Figure3 : tokens ids for the word tokenization (Source : author)</figcaption></figure><h4>2- The tiktoken encodings</h4><p>To calculate the number of tokens in a given text we can use the tiktoken open-source tokenizer developed by OpenAI.</p><p>For different models, the company offers different encodings. The “cl100k-base” is used when working with the gpt-4, gpt-3.5-turbo, or the text-embeddings-ada-002 models. The p50k_base on the other hand is used when working with codex, text-davinci-002, or text-davinci-003 models. Finally “p50k_base” or “gpt2” encoding is used for GPT-3 models and is the same one offered by ElutherAI on hugging face.</p><p>you can check the GPT-NEO tokenizer via this <a href="https://huggingface.co/EleutherAI/gpt-neo-2.7B">link </a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*-u-TuQgtnNwVJAh94iPgkQ.png" /><figcaption>Figure4: classification of encoding names based on models (Source : Openai)</figcaption></figure><h4>3- Python implementation</h4><blockquote>First let’s pip install it , so type on your CMD :</blockquote><pre>pip install tiktoken</pre><blockquote>Once the tool is installed we can start writing our python code :</blockquote><pre>#we first import it <br>import tiktoken<br># we Use tiktoken.get_encoding() to load an encoding by its name.<br>encoding = tiktoken.get_encoding(&quot;p50k_base&quot;)<br>#We use tiktoken.encoding_for_model() to automatically load the correct encoding for a given model name<br>encoding = tiktoken.encoding_for_model(&quot;text-davinci-003&quot;)<br># to convert a text into a list of token ids we use the encode() method<br>print(encoding.encode(&quot;Hello community !&quot;))<br># to get the number of tokens representing that text string we simply take the length of the list<br>print(len(encoding.encode(&quot;Hello community !&quot;)))<br></pre><h4>4- Execution</h4><p>Figure 5 shows an example of tokenization using the “p50k_base” encoding for the model “text-davinci-003”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2kl0XNFKKNJmYFvo8BKCUQ.png" /><figcaption>Figure 5: execution example (Source : author)</figcaption></figure><p>Thank you so much for your attention, see you in another article !</p><h4><a href="https://mlearning.substack.com/about">WRITER at MLearning.ai</a> // <a href="https://open.substack.com/pub/mlearning/p/ultimate-guide-fully-control-ai-video-generation?r=z7zu8&amp;utm_campaign=post&amp;utm_medium=web">Control AI Video</a> // <a href="https://open.substack.com/pub/mlearning/p/create-your-private-hq-photo-ai-art-generator?r=z7zu8&amp;utm_campaign=post&amp;utm_medium=web">Personal AI Art Model</a></h4><p><a href="https://medium.com/mlearning-ai/mlearning-ai-submission-suggestions-b51e2b130bfb">Mlearning.ai Submission Suggestions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51851883825b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the power of vector embeddings: From code to meaningful representations]]></title>
            <link>https://generativeai.pub/unlocking-the-power-of-vector-embeddings-from-code-to-meaningful-representations-882b004f9fa2?source=rss-d5646e6099cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/882b004f9fa2</guid>
            <category><![CDATA[code2vec]]></category>
            <category><![CDATA[embedding]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ilyes Rezgui]]></dc:creator>
            <pubDate>Thu, 06 Jul 2023 21:41:35 GMT</pubDate>
            <atom:updated>2023-08-02T08:25:20.185Z</atom:updated>
            <content:encoded><![CDATA[<h4>1-Introduction</h4><p>Have you ever had the need to encode a code snippet written in a specific programming language as an embedding vector capturing information of that code? If yes, this article is for you.</p><p>In this article we will walk through the research paper <strong>“ </strong><a href="https://arxiv.org/pdf/1803.09473.pdf"><strong>code2vec: Learning Distributed Representations of Code</strong></a><strong>” </strong>and we will discuss how they managed to train a neural network on syntactic-only data (AST paths) to predict the name of a method given its body.</p><p>You can test the model via this UI : <a href="https://code2vec.org/">https://code2vec.org/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYBoBdLrgxTn1O_VqctEHQ.png" /><figcaption>Figure 1: Prediciton example of the name of the method f() as done() (Source: <a href="https://code2vec.org/">https://code2vec.org/</a>)</figcaption></figure><h4>2-Abstract syntax trees (AST) :</h4><p>An Abstract Syntax Tree (AST) is a data structure used in computer science to represent the syntactic structure of a program. It is typically generated during the process of parsing a program written in a programming language.<br>For example, if we take this method f() written in Java and parse it using the Java parser, we will get as output the abstract syntax tree shown in Figure 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*3RcW1F9TJAuUZYxhejbi9w.png" /><figcaption>Figure 2 : Java code snippet (source : <a href="https://arxiv.org/abs/1803.09473">https://arxiv.org/abs/1803.09473</a>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87JzPxuLzjyCx9NBAerSWQ.png" /><figcaption>Figure 3 : AST of the code shown in Figure 2 (source: <a href="https://arxiv.org/abs/1803.09473">https://arxiv.org/abs/1803.09473</a>)</figcaption></figure><p>Once the tree is generated, we can extract “<strong>AST_paths</strong>” from it. An “<strong>AST path</strong>”, also known as an “<strong>AST traversal path</strong>” is a sequence of steps that defines a specific route or a sequence of nodes within an Abstract Syntax Tree. From Figure 3, we can extract these paths, for example :</p><blockquote>The path between (boolean, ?):</blockquote><ul><li>Primitive ↑ MethodDecl ↓ Name</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*S0H0pCjfL0ipNFKd7dxyHQ.png" /><figcaption>Figure 4: example 1 (source: author)</figcaption></figure><blockquote>The path between (boolean, Object) :</blockquote><ul><li>Primitive ↑ MethodDecl ↓ Parameter ↓ Class</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*hkbXBFaiNBxAP0FkU507zg.png" /><figcaption>Figure 5: Example 2 (source :author)</figcaption></figure><blockquote>The path between (boolean, target):</blockquote><ul><li>Primitive ↑ MethodDecl ↓ Parameter ↓ VarDeclId</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*_Hz9h_OSOhNq_s4QPGWG3w.png" /><figcaption>Figure 6: Example 3 (source: author)</figcaption></figure><h4>3- Code Representaion</h4><p>A code snippet “P” is represnted by the bag of path_contexts denoted by “B” where B = {bᵢ | i ∈ [1, n]} and n=the number of paths extracted from the AST after parsing “P”. Each bᵢ is a triplet of (xₛ ,p, xₜ) with :</p><blockquote>xₛ: represents the initial node</blockquote><blockquote>p: the path from the node xₛ to the node xₜ</blockquote><blockquote>xₜ: represents the final node</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ldUfVBeaw-n91juH26s1PQ.png" /><figcaption>Figure 7 : Example of “B” the bag_contexts for the method f() (source: author)</figcaption></figure><p>The model is going to learn a couple of matrices during its training. In this section we will first explain <strong>path_vocab </strong>and <strong>value_vocab, </strong>then we will discuss how they are used to construct the context vector<strong>:</strong></p><blockquote>embeddings are explained clearly in this <a href="https://medium.com/@hari4om/word-embedding-d816f643140">article</a>.</blockquote><ul><li><strong>Path_vocab </strong>is an embedding matrix that contains in each row an embedding of a specific AST path. (each AST path is mapped into a row in the path_vocab matrix).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*B2p-P-h0_dYhFEKIRVRNkA.png" /><figcaption>Figure 8: Illustration of the Path_vocab matrix (source: author)</figcaption></figure><ul><li><strong>Value_vocab </strong>is also a matrix containing embedding vectors of all possible tokens in the vocabulary. (each token is also represented as a vector of size d)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*ZLB4w_x7A7WvWYYEB7MZ3g.png" /><figcaption>Figure 9: Illustration of the Value_vocab matrix (source: author)</figcaption></figure><p>It is worth noting the width of these matrices is represented by “d” and is generally a number between 100 and 500.</p><p>Out of these two matrices, we are going to construct context vectors for each path context bᵢ, where i belongs to the interval [1, n]. For example, if we take b₁ as “(boolean, Primitive ↑ MethodDecl ↓ Name, ?)”, we extract the two rows from Value_vocab that represent the token embeddings of “boolean” and “?”. Additionally, we extract the row from the Path_vocab matrix that represents the embedding of the path “Primitive ↑ MethodDecl ↓ Name”. By concatenating these 3 vectors, we obtain a context vector of size 3d, denoted by c₁.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*ZWtcjUyUL3TBXvvZQXOwIA.png" /><figcaption>Example of embedding context vector for the context path (boolean, Primitive ↑ MethodDecl ↓ Name, ?) (source: author)</figcaption></figure><p>After constructing all of these context vectors, they are passed through a fully connected layer to compress their width from 3d to 1d. This compression is achieved by performing matrix multiplication between each context vector “cᵢ” of size(1,3d) and a learned and optimized weight matrix “W” of size(3d,d). The computation can be expressed as follows and results in a (1,d) vector denoted by c̃ᵢ :</p><p>c̃ᵢ = tanh(W · cᵢ)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*KJHbO4Gj3rGsTzJhpe1-XQ.png" /><figcaption>Illustartion of the contect vecotr creation (source: author)</figcaption></figure><p>Now, the question arises: how can we aggregate all of these context vectors into a single fixed-size vector that captures information about the entire code snippet, rather than just a single path in its Abstract Syntax Tree (AST)? The answer to this lies in the attention mechanism.<br>By applying attention, we assign weights to each context vector based on its relevance to the overall understanding of the code snippet. These weights are calculated by comparing the similarity between a query vector denoted by “a” in the paper and each context vector “c̃ᵢ”, with i in the interval [1, n]. The query vector, often referred to as the “context vector” or “attention vector,” is derived from a learnable weight matrix. The attention weights denoted by “αᵢ”, where i belongs to the interval [1, n].are then applied to the context vectors, allowing us to focus more on the most important parts of the code snippet while downplaying the less significant ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6N-JHx_DNQqavgWOMMTXbw.png" /><figcaption>Attention (source: author)</figcaption></figure><p>The exponents in the equations serve the purpose of ensuring that the attention weights are positive. These weights are then normalized by dividing them by their sum, following the standard softmax function. This normalization ensures that the sum of the attention weights is equal to 1.</p><p>The aggregated code vector υ, which represents the entire code snippet, is obtained by taking a linear combination of the combined context vectors {c̃₁, …, c̃ₙ} weighted by their corresponding attention weights. In other words, the attention weights are used as factors for the combined context vectors c̃ᵢ.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*GrmEZC3s6wHws8V4JhN5mA.png" /><figcaption>Context vecotr calculation (source: <a href="https://arxiv.org/abs/1803.09473">https://arxiv.org/abs/1803.09473</a>)</figcaption></figure><p>This implies that the attention weights are non-negative, summing up to 1, and act as coefficients for the context vectors. Thus, the attention mechanism can be interpreted as a weighted average, where the weights are learned and computed with the other elements in the collection of path-context</p><h4>4-Conclusion</h4><p>In conclusion, Code2Vec is a significant step forward in the realm of code representation and understanding, providing a solid foundation for further advancements in the field. By embracing this novel approach, we can unlock new possibilities for improving code comprehension, boosting productivity, and advancing the state of software engineering.</p><p>Thank you for your attention &amp; See you in another article !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*0zet0OrX01M1zrkz.png" /></figure><p><strong>This story is published on </strong><a href="https://generativeai.pub/"><strong>Generative AI</strong></a><strong>. Connect with us on </strong><a href="https://www.linkedin.com/company/generative-ai-publication"><strong>LinkedIn</strong></a><strong> to get the latest AI stories and insights right in your feed. Let’s shape the future of AI together!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*BXRG-F7csAf5jg85.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=882b004f9fa2" width="1" height="1" alt=""><hr><p><a href="https://generativeai.pub/unlocking-the-power-of-vector-embeddings-from-code-to-meaningful-representations-882b004f9fa2">Unlocking the power of vector embeddings: From code to meaningful representations</a> was originally published in <a href="https://generativeai.pub/">Generative AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>