<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Kuth</title>
    <description>The latest articles on Forem by Kuth (@kuthchi).</description>
    <link>https://forem.com/kuthchi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1166459%2Fbf7bd045-7108-4b47-9afd-2dd74179562a.jpeg</url>
      <title>Forem: Kuth</title>
      <link>https://forem.com/kuthchi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kuthchi"/>
    <language>en</language>
    <item>
      <title>Understanding The Importance of Convolutional Neural Networks (CNN) in Image Classification</title>
      <dc:creator>Kuth</dc:creator>
      <pubDate>Sun, 10 Mar 2024 11:07:10 +0000</pubDate>
      <link>https://forem.com/kuthchi/understanding-the-importance-of-convolutional-neural-networks-cnn-in-image-classification-1gdj</link>
      <guid>https://forem.com/kuthchi/understanding-the-importance-of-convolutional-neural-networks-cnn-in-image-classification-1gdj</guid>
      <description>&lt;p&gt;Artificial Intelligence era is new challenge in digital field and revolution industry. AI is special computation to build powerful system for many architecture depend on purpose and plan as organization requirements.&lt;/p&gt;

&lt;p&gt;This article I will share little part of AI programing architecture is Convolutional Neural Networks (CNNs). &lt;/p&gt;

&lt;h3&gt;
  
  
  What is Convolutional Neural Networks?
&lt;/h3&gt;

&lt;p&gt;So many explanation on the internet, but here I chose. Convolutional Neural Networks is a type of deep learning neural network which can learn directly from data.&lt;/p&gt;

&lt;p&gt;In era of Deep Learning, Convolutional Neural Networks (CNNs) have revolutionized the way we approach image classification tasks. From recognizing objects in photographs to diagnosing medical conditional from scans, CNNs have become indispensable tools in various domains. In this article, we'll delve into the importance of CNNs in image classification and explore their key components and functionalities.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Rise of Convolutional Neural Networks (CNNs)
&lt;/h3&gt;

&lt;p&gt;Traditional machine learning algorithms often struggle with image classification tasks due to the complexity and high dimensionalities of image data. CNNs address these challenges by leveraging the principles of convolution and hierarchical pattern recognition inspired by the visual cortex of animals.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding Convolutional Neural Networks (CNNs)
&lt;/h3&gt;

&lt;p&gt;At the heart of CNNs are convolutional layers, which perform the convolution operation to extract features from input images. These layers consist of learnable filters or kernels that slide across the input image, capturing local patterns such as edges, textures, and shapes. Through the application of non-linear activation functions like &lt;strong&gt;ReLU&lt;/strong&gt; (Rectified Linear Unit), CNNs can learn complex representations of visual features. &lt;/p&gt;

&lt;h3&gt;
  
  
  Importance of CNNs in Image Classification
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Feature Extraction&lt;/strong&gt;: CNNs excel at automatically learning hierarchical representations of features from raw pixel values. As the network procuresses through successive convolutional layers, it captures increasingly abstract and high-level features, enabling effective discrimination between different classes of objects. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spatial Hierarchies&lt;/strong&gt;: Unlike traditional feedforward neural networks, CNNs preserve the spatial structure of images throughout the network layers. This spatial hierarchy allows CNNs to capture spatial relationships ad context, which are crucial for accurate image classification.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parameter Sharing&lt;/strong&gt;): CNNs leverage parameter sharing to reduce the number of learnable parameters, making them more efficient and scalable for processing large datasets. By sharing weights across different regions of the input image, CNNs an generalize better and learn from limited training data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Translation Invariance&lt;/strong&gt;: CNNs inherently possess translation invariance, meaning they can recognize objects regardless of their position or orientation within the image. This property makes CNNs robust to variations in scale, rotation, and translation, enhancing their ability to classify objects in real-world scenarios.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Applications of CNNs in Image Classification
&lt;/h3&gt;

&lt;p&gt;The versatility of CNNs has led to their widespread adoption across various domains and applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Object Recognition&lt;/strong&gt;: CNNs power state-of-the-art object recognition systems used in autonomous vehicles, surveillance, and augmented reality applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Medical Imaging&lt;/strong&gt;: In the field of healthcare, CNNs enable accurate diagnosis and detection of diseases from medical images such as X-rays, MRIs and CT scans.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Satellite Imagery&lt;/strong&gt;: CNNs analyze satellite imagery for land cover classification, urban planning, environmental monitoring, and disaster response.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Facial Recognition&lt;/strong&gt;: CNNs play a pivotal role in facial recognition systems used for identity verification, security and personalized user experiences. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Convolutional Neural Networks (CNNs) have emerged as powerful tools for image classification, leveraging the principles of convolution and deep learning to extract meaningful features from raw pixel data. The ability to learn hierarchical representations, preserve spatial information and achieve translation invariance makes them indispensable for a wide range of applications across diverse domains. As technology continues to advance, CNNs will undoubtedly play a central role in shaping the future of computer vision and image analysis.&lt;/p&gt;

&lt;p&gt;In conclusion, the importance of CNNs in image classification cannot be overstated and their continued development and refinement hold immense promise for solving complex real-world challenges in the digital age.&lt;/p&gt;

&lt;p&gt;If you like article like this please follow and like it to support me to share more. Thank you LIVE IN PEACE. &lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>tutorial</category>
      <category>ai</category>
    </item>
    <item>
      <title>Understanding and Implementing Recurrent Networks (RNNs) from Scratch in Python</title>
      <dc:creator>Kuth</dc:creator>
      <pubDate>Sat, 09 Mar 2024 04:12:15 +0000</pubDate>
      <link>https://forem.com/kuthchi/understanding-and-implementing-recurrent-networks-rnns-from-scratch-in-python-46ec</link>
      <guid>https://forem.com/kuthchi/understanding-and-implementing-recurrent-networks-rnns-from-scratch-in-python-46ec</guid>
      <description>&lt;p&gt;Today AI is the most popular topic in various industries and it's also has different develop purpose. This writing is about a powerful class of neural network is RNNs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Recurrent Neural Networks (RNNs)?
&lt;/h2&gt;

&lt;p&gt;Recurrent Neural Networks (RNNs) are a powerful class of neural networks well-suited for sequence data processing, making them invaluable in natural language processing (NLP), time series analysis, and more. In this tutorial, we'll delve into the fundamentals of RNNs and implement a basic version from scratch in Python. By tend, you'll have a solid understanding of how RNNs work and how to build one by your own.&lt;/p&gt;

&lt;h4&gt;
  
  
  Knowledge and Tools
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Basic knowledge of Python&lt;/li&gt;
&lt;li&gt;Familiarity with Numpy library&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding Recurrent Neural Networks (RNNs):&lt;br&gt;
RNNs are designed to work with sequential data, where the order of  elements matters. Unlike feedforward neural networks, which process data in a fixed sequence, RNNs maintain a hidden state that captures information about the sequence seen so far. This hidden state is updated at each time step, allowing RNNs to model temporal dependencies in data. &lt;/p&gt;
&lt;h4&gt;
  
  
  Implementing Neural Network from Scratch
&lt;/h4&gt;

&lt;p&gt;To implement an RNN, we need to define the following components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Parameters initialization&lt;/li&gt;
&lt;li&gt;Forward pass&lt;/li&gt;
&lt;li&gt;Backpropagation through time (BPTT)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Let's get started the implementation&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Import the necessary libraries&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Define the RNN class&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;RNN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;input_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hidden_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output_size&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input_size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;input_size&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hidden_size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hidden_size&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;output_size&lt;/span&gt;

        &lt;span class="c1"&gt;# Initialize weights
&lt;/span&gt;        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Wxh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;randn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hidden_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;input_size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Whh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;randn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hidden_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hidden_size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Why&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;randn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hidden_size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;

        &lt;span class="c1"&gt;# Initialize biases
&lt;/span&gt;        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;hidden_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;by&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;output_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Implement the forward pass&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h_prev&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# List to store outputs at each time step
&lt;/span&gt;    &lt;span class="n"&gt;outputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# Update hidden state
&lt;/span&gt;      &lt;span class="n"&gt;h_next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tanh&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Wxh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Whh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h_prev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bh&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

      &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Why&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h_next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;by&lt;/span&gt;

      &lt;span class="n"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

      &lt;span class="n"&gt;h_prev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;h_next&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h_next&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;: Implement backgropagation through time (BPTT)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;backward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h_prev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dh_next&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Initialize gradients
&lt;/span&gt;    &lt;span class="n"&gt;dWxh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dWhh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dWhy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Wxh&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Whh&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Why&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;dbh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dby&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bh&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;by&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;dh_next_temp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dh_next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Backpropagate through time
&lt;/span&gt;    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y_true&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;reversed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nf"&gt;reversed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
        &lt;span class="c1"&gt;# Compute gradients
&lt;/span&gt;        &lt;span class="n"&gt;dy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;outputs&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;y_true&lt;/span&gt;
        &lt;span class="n"&gt;dWhy&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h_next&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;dby&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;dy&lt;/span&gt;
        &lt;span class="n"&gt;dh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Why&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;dh_next_temp&lt;/span&gt;
        &lt;span class="n"&gt;dh_raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;h_next&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;h_next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;dh&lt;/span&gt;
        &lt;span class="n"&gt;dbh&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;dh_raw&lt;/span&gt;
        &lt;span class="n"&gt;dWxh&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dh_raw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;dWhh&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dh_raw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h_prev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;dh_next_temp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Whh&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dh_raw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;dWxh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dWhh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dWhy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dbh&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dby&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Conclusion:
&lt;/h4&gt;

&lt;p&gt;In this tutorial, we've covered the basics of Recurrent Neural Networks (RNNs) and implemented a simple version from scratch in Python. While this implementation is basic, it provides a foundational understanding of how RNNs work and how they can be trained using backpropagation through time (BPTT). Experiment with different architectures and datasets to deepen your understanding and explore the full potential of RNNs in various applications. &lt;/p&gt;

&lt;h2&gt;
  
  
  References:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Understanding LSTM Networks by Christopher Olah:
&lt;a href="https://colah.github.io/posts/2015-08-Understanding-LSTMs/"&gt;https://colah.github.io/posts/2015-08-Understanding-LSTMs/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Deep Learning Specialization by Andrew Ng on Coursera: 
&lt;a href="https://www.coursera.org/specializations/deep-learning"&gt;https://www.coursera.org/specializations/deep-learning&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don't forget comments on it.&lt;/p&gt;

</description>
      <category>python</category>
      <category>machinelearning</category>
      <category>tutorial</category>
      <category>ai</category>
    </item>
    <item>
      <title>Tokenization Technique for None-spacing Words</title>
      <dc:creator>Kuth</dc:creator>
      <pubDate>Fri, 08 Mar 2024 04:36:33 +0000</pubDate>
      <link>https://forem.com/kuthchi/tokenization-technique-for-none-spacing-words-2ea9</link>
      <guid>https://forem.com/kuthchi/tokenization-technique-for-none-spacing-words-2ea9</guid>
      <description>&lt;p&gt;In Natural Language Processing to identify words from sentence in English or Latin characters is not too hard, because each word is has a space. But in Unicode character is different we need to make it compare to existing words from dictionary. &lt;/p&gt;

&lt;h2&gt;
  
  
  Dictionary Format:
&lt;/h2&gt;

&lt;p&gt;You can structure your dictionary to include related words and explanatory phrases. Here's an example format:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;khmer_dictionary = {
    'មាន': {'POS': 'Verb', 'Related': ['មានសៀវភៅ', 'មានទិន្នន័យ'], 'Explanation': 'to have'},
    'សៀវភៅ': {'POS': 'Noun', 'Related': [], 'Explanation': 'book'},
    'ច្រើន': {'POS': 'Adjective', 'Related': [], 'Explanation': 'many'},
    'ណាស់': {'POS': 'Adverb', 'Related': [], 'Explanation': 'here'},
    'នៅ': {'POS': 'Verb', 'Related': [], 'Explanation': 'to be at'},
    'ទីនេះ': {'POS': 'Noun', 'Related': [], 'Explanation': 'this place'}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Improving Tokenization Method:
&lt;/h2&gt;

&lt;p&gt;To handle multi-word phrases and OOV words better, you need to adjust your tokenization function. Here's a revised version.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def tokenize_with_dictionary(sentence):
    tokens = []
    current_word = '' 

    for char in sentence:
        current_word += char
        if current_word in khmer_dictionary:
            tokens.append((current_word, khmer_dictionary[current_word]))
            current_word = ''

        elif current_word[:-1] in khmer_dictionary:
            tokens.append((current_word[:-1], khmer_dictionary[current_word[:-1]]))
            current_word = char

    if current_word:
        tokens.append((current_word, 'OOV'))

    return tokens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you can save it to database.&lt;br&gt;
If you have better idea or something for improvement, please comments below.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
