<?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 SAURABH KUMAR on Medium]]></title>
        <description><![CDATA[Stories by SAURABH KUMAR on Medium]]></description>
        <link>https://medium.com/@sau29gupta?source=rss-3c9b6edd9d7c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3Ma9HfKNhI8Mw0LYbxr3bA.jpeg</url>
            <title>Stories by SAURABH KUMAR on Medium</title>
            <link>https://medium.com/@sau29gupta?source=rss-3c9b6edd9d7c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 15:56:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sau29gupta/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[Exploring the Power of Go Routines for Concurrent Programming ]]></title>
            <link>https://medium.com/@sau29gupta/exploring-the-power-of-go-routines-for-concurrent-programming-dd2c4280bde6?source=rss-3c9b6edd9d7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd2c4280bde6</guid>
            <category><![CDATA[goroutines]]></category>
            <category><![CDATA[golang-tutorial]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[SAURABH KUMAR]]></dc:creator>
            <pubDate>Wed, 23 Aug 2023 05:25:29 GMT</pubDate>
            <atom:updated>2023-08-23T05:25:29.853Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you interested in supercharging your concurrent programming skills? Look no further! In this post, we’ll dive deep into the world of Go routines and uncover how they revolutionize concurrent programming in Go.</p><p><strong>What are Go Routines?</strong><br>Go routines are a key feature of the Go programming language, designed to execute lightweight concurrent tasks. Unlike traditional threads, Go routines are incredibly efficient, allowing you to run thousands of them concurrently without overwhelming system resources.</p><p><strong>Why Go Routines?</strong></p><p>1.<strong><em> Concurrency Made Simple</em></strong>:Go routines simplify the complex world of concurrency. With just a few lines of code, you can spin off multiple Go routines that execute tasks concurrently, enhancing the performance of your applications.</p><p>2. <strong><em>Efficiency</em></strong>: Go routines are managed by the Go runtime, which schedules them efficiently across available CPUs. This means you can achieve maximum utilization of your hardware resources without getting bogged down in thread management details.</p><p>3. <strong><em>Low Overhead</em></strong>:Creating and managing Go routines has extremely low overhead compared to traditional threads. This makes it possible to create a large number of Go routines without running into memory and performance issues.</p><blockquote><strong>Creating Go Routines:</strong><br>Creating a Go routine is as simple as adding the `go` keyword before a function call. For example:</blockquote><pre>go<br>func main() {<br> go printNumbers()<br> go printLetters()<br>}</pre><p>Communication and Synchronization:<br>While Go routines can execute concurrently, proper communication and synchronization are essential to prevent data races and ensure smooth execution.</p><ol><li>Channels:Go’s channels facilitate safe communication between Go routines. They ensure data is shared between Go routines in a synchronized and predictable manner.</li><li>Select Statement:The `select` statement enables Go routines to wait on multiple channels, responding to the first one that’s ready. This powerful construct is a cornerstone of Go’s concurrent programming model.</li></ol><p><strong>Example:</strong> <em>Parallelism in Web Scraping</em><br>Imagine you’re building a web scraping tool to gather data from multiple websites simultaneously. Using Go routines, you can create a Go routine for each website, fetching data concurrently. Channels can be used to collect and aggregate the results.</p><pre>go<br>func scrapeWebsite(url string, results chan&lt;- string) {<br> // Fetch data from the website<br> // Process and extract relevant information<br> results &lt;- extractedData<br>}<br>func main() {<br> websites := []string{&quot;site1.com&quot;, &quot;site2.com&quot;, &quot;site3.com&quot;}<br> results := make(chan string)<br>for _, site := range websites {<br> go scrapeWebsite(site, results)<br> }<br>// Collect results<br> for i := 0; i &lt; len(websites); i++ {<br> data := &lt;-results<br> // Process and aggregate data<br> }<br>}</pre><blockquote><strong>Conclusion:</strong><br>Go routines are a game-changer for concurrent programming, offering a straightforward and efficient way to achieve parallelism in your applications. By embracing Go routines and leveraging channels, you can build high-performance applications that take full advantage of modern hardware.</blockquote><p>Ready to take your programming skills to the next level? Dive into the world of Go routines and experience the magic of concurrent programming! 🔥🚀</p><p>#GoLang #ConcurrentProgramming #GoRoutines #Parallelism</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd2c4280bde6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Communication with Channels in GoLang for Concurrent Programming ]]></title>
            <link>https://medium.com/@sau29gupta/mastering-communication-with-channels-in-golang-for-concurrent-programming-1d8e9a0f4a3a?source=rss-3c9b6edd9d7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d8e9a0f4a3a</guid>
            <category><![CDATA[golang-tutorial]]></category>
            <category><![CDATA[golang-development]]></category>
            <dc:creator><![CDATA[SAURABH KUMAR]]></dc:creator>
            <pubDate>Wed, 23 Aug 2023 05:13:09 GMT</pubDate>
            <atom:updated>2023-08-23T10:47:18.273Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you curious about how to establish seamless communication between concurrent tasks in your Go programs? Let’s delve into the world of Go channels, a powerful tool that empowers your applications with efficient and safe data exchange. 🚀</p><p><strong>Understanding Go Channels:</strong></p><p>In the realm of Go programming, channels are the conduit for communication between Go routines. They enable synchronized data sharing and synchronization, allowing your concurrent tasks to interact seamlessly without stepping on each other’s toes.</p><p><strong>Why Channels Matter</strong>:</p><p>1. Data Safety: Channels provide a structured way to share data between Go routines. Unlike shared memory, channels eliminate the risk of data races, ensuring your program’s integrity.</p><p>2. Synchronization: Channels facilitate synchronization by allowing Go routines to coordinate their actions. This ensures that tasks are executed in the correct sequence, enhancing the predictability of your program.</p><p>3. Blocking and Waiting:Go routines can use channels for blocking and waiting, which can be vital for coordinating tasks that depend on each other’s results.</p><p>Creating and Using Channels:</p><p>1. Creating Channels: Channels can be created using the `make` function. For instance:</p><pre>go<br>messages := make(chan string)</pre><p>2. Sending and Receiving: The `&lt;-` operator is used to send and receive data through channels. Sending data into a channel is done like this:</p><pre>go<br>messages &lt;- &quot;Hello, Go!&quot;</pre><p>Receiving data from a channel is done as follows:</p><pre>go<br>receivedMessage := &lt;-messages</pre><p><em>Blocking and Unblocking</em>:Channels naturally block the execution of a Go routine until data is received from or sent to the channel. This characteristic ensures synchronization and controlled data flow.</p><p><em>Select Statement</em>:The `select` statement is a Swiss Army knife for working with channels. It allows Go routines to listen to multiple channels simultaneously, executing the first case that’s ready. This enables elegant handling of concurrent events and channel interactions.</p><p>Example: Multithreaded Logger</p><p>Consider building a multithreaded logger that accepts log messages from various Go routines and prints them in a coordinated manner. Channels can elegantly solve this problem:</p><pre>go<br>func logger(logChannel &lt;-chan string) {<br>for {<br>msg := &lt;-logChannel<br>fmt.Println(msg)<br>}<br>}<br>func main() {<br>logChannel := make(chan string)<br>go logger(logChannel)<br>go func() {<br>logChannel &lt;- &quot;Message from Go routine 1&quot;<br>}()<br>go func() {<br>logChannel &lt;- &quot;Message from Go routine 2&quot;<br>}()<br>// Keep the main routine running<br>select {}<br>}</pre><h3>Pro Tips:</h3><p><strong>1.Use Explicit Types</strong>: Always define the type of data that your channel will carry. This helps in ensuring type safety and prevents unintended data type mismatches.</p><p><strong>2. Make Channels</strong>: Use the make() function to create channels. For example, ch := make(chan int) creates an unbuffered channel of type int.</p><p><strong>3.Buffered vs. Unbuffered Channels</strong>: Understand the difference between buffered and unbuffered channels. Unbuffered channels block until both sender and receiver are ready. Buffered channels allow a certain number of values to be sent without blocking.</p><p><strong>4.Close Channels Properly</strong>: When you’re done sending data through a channel, it’s good practice to close the channel using close(ch). This indicates to the receivers that no more data will be sent.</p><p><strong>5.Avoid Deadlocks</strong>: A deadlock can occur when a goroutine is waiting for a channel that is never read from or written to. Be careful with channel usage to prevent deadlocks.</p><p><strong>6.Select Statement:</strong> The select statement lets you wait on multiple channels simultaneously. This is useful when you’re working with multiple goroutines and want to respond to the first available piece of data.</p><p><strong>7.Send and Receive Operations are Blocking</strong>: Sending data on a channel blocks if the channel is full (for unbuffered channels) or if the buffer is full (for buffered channels). Similarly, receiving data blocks if the channel is empty.</p><p><strong>8.Graceful Shutdown</strong>: When using channels for synchronization, consider using channels to signal graceful shutdown. This ensures all goroutines complete their tasks before the program exits.</p><p><strong>9.Avoid Over-Buffering</strong>: While buffered channels can help with temporary bursts of data, excessive buffering can lead to increased memory consumption. Use buffering wisely based on your use case.</p><p><strong>10.Channel Direction</strong>: When defining function parameters that accept channels, consider specifying the direction of the channel (send-only or receive-only) to enforce proper usage and avoid potential bugs.</p><p><strong>11.Think About Ownership</strong>: Be clear about which goroutine “owns” the channel. This helps in understanding where data is being produced and consumed, aiding in managing concurrency effectively.</p><p><strong>12.Avoid Sharing Data via Channels</strong>: While it’s possible to send data structures through channels, consider if you really need to share ownership of data. Sharing memory across goroutines should be minimized in favor of message passing through channels.</p><p><strong>Conclusion:</strong></p><p>Channels are a cornerstone of Go’s concurrent programming paradigm. They empower your applications with safe and synchronized communication between Go routines. By understanding and harnessing the power of channels, you’re equipped to build robust and efficient concurrent programs that take full advantage of Go’s concurrency model.</p><p>Ready to level up your programming skills? Dive into the world of Go channels and unlock the true potential of concurrent programming! 🌐📡</p><p>#GoLang #ConcurrentProgramming #Channels #Communication #Synchronization</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d8e9a0f4a3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GANs [Generative Adversarial Networks]]]></title>
            <link>https://medium.com/@sau29gupta/gans-generative-adversarial-networks-225542503a5d?source=rss-3c9b6edd9d7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/225542503a5d</guid>
            <category><![CDATA[generative-adversarial]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[SAURABH KUMAR]]></dc:creator>
            <pubDate>Sat, 26 Feb 2022 05:04:45 GMT</pubDate>
            <atom:updated>2022-02-26T11:08:27.572Z</atom:updated>
            <content:encoded><![CDATA[<h4>Deep learning based generative adversarial network</h4><p>More generally, GANs are a model architecture for training a generative model, and it is most common to use deep learning models in this architecture. The GAN architecture was first described in the 2014 paper by Ian Goodfellow , et al. titled “Generative Adversarial Networks.” A standardized approach called Deep Convolutional Generative Adversarial Networks, or DCGAN, that led to more stable models was later formalized by Alec Radford, et al. in the 2015 paper titled “Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks”.</p><blockquote><em>Most GANs today are at least loosely based on the DCGAN architecture</em></blockquote><p><strong>Architecture :</strong></p><ol><li>Generator</li><li>Discriminator</li></ol><p>Both are implemented as MLP (Multilayer Perceptron)</p><h4>Generator : Model that is used to generate new plausible example from the problem domain</h4><h4>Discriminator : Model that is used to classify examples as real ( from the domain) or fake (generated)</h4><blockquote>Generative adversarial networks are based on a game theoretic scenario in which the generator network must compete against an adversary. The generator network directly produces samples. Its adversary, the discriminator network, attempts to distinguish between samples drawn from the training data and samples drawn from the generator.</blockquote><h3>The Generator Model:</h3><ul><li>The generator model takes a fixed-length random vector as input and generates a sample in the domain.</li><li>The vector is drawn from randomly from a Gaussian distribution, and the vector is used to seed the generative process. After training, points in this multidimensional vector space will correspond to points in the problem domain, forming a compressed representation of the data distribution.</li><li>This vector space is referred to as a latent space, or a vector space comprised of latent variables. Latent variables, or hidden variables, are those variables that are important for a domain but are not directly observable.</li><li>We often refer to latent variables, or a latent space, as a projection or compression of a data distribution. That is, a latent space provides a compression or high-level concepts of the observed raw data such as the input data distribution. In the case of GANs, the generator model applies meaning to points in a chosen latent space, such that new points drawn from the latent space can be provided to the generator model as input and used to generate new and different output examples.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*zNfQpqpP4jAR9-0zNP0wcA.png" /><figcaption>Architecture of Generator’s</figcaption></figure><h3>The Discriminator Model:</h3><ul><li>The discriminator model takes an example from the domain as input (real or generated) and predicts a binary class label of real or fake (generated).</li><li>The real example comes from the training dataset. The generated examples are output by the generator model.</li><li>The discriminator is a normal (and well understood) classification model.<br>After the training process, the discriminator model is discarded as we are interested in the generator.</li><li>Sometimes, the generator can be repurposed as it has learned to effectively extract features from examples in the problem domain.<br>Some or all of the feature extraction layers can be used in transfer learning applications using the same or similar input data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*R0gMVLDD7LE3HnYWxh_w9Q.png" /><figcaption>Architecture of Discriminator’s</figcaption></figure><h3>GANs as a Two Player Game:</h3><ul><li>Generative modeling is an unsupervised learning problem, although a clever property of the GAN architecture is that the training of the generative model is framed as a supervised learning problem.</li><li>The two models, the generator and discriminator, are trained together. The generator generates a batch of samples, and these, along with real examples from the domain, are provided to the discriminator and classified as real or fake.</li><li>The discriminator is then updated to get better at discriminating real and fake samples in the next round, and importantly, the generator is updated based on how well, or not, the generated samples fooled the discriminator.</li></ul><blockquote>We can think of the generator as being like a counterfeiter, trying to make fake money, and the discriminator as being like police, trying to allow legitimate money and catch counterfeit money. To succeed in this game, the counterfeiter must learn to make money that is indistinguishable from genuine money, and the generator network must learn to create samples that are drawn from the same distribution as the training data.</blockquote><p>In this way, the two models are competing against each other, they are <strong>adversarial</strong> in the game theory sense, and are playing a zero-sum game.</p><ul><li><em>In this case, zero-sum means that when the discriminator successfully identifies real and fake samples, it is rewarded or no change is needed to the model parameters, whereas the generator is penalized with large updates to model parameters. Alternately, when the generator fools the discriminator, it is rewarded, or no change is needed to the model parameters, but the discriminator is penalized and its model parameters are updated.</em><br><em>At a limit, the generator generates perfect replicas from the input domain every time, and the discriminator cannot tell the difference and predicts “unsure” (e.g. 50% for real and fake) in every case. This is just an example of an idealized case; we do not need to get to this point to arrive at a useful generator model.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*8z9h3Lx0rCWcwchYsWKUWw.png" /><figcaption>DCGANs Model Learning Architecture</figcaption></figure><blockquote>Training drives the discriminator to attempt to learn to correctly classify samples as real or fake. Simultaneously, the generator attempts to fool the classifier into believing its samples are real. At convergence, the generator’s samples are indistinguishable from real data, and the discriminator outputs 1/2 everywhere. The discriminator may then be discarded.</blockquote><h3><strong>GANs and Convolutional Neural Networks</strong></h3><ul><li>GANs typically work with image data and use Convolutional Neural Networks, or CNNs, as the generator and discriminator models.</li><li>The reason for this may be both because the first description of the technique was in the field of computer vision and used CNNs and image data, and because of the remarkable progress that has been seen in recent years using CNNs more generally to achieve state of-the-art results on a suite of computer vision tasks such as object detection and face recognition.</li><li>Modeling image data means that the latent space, the input to the generator, provides a compressed representation of the set of images or photographs used to train the model. It also means that the generator generates new images or photographs, providing an output that can be easily viewed and assessed by developers or users of the model.</li><li>It may be this fact above others, the ability to visually assess the quality of the generated output, that has both led to the focus of computer vision applications with CNNs and on the massive leaps in the capability of GANs as compared to other generative models, deep learning based or otherwise.</li></ul><h3>Why Generative Adversarial Networks?</h3><ul><li>One of the many major advancements in the use of deep learning methods in domains such as computer vision is a technique called <strong>data augmentation</strong>.</li><li>Data augmentation results in better performing models, both increasing model skill and providing<strong> a regularizing effect, reducing generalization error</strong>. It works by creating new, artificial but plausible examples from the input problem domain on which the model is trained.</li><li>The techniques are primitive in the case of image data, involving crops, flips, zooms, and other simple transforms of existing images in the training dataset.</li><li>Successful generative modeling provides an alternative and potentially more domain-specific approach for data augmentation. In fact, data augmentation is a simplified version of generative modeling, although it is rarely described this way.</li></ul><h3><strong>GANs Applications</strong></h3><ol><li>Image Super-Resolution : The ability to generate high-resolution versions of input images.</li><li>Creating Art : The ability to great new and artistic images, sketches, painting, and more.</li><li>Image-to-Image Translation : The ability to translate photographs across domains, such as day to night ,summer to winter, and more.</li></ol><p><em>Thanks of Reading I hope this blog will build a basic concept about DCGANs , Next blog will cover Complete Implementation of DCGANs.….</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=225542503a5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>