<?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 Rito Ghosh on Medium]]></title>
        <description><![CDATA[Stories by Rito Ghosh on Medium]]></description>
        <link>https://medium.com/@ritog?source=rss-f9cf7cbc73c3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*VWrrFfn_Bdk2T2TfISysyQ.jpeg</url>
            <title>Stories by Rito Ghosh on Medium</title>
            <link>https://medium.com/@ritog?source=rss-f9cf7cbc73c3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:17:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ritog/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[Complete Introductory Guide to Speech to Text with Transformers]]></title>
            <link>https://ritog.medium.com/complete-introductory-guide-to-speech-to-text-with-transformers-739422a4c8fd?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/739422a4c8fd</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[audio]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Tue, 09 Sep 2025 14:44:27 GMT</pubDate>
            <atom:updated>2025-09-09T14:44:27.362Z</atom:updated>
            <content:encoded><![CDATA[<h4>First Introduction to AudioML</h4><h4>Learn to use Open Source Transformers from Hugging Face for Speech to Text</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rxv1CbpZsARmbAj5bbJzaA.png" /></figure><h4>Introduction</h4><p>We all deal with audio data much more than we realize. The world is full of audio data and related problems that beg solving. And we can use Machine Learning to solve many of these problems. You are probably familiar with image, text, and tabular data being used to train Machine Learning models- and Machine Learning being used to solve problems in these domains. With the advent of Transformer architectures, it has been possible to solve audio-related problems with much better accuracy than previously known methods. We will learn the basics of Audio ML using speech-to-text with transformers and learn to use the <a href="http://huggingface.co/">Huggingface</a> library to solve audio-related problems with Machine Learning.</p><h4>Learning Objectives</h4><ul><li>Learn about the basics of audio Machine Learning and gain related background knowledge.</li><li>Learn how audio data is collected, stored, and processed for Machine Learning.</li><li>Learn about a common and valuable task: speech-to-text using Machine Learning.</li><li>Learn how to use Huggingface tools and libraries for your audio tasks- from finding datasets to trained models, and use them to solve audio problems with Machine Learning leveraging the Huggingface Python library.</li></ul><h4>Table of Contents</h4><ol><li>Introduction</li><li>Background</li><li>Prerequisites</li><li>Introduction to Audio Machine Learning</li><li>Exploring Audio Data</li><li>Audio ML Using Transformers</li><li>Training Data from Huggingface Hub</li><li>Exploring the Huggingface Hub for Models</li><li>Getting Inference with Pipeline Method</li></ol><h3>Background</h3><p>Since the Deep Learning revolution happened in the early 2010s with AlexNet surpassing human expertise in recognizing objects, Transformer architectures are probably the biggest breakthrough since then. Transformers have made previously unsolvable tasks possible and simplified the solution to many problems. Although it was first intended for better results in natural language translation, it was soon adopted to not only other tasks in Natural Language Processing but also across domains- ViT or Vision Transformers are applied to solve tasks related to images, Decision Transformers are used for decision making in Reinforcement Learning agents, and a recent paper called MagViT demonstrated the use of Transformers for various video-related tasks.</p><p>This all started with the now-famous paper Attention is All You Need, which introduced the Attention mechanism that led to Transformers’ creation. This article does not assume that you already know the inner workings of Transformers architecture.</p><p>Although in the public domain and the domain of regular developers, ChatGPT and GitHub Copilot are very famous names, Deep Learning has been used in many real-world use cases across many fields- Vision, Reinforcement Learning, Natural Language Processing, and so on.</p><p>In recent years, we have learned about many other use cases, such as drug discovery and protein folding. Audio is one of the fascinating fields yet not fully solved by Deep Learning; in a sense, image classification in the Imagenet dataset was solved by Convolutional Neural Networks.</p><h3>Prerequisites</h3><ul><li>I assume that you have experience working with Python. Basic Python knowledge is necessary. You should have an understanding of libraries and their common usage.</li><li>I also assume that you know the basics of Machine Learning and Deep Learning.</li><li>Previous knowledge of Transformers is not necessary but will be helpful.</li></ul><p><strong>Notes Regarding Audio Data:</strong> Inserting audio is not supported by Medium, so I have created a <a href="https://colab.research.google.com/drive/1fUgaQd633fsmUtrbMoWgrqsRJO-zXKH7">Colab notebook</a> with all code and audio data. Launch it in Google Colaboratory, and you can play all the audio in the browser from the notebook.</p><h3>Introduction to Audio Machine Learning</h3><p>You probably have seen audio ML in action. Saying “Hi Siri” or “Okay, Google” launches assistants for their respective platforms- this is audio-related Machine Learning in action. This particular application is known as “keyword detection”.</p><p>But there is a good chance that many problems can be solved using Transformers in this domain. But, before jumping into the use of Transformers, let me quickly tell you how audio-related tasks were solved before Transformers.</p><p>Before Transformers, audio data was usually converted to a melspectrogram- an image describing the audio clip at hand, and it was treated as a piece of image and fed into Convolutional Neural Networks for training. And during inference, the audio sample was first transformed into the melspectrogram representation, and the CNN architecture would infer based on that.</p><h3>Exploring Audio Data</h3><p>Now I will quickly introduce you to the `librosa` Python package. It is a very helpful package for dealing with audio data. I will generate a melspectrogram to give you an idea of their appearance. You can find the <a href="https://librosa.org/doc/latest/index.html">librosa documentation</a> on the web.</p><p>First, install the librosa library by running the following from your Terminal:</p><pre>pip install librosa</pre><p>Then, in your notebook, you have to import it simply like this:</p><pre>import librosa</pre><p>We will explore some basic functionalities of the library using some data that comes bundled with the library.</p><pre>array, sampling_rate = librosa.load(librosa.ex(&quot;trumpet&quot;))</pre><p>We can see that the <strong>librosa.load()</strong> method returns an audio array along with a sampling rate for a trumpet sound.</p><pre>import matplotlib.pyplot as plt<br>import librosa.display<br>plt.figure().set_figwidth(12)<br>librosa.display.waveshow(array, sr=sampling_rate)</pre><p>This plots the audio data values to a graph like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E8n_0kSwWka9wcu5HtHzUg.png" /><figcaption>Audio Wave</figcaption></figure><p>On the X-axis, we see time, and on the Y-axis, we see the amplitude of the clip. Listen to it by:</p><pre>from IPython.display import Audio as aud<br><br>aud(array, rate=16_000)</pre><p>You can listen to the sound in the Colab notebook I created for this post.</p><p>Plot a melspectrogram directly using librosa.</p><pre>import numpy as np<br><br>S = librosa.feature.melspectrogram(y=array, sr=sampling_rate,<br><br>       n_mels=128, fmax=8_000)<br><br>S_dB = librosa.power_to_db(S, ref=np.max)<br><br>plt.figure().set_figwidth(12)<br><br>librosa.display.specshow(S_dB, x_axis=&quot;time&quot;,<br><br>        y_axis=&quot;mel&quot;, sr=sampling_rate,<br><br>        fmax=8000)<br><br>plt.colorbar()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*isrBPTeZ8kx0niVxgLAVFw.png" /><figcaption>Melspectogram of the audio data</figcaption></figure><p>We use melspectrogram over other representations because it contains much more information than other representations- frequency, and amplitude in one curve. You can visit this nice article on Analytics Vidhya to learn more about spectrograms.</p><p>This is exactly what much input data looked like in audio ML before Transformers- for training Convolutional Neural Networks.</p><h3>Audio ML Using Transformers</h3><p>As introduced in the “Attention is All You Need” paper, the attention mechanism successfully solves language-related tasks because, as seen from a high level, the Attention head decides which part of a sequence deserves more attention than the rest when predicting the next token.</p><p>Now, audio is a very fitting example of sequence data. Audio is naturally a continuous signal generated by the vibrations in nature- or our speech organs- in the case of human speech or animal sounds. But computers can neither process nor store continuous data. All data is stored discretely.</p><p>The same is the case for audio. Only values of certain time intervals are stored; these work well enough to listen to songs, watch movies, and communicate with ourselves over the phone or the internet.</p><p>And transformers, too, work on this data.</p><p>Just like NLP (Natural Language Processing), we can use different architectures of transformers for different needs. We will use an Encoder-Decoder architecture for our task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*HJpAZHSjVhcGF3hXRuvkvQ.png" /><figcaption>Encoder Decoder Architecture</figcaption></figure><h3>Training Data from Huggingface Hub</h3><p>As mentioned, we will work with the Huggingface library for each process step. You can navigate to the Huggingface Dataset Hub to check out audio datasets. The dataset that we will work out here is the MINDS dataset. It is the dataset of speech data from speakers of different languages. And all of the examples in the dataset are fully annotated.</p><p>Let’s load the dataset and explore it a little bit.</p><p>First, install the Huggingface datasets library.</p><pre>pip install datasets[audio]</pre><p>Adding [audio] to pip install ensures that we download the <strong>datasets</strong> library with the added support of audio-related functionalities.</p><p>Then we explore the MINDS dataset. I highly advise you to go through the <a href="https://huggingface.co/datasets/PolyAI/minds14">Huggingface page</a> of the dataset and read the dataset card.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TckCTF6uCr9q6pdEI5tWhQ.png" /><figcaption>Our dataset page in Hugging Face hub</figcaption></figure><p>On the Huggingface dataset page, you can see the dataset has very relevant information such as tasks, available languages, and licenses to use the dataset.</p><p>Now we will load the data and learn more about it.</p><pre>from datasets import load_dataset, Audio<br><br>minds = load_dataset(&quot;PolyAI/minds14&quot;, name=&quot;en-AU&quot;,<br>                     split=&quot;train&quot;)<br><br>minds = minds.cast_column(&quot;audio&quot;, Audio(sampling_rate=16_000))</pre><p>Note how the dataset is loaded. The name goes first, and we are, only interested in the Australian accent English, and we are interested only in the training split.</p><p>Before feeding into training or inference task, we want all our audio data to have the same sampling rate. That is done by the `Audio` method in the code.</p><p>We can look into individual examples, like so:</p><pre>example = minds[0]<br>example</pre><h4>Output</h4><p><em>{‘path’: ‘/root/.cache/huggingface/datasets/downloads/extracted/a19fbc5032eacf25eab0097832db7b7f022b42104fbad6bd5765527704a428b9/en-AU~PAY_BILL/response_4.wav’,<br>‘audio’: {‘path’: ‘/root/.cache/huggingface/datasets/downloads/extracted/a19fbc5032eacf25eab0097832db7b7f022b42104fbad6bd5765527704a428b9/en-AU~PAY_BILL/response_4.wav’,<br>‘array’: array([2.36119668e-05, 1.92324660e-04, 2.19284790e-04, …,<br>9.40907281e-04, 1.16613181e-03, 7.20883254e-04]),<br>‘sampling_rate’: 16000},<br>‘transcription’: ‘I would like to pay my electricity bill using my card can you please assist’,<br>‘english_transcription’: ‘I would like to pay my electricity bill using my card can you please assist’,<br>‘intent_class’: 13,<br>‘lang_id’: 2}</em></p><p>It is very simple to understand. It is a Python dictionary with levels. We have the path and sampling rate all stored. Look at the <strong>transcription</strong> key in the dictionary. This contains the label when we are interested in Automatic Speech Recognition. <strong>[“audio”][“aray”]</strong> contains the audio data that we will use to train or infer.</p><p>We can easily listen to any audio example that we want.</p><pre>from IPython.display import Audio as aud<br><br>aud(example[&quot;audio&quot;][&quot;array&quot;], rate=16_000)</pre><p>You can listen to the audio in the Colab Notebook.</p><p>Now, we have a clear idea of how exactly the data looks and how it is structured. We can now move forward to getting inferences from a pretrained model for Automatic Speech Recognition.</p><h3>Exploring the Huggingface Hub for Models</h3><p>The Huggingface hub has many models that can be used for various tasks like text generation, summarization, sentiment analysis, image classification, and so on. We can sort the models in the hub based on the task we want. Our use case is speech-to-text, and we will explore models specifically designed for this task.</p><p>For this, you should navigate to <a href="https://huggingface.com/models">https://huggingface.com/models</a> and then, on the left sidebar, click on your intended task. Here you can find models that you can use out-of-the-box or find a good candidate for fine-tuning your specific task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S7rF2DnUnEqSCP1OTlP4eQ.png" /><figcaption>Audio Related Models in Hugging Face Models Hub</figcaption></figure><p>In the above image, I have already selected Automatic Speech Recognition as the task, and I get all relevant models listed on the right.</p><p>Notice the different pretrained models. One architecture like wav2vec2 can have many models fine-tuned to particular datasets.</p><p>You need to do some searching and remember the resources you can use for using that model or fine-tuning.</p><p>I think the <a href="https://huggingface.co/facebook/wav2vec2-base-960h">wav2vec2-base-960h</a> from Facebook will be apt for our task. Again, I encourage you to go to the model’s page and read the model card.</p><h3>Getting Inference with Pipeline Method</h3><p>Huggingface has a very friendly API that can help with various transformers-related tasks. I suggest going through a Kaggle notebook I authored that gives you many examples of using the Pipeline method: <a href="https://www.kaggle.com/truthr/a-gentle-introduction-to-the-huggingface-pipeline">A Gentle Introduction to Huggingface Pipeline</a>.</p><p>Previously, we found the model we needed for our task, and now we will use it with the Pipeline method we saw in the last section.</p><p>First, install the Huggingface transformers library.</p><pre>pip install transformers</pre><p>Then, import the Pipeline class and select the task and model.</p><pre>from transformers import pipeline<br><br>asr = pipeline(&quot;automatic-speech-recognition&quot;,<br><br>			   model=&quot;facebook/wav2vec2-base-960h&quot;)<br><br>print(asr(example[&quot;audio&quot;][&quot;example&quot;])) # example is one example from the dataset</pre><p>The output is:</p><pre>{&#39;text&#39;: &#39;I WOULD LIKE TO PAY MY ELECTRICITY BILL USING MY CAD CAN YOU PLEASE ASSIST&#39;}</pre><p>You can see that this matches very well with the annotation that we saw above.</p><p>This way, you can get inference out of any other example.</p><h3>Conclusion</h3><p>In this guide, I have covered the basics of audio data processing and exploration and the basics of audio Machine Learning. After a brief discussion of the Transformer architecture for audio machine learning, I showed you how to use audio datasets in the Huggingface hub and how to use pre-trained models using the Huggingface models hub.</p><p>You can use this workflow for many audio-related problems and solve them by leveraging transformer architectures.</p><h4>Key Takeaways</h4><ul><li>Audio Machine Learning is concerned with solving audio-related problems that arise in the real world in the audio domain- with Machine Learning techniques.</li><li>As audio data is stored as a sequence of numbers, it can be treated as a sequence-related problem and solved with the tooling we already have for solving other sequence-related problems.</li><li>As Transformers successfully solve sequence-related problems, we can use Transformer architectures to solve audio problems.</li><li>As speech data and audio data generally vary widely due to factors such as age, accent, habit of speaking, etc., it is always better to use fine-tuned solutions to particular datasets.</li><li>Huggingface has many audio-related solutions regarding datasets, trained models, and easy means to use and tune training and fine-tuning.</li></ul><h4>Resources</h4><ol><li>Huggingface Audio ML course to learn more about Audio Machine Learning</li><li>Think DSP by Allen Downey to delve deeper into Digital Signal Processing</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jzoYldeZyTcL6KZ0VepsEA.png" /><figcaption>Feel free to connect…</figcaption></figure><p><em>Written in June, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=739422a4c8fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Steps to Use CUDA after Linux Kernel Update]]></title>
            <link>https://ritog.medium.com/steps-to-use-cuda-after-linux-kernel-update-6b7194e44783?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b7194e44783</guid>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[cuda]]></category>
            <category><![CDATA[gpu]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Fri, 30 Aug 2024 14:31:43 GMT</pubDate>
            <atom:updated>2024-08-30T14:31:43.297Z</atom:updated>
            <content:encoded><![CDATA[<p><em>05 Oct, 2023</em></p><p><em>by </em><a href="https://ritog.github.io/"><em>Rito Ghosh</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cvX0dasq9cq_sC7H.jpg" /></figure><h3>Introduction</h3><p>Every time your Linux kernel gets an update, your CUDA functionality gets broken.</p><h3>Steps</h3><p>Here are the things that you should do to get back-</p><ol><li>Purge everything related to NVIDIA and CUDA</li></ol><pre>sudo apt purge *nvidia nvidia* cuda* *cuda</pre><p>After you have done this, check if you have any other packages that mention NVIDIA and CUDA.</p><pre>dpkg -l | grep -i nvidia</pre><p>And,</p><pre>dpkg -l | grep -i cuda</pre><p>Then, purge them all as shown before.</p><p>2. Reboot your system.</p><p>3. Then, install the latest NVIDIA driver.</p><pre>sudo apt install nvidia-driver-XXX</pre><p>Replace the XXX with the current version number, or the one that you desire. For me, today, it is 535.</p><p>A lot of folks skip this step, and that might cause unnecessary pain in the future.</p><p>4. When the NVIDIA drivers are installed, reboot your system once again.</p><p>5. Now is your time to install the CUDA toolkit.</p><pre>sudo apt install nvidia-cuda-toolkit</pre><p>6. Verify you installation with running nvidia-smi.</p><p>You will see a positive return in your terminal.</p><p>If you haven’t installed nvidia-smi you can simply install it.</p><p>7. Open an ipykernel, then, import PyTorch (or whatever you use), and check if cuda is available.</p><pre>&gt;&gt;&gt; import torch<br>&gt;&gt;&gt; torch.cuda.is_available()<br># True</pre><p>It should return true if everything worked well.</p><h3>Notes</h3><p>Do not be discouraged easily if you keep getting errors. Sometimes you have to manually install packages that are deemed problematic. For example, I had to run-</p><pre>apt install libnvidia-fbc1-535 libnvidia-cfg1-535 xserver-xorg-video-nvidia-535 libnvidia-encode-535 libnvidia-decode-535 libnvidia-extra-535 libnvidia-compute-535</pre><p>and,</p><pre>apt install libnvcuvid1</pre><p>before installing the drivers. Also make sure if dkms is installed.</p><p>sudo apt install cuda still gives me errors, but everything works as expected and PyTorch and XGBoost can see my G</p><p>PU and use it. NVIDIA’s official guides were not helpful.</p><p>So, I wrote my own. 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b7194e44783" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Completely Remove a Conda Environment]]></title>
            <link>https://ritog.medium.com/completely-remove-a-conda-environment-2eabe413127f?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2eabe413127f</guid>
            <category><![CDATA[anaconda]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Thu, 22 Aug 2024 13:23:24 GMT</pubDate>
            <atom:updated>2024-08-22T13:23:24.400Z</atom:updated>
            <content:encoded><![CDATA[<p><em>27 Apr, 2024</em></p><p><em>by Rito Ghosh</em></p><p>When you are done with a project, (or choose to abandon it 😉), you might remove your conda environment. Like so:</p><pre>conda remove --name ENV_NAME --all</pre><p>Where ENV_NAME is the name of the environment.</p><p>If you are not sure, you can find the environments in your machine by:</p><pre>conda env list</pre><p>And, also make sure to deactivate the environment you are going to remove, if you are <em>in</em> it.</p><p>So, three steps:</p><ol><li>Deactivate the environment, if you have it activated.</li><li>To copy the name proper, list all the environments, and copy the name.</li><li>Remove the environment using conda.</li></ol><p>But, even after you remove an environment, huge bloat remains. Especially if you are working in Deep Learning, where libraries and packages tend to be huge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BYReDiTcYwr-89ge.png" /></figure><p>You can remove the bloat if you choose it.</p><p>For that, you have to use the conda clean command.</p><p><strong>After you have removed one or more environments</strong>, just run:</p><pre>conda clean -a</pre><p>Then just keep saying y 😬.</p><p>This is how you can remove the caches, and clean a conda environment fully, and save a ton of valuable space.</p><p>My results a while back:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/0*1nMCXG2FbhcEPPO2.png" /></figure><p>I was able to save ~33 GB of storage space by using this.</p><p>References:</p><ol><li><a href="https://www.freecodecamp.org/news/how-to-delete-an-environment-in-conda/">https://www.freecodecamp.org/news/how-to-delete-an-environment-in-conda/</a></li><li><a href="https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html">https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html</a></li><li><a href="https://conda.io/projects/conda/en/latest/commands/remove.html">https://con</a></li><li><a href="https://conda.io/projects/conda/en/latest/commands/remove.html">da.io/projects/conda/en/latest/commands/remove.html</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2eabe413127f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Search Engine and Faster Horses]]></title>
            <link>https://ritog.medium.com/search-engine-and-faster-horses-8ddcedb417c?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ddcedb417c</guid>
            <category><![CDATA[search]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Wed, 21 Dec 2022 12:38:59 GMT</pubDate>
            <atom:updated>2022-12-21T12:38:59.269Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XwuKHEsvDUMMEF2LjDCsXg.png" /></figure><h3>The Landscape</h3><p>Complaints with Google has become ubiquitous. Whether it is not being able to find a good result, or being spammed by search-engine optimized result- one can hear complaints about everywhere.</p><p>And, many has started competing in this space. Alternative search engines have been spun up. Whether it has big backers like Bing, or small indie-type search engines like Kagi- we see that the search engine space has become crowded in the last few years.</p><p>I have personally used Kagi and You.com among search engines- besides Google- to a serious degree. And I seriously liked both of them. I came to know about both of them from Hacker News.</p><p>Kagi went paid, and I, the eternal hoarder started saving my Kagi free searches until I practically stopped using it. It’s not Kagi’s fault, but mine.</p><p>I used code.you.com some times, and I liked it. Not because of the result quality, but because of the brilliant UI. I kept using it. My usage of Google gradually kept dropping.</p><h3>LLMs Happened</h3><p>Then LLMs, or Large Language Models started to become widely available. After GPT-3, ChatGPT, from OpenAI was made available to the public. I started using it, and began liking it almost immediately.</p><p>It hallucinates, but also spews useful stuff in most of the cases.</p><p>When you work with code, it not only gives you an answer, it also gives you explanations of each line- like a textbook or a tutor. That’s just <em>fabulous</em> in my opinion.</p><p>I have used ChatGPT for some of the problems that I faced during work. And it did teach me new library methods that I did not know about earlier, and yet I often come across similar problems setting.</p><h3>Rito Ghosh ritoATsigmoidDOTsocial on Twitter: &quot;Today took @OpenAI #ChatGPT for the first ever drive while coding, and it legit taught me two pandas method that are really useful in my current context, and I have never come across them until now!Cool! / Twitter&quot;</h3><p>Today took @OpenAI #ChatGPT for the first ever drive while coding, and it legit taught me two pandas method that are really useful in my current context, and I have never come across them until now!Cool!</p><p>A week ago, I finally decided to set up GitHub Copilot as I already get free access to it. And I started using GitHub Copilot regularly while coding.</p><p>I was really charmed by it. Not only did it output correct code each time, but it also quite promptly understood what I was going to do next. It blew my mind. And I do not say that lightly.</p><p><strong><em>I am searching 80% less Google than before, after I started using Copilot.</em></strong></p><p>I always checked the correctness before pasting my code, and that is what I am doing with Copilot. So, for me at least, there’s no issue with code correctness.</p><h3>Rito Ghosh ritoATsigmoidDOTsocial on Twitter: &quot;Github Copilot hasn&#39;t replaced Google, nor it is its intended use.But I am sure people using it has *far less* number of google searches while coding.Since I started using Copilot, googling while coding, for me, has gone down ~80%.(I always checked for correctness myself.) / Twitter&quot;</h3><p>Github Copilot hasn&#39;t replaced Google, nor it is its intended use.But I am sure people using it has *far less* number of google searches while coding.Since I started using Copilot, googling while coding, for me, has gone down ~80%.(I always checked for correctness myself.)</p><h3>Answer to Search Engines- Aren’t Search Engines?</h3><p>This got me thinking. The way GitHub Copilot has bought down my Google usage- <em>it wasn’t made possible by any other search engine at all</em>.</p><p>What replaced Google for me- wasn’t a search engine at all. It wasn’t Brave search or DuckDuckGo or Bing or Kagi- it was something else entirely.</p><p>I see a similar pattern in the famous quote by Henry Ford. He famously said-</p><blockquote>“If I had asked my customers what they wanted they would have said a faster horse.”</blockquote><p>What people are looking for may be better search engines. But may be something better can be created.</p><p>This is what search engine company founders maybe making a mistake about- they want to replace one search engine with another search engine. Maybe search engines on a whole are ready for disruptions- and not only Google.</p><p>Or some uses of search engines can surely be disrupted. Copilot has successfully replaced Google for me for all of my coding needs.</p><h3>Conclusion</h3><p>Please think- what if what finally disrupts Google partly or fully isn’t another search engine at all? That is a real possibility that we have to take into account.</p><p>After all, it’s cars that we want, and not faster horses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SBsshnrgXUpOSlsW.png" /></figure><p><a href="https://news.ycombinator.com/item?id=34073806">Discuss</a> on Hacker News.</p><p>Please consider subscribing me on <a href="https://rito.substack.com/">Substack</a>. A Newsletter is about direct connection with an audience, independent of a private, centralized platform. I will NEVER EVER spam you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ddcedb417c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stuff About Complex Number I Wish Somebody Told Me]]></title>
            <link>https://ritog.medium.com/stuff-about-complex-number-i-wish-somebody-told-me-a99a0e93778d?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a99a0e93778d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[apl]]></category>
            <category><![CDATA[complex-number]]></category>
            <category><![CDATA[math]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Thu, 07 Jul 2022 21:21:46 GMT</pubDate>
            <atom:updated>2022-07-07T21:21:46.953Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nWnSuFLYHVIxeZ7bvFua6w.png" /><figcaption>Copyright: OpenAI</figcaption></figure><h3>Introduction</h3><p>There are many places that teach you complex number like High School, college classes, YouTube channels, and so on.</p><p>But they earlier ones often heavy on solving problems by-hand, and almost every time, they do <em>only</em> that.</p><p>The latter ones focus mainly on shiny visuals or advanced properties that are not intended for the uninitiated.</p><p>This is a piece written for both people who are getting introduced to Complex Numbers for the first time, and for the people who have studied it in college, and are hazy on the topic. <em>(Why won’t they be? They had to focus on solving boring problems by hand.)</em></p><p>When I saw Jeremy talk about Complex Numbers on the APL study group, I knew I had to write something- I did my Junior year Math paper on Complex Number in High School!</p><p>The idea is to:</p><ul><li>quickly introduce Complex Numbers, and how to work with them</li><li>talk about their origins: why need complex numbers in the first place?</li><li>show how they extend the number line</li><li>show how i works as an operator, and briefly what operators are</li><li>talk about a real world example, and probable future usage</li></ul><p>I will keep it short and crisp.</p><h3>Complex Numbers</h3><p>Complex Numbers, as you might have seen are written like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*20KQZKE3pzapQYGEwkzi1w.png" /></figure><p>Here, the whole thing in the right-hand side is the number. a is the Real part, and b is the imaginary part.</p><p>Do not get misguided by the names. Imaginary numbers aren’t imaginary at all. They make appearance, or rather, they can represent stuff in real life really well! We will soon see.</p><p>You can add and subtract complex numbers. You add (or subtract) the real and imaginary parts separately.</p><p>Let me show you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*-4EdgOX-JLN_zPFaGQ1-QQ.png" /></figure><p>They can be multiplied and divided with real numbers and other complex numbers. They work just as you expect them to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*4gXkYokHdwa5qq9IFVR8Ow.png" /></figure><p>Let’s not spend too much time here.</p><p>As how they behave, and more related information can quickly be found- and good ones at that- on internet.</p><p>I suggest the Khan Academy course on Complex Numbers.</p><p>Oh, I haven’t told you the value of i yet.</p><p>i, is defined such that,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/1*Ol83Wqe57Y0SKbi-BE6tRQ.png" /></figure><p>That’s it!</p><h3>Why do we Need i, and the Whole Complex Number Scenery</h3><p>The story goes, when the Greeks were ridden with famines and other troubles, the Oracle of Delphi told them to double the height of the cube made in honor of Apollo.</p><p>The Greeks could not do it! How could they?</p><p>To double the size of a cube, you need to find the cube root of 2. The Greeks didn’t know how to that!</p><p>Too bad.</p><p>You are probably familiar with the story that Pythagoras, frustrated with the fact that the the size of the diagonal of a square with the side of 1 could not be measured, ordered to off someone! Just like that!</p><p>Because the square root of 2 was not measurable then. It is not a number that you write down like the others.</p><p>Human beings needed something that could be tamed- numbers that always had roots- no matter what the number was!</p><p>This is how it came to be. Complex numbers are numbers that always has roots. No matter what.</p><p>And with the advent of imaginary numbers, it was possible to calculate the square root of negative numbers, too. But that came later.</p><h3>Extending the Number Line</h3><p>The number line is a simple animal.</p><p>It is one-dimensional. It extends both ways of zero.</p><p>And thus, it was limiting.</p><p>Complex numbers was defined in such a way that they added one extra dimension to the number line.</p><p>It wasn’t so one-dimensional anymore.</p><p>Picture: Wikipedia</p><p>Now, numbers weren’t limited to a line, but it was a plane.</p><p>And many more operations became possible that simply weren’t before.</p><h3>i as an Operator</h3><p>i is not simple. Adding it or multiplying it has consequences.</p><p>If you don’t know yet, very simply, operators are stuff that act on other stuff.</p><p>(No mathematical rigor whatsoever can be expected from the previous line)</p><p>You know operators. We are talking about it in APL. We use them whenever we code.</p><p>Functions are also operators.</p><p>Think, for example, about the — operator.</p><p>This is our friendly negative sign. But add it before a positive number, and the result will be a negative number. The number will no longer remain positive.</p><p>Think about the + operator in math. It takes two numbers, not one. And the result is the sum of both of them.</p><p>Operator takes stuff in it, and spits out results.</p><p>i is also an operator.</p><p>Multiplying a number with i <em>rotates</em> the number by 90 degrees counter-clockwise in the complex plain.</p><p>Rotate it twice, and you get the negative of a number. Because, you know, i is the square of -1. And multiplying a number with square of i negates it, i.e. rotates the number by 180 degrees, or throws it to the dark, ehm, negative side.</p><p>This has important consequences.</p><h3>Example of Use of Complex Number in Real World: Electronics</h3><p>The scope of this piece is very limited.</p><p>But I will show you one example.</p><p>Alternating Current is not steady, or fixed like Direct Current or DC. AC current, the one powers our home is the only practical form of electricity that can be practically transported from one point to another over a long distance.</p><p>This form of electricity acts like a wave.</p><p>And whenever waves are involved, we have to deal with angles, frequencies, and amplitudes.</p><p>When angles become involved, we can use trigonometric functions like cosine and sine.</p><p>And complex numbers are related to trigonometric functions via the Euler’s Formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/213/1*8wJvsRaZSy7G_hSkhliC1w.png" /></figure><p>And, when we can use the special number, <em>e</em>, we can solve many problems easily because the function <em>returns itself</em> after differentiation and integration.</p><p>That makes a lot of the things easier.</p><p>While this is the reason for using complex numbers in electronics in the first place, they also make life easier for easier calculation and quantity manipulation.</p><h3>Why Bother: Isn’t One More Dimension Enough?</h3><p>You might think that complex numbers are such nuisance, and we could have done the same clever things with adding one more dimension to the real number like we do in geometry. Would not a ‘y’ suffice instead of this dimension riddled with ‘imaginary numbers’?</p><p>The answer is no.</p><p>You will not have the same behavior then.</p><p>You won’t be able to get the niceties that is afforded to you via Euler’s formula and the access it provides you to the exponential function.</p><p>I hope I was able to give you some intuition about complex numbers, and their uses.</p><p>Please let me know what you think.</p><p><a href="https://convoluted.bearblog.dev/blog/?q=apl">#apl</a> <a href="https://convoluted.bearblog.dev/blog/?q=math">#math</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a99a0e93778d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Any Boolean Function]]></title>
            <link>https://ritog.medium.com/creating-any-boolean-function-55888187612a?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/55888187612a</guid>
            <category><![CDATA[computers]]></category>
            <category><![CDATA[digital-electronics]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[hardware]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Sun, 13 Jun 2021 14:36:20 GMT</pubDate>
            <atom:updated>2021-06-13T14:56:58.273Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wFB0p1IpWbVGta6tVBZ18A.png" /><figcaption>Source: Author</figcaption></figure><h4>A Hands-On Guide</h4><h4>How to Represent Any Boolean Function with Elementary Logic Gates</h4><h3>Introduction</h3><p>Digital electronics is probably the most impactful and widespread technology now. It forms the basis of all of the chips- from ARM microcontrollers to processors in cellphones, all the way to uberpowerful AMD Threadrippers. In all these cases, digital electronics reign supreme.</p><p>It is very useful to learn not only about basic principles but also how these principles and the components of Digital Electronics exactly form the basis of the modern world, i.e., how do we go from basic logic gates to fully functional computers.</p><h3>Elements of Computing Systems</h3><p>Digital Electronics is not only important because it is the base of the modern technology that literally governs our lives, but it makes us better as programmers, and computer scientists.</p><p>Whether we are self-taught programmers or a person with a 4-year CS degree, we were never taught how we go from basic logic gates to CPUs.</p><p>A book that I have come across- <a href="https://mitpress.mit.edu/books/elements-computing-systems-second-edition"><em>The Elements of Computing Systems</em></a> by By Noam Nisan and Shimon Schocken does just that. It teaches you how the basic building blocks of modern computers actually create the computers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*GK1Fps-3t7NSl6gw" /></figure><p><em>[Although it shows the new 2nd edition, I am reading the first one]</em></p><p>It promises to teach you, actively, how we can start from nothing but a NAND gate and go all the way to a full-fledged computer with an operating system, and a general-purpose programming language that runs on it, which can be used to create anything. The book is also known as <strong><em>nand2tetris</em></strong>.</p><p>I have started reading this book and working through it every Sunday, and I have almost finished a chapter.</p><h3>Building Gates from Elementary Gates</h3><p>People who have taken a Digital Architecture class or a Digital Electronics class will know that NAND (NOT AND) gates are called “universal gates” because some combination of them are able to create any other gates. So, when you have a NAND gate with you, you can create a general-purpose computer with it. And the book makes you do that. It makes you create many logic gates starting from AND, NOT, and OR with nothing but a pre-implemented NAND gate.</p><p>So, a NAND gate is already implemented and supplied. You first have to create AND, OR, and NOT gates. Then you go on to further create XOR gates, Multiplexors (MUX), Demultiplexors (D-MUX), and multi-bit versions of these gates and basic gates with what you have built previously, viz. AND, OR, NOT, and NAND gates.</p><p>This is a fascinating task in itself, and very intellectually stimulating.</p><p>This is where the core of the post comes in.</p><p>I will show you how to implement any Boolean function with nothing but three logic gates. This is a trick worth knowing.</p><p>Let’s start.</p><h3>Implementing a Boolean Function</h3><h4>Design a Boolean Function</h4><p>Let’s say we need a Boolean function that behaves in such a way-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/170/1*tMxZ0RHTIwL0-R4XGX9O7Q.png" /></figure><p>This <em>truth table</em> tells you that we need such a Boolean function that outputs 1 iff-</p><ul><li><em>A</em>, <em>B</em>, and <em>C</em>, three Boolean variables, are all 0</li><li>only <em>A</em> is 1, <em>B</em> and <em>C</em> are 0</li><li><em>A</em> and <em>C</em> are 1, <em>B</em> is 0</li><li><em>A</em> and <em>B</em> are 1, <em>C</em> is 0</li></ul><p>Now, in some situations, you might need to define a Boolean function that behaves as you expect. Do not worry about what this function is doing. Let’s focus on the implementation part.</p><h4>Boolean Expression</h4><p>I am assuming that you already know about the basic gates, and how they function.</p><p>So, in the first step to build a Boolean function, you must create the Boolean expression. Just like a Boolean variable can have two values (0, 1), and a Boolean function can only output two values (0, 1, duh!), a Boolean expression always evaluates to either 0 or 1.</p><p>How to actually do it?</p><ol><li>You should just note in which cases the function outputs a 1. Focus just on those.</li><li>Note which variables are on (1) and which are off (0).</li><li>Keep the variables unchanged which are 1 in this case, and take a negation of those which are off (in electronics, you would put them through NOT).</li><li>Multiply them together.</li><li>For these products for each 1 in the output, just add them together.</li></ol><p>That’s it. You have got your Boolean expression.</p><p>Let me go through it step by step.</p><p>In the first occurrence of 1 in the output, we see that all the input variables are off. So, we get a*, b*, and c*, where a, b, and c are the variables representing inputs <em>A</em>, <em>B</em>, and <em>C</em>, respectively, and x* is the negation of x. We multiply them together, and we get a*b*c*.</p><p>In the second occurrence of 1, in a similar manner, we get- ab*c*.</p><p>For the third and fourth occurrences of 1, we get ab*c, and abc*, respectively.</p><p>We have to add them. And doing so, we get-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*fw3jLE2vAodwW9QWo3Bllg.png" /></figure><p>[You are required to write cases in the proper order. The first of three variable has these values row-wise- 0–0–0–0–1–1–1–1, the second one varies- 0–0–1–1–0–0–1–1, and the third one- 0–1–0–1–0–1–0–1.]</p><h4>Implementation</h4><p>You might be already aware that negation is passing through a NOT gate, multiplying is just passing through an AND gate, and adding is just an OR gate.</p><p>The first <em>component</em> a*b*c* can be obtained in this way-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mRDg55DQ_HTn1TaT.png" /></figure><p>And here are the second, third, and fourth components-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g292fWAprlbek_Em.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MXKDm3A1d4Jxhyqg.png" /></figure><p>And,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZY9a07l1Zr9rDlIC.png" /></figure><p>Now, we have to add them all together, i.e. put these components through an OR gate. The output of the OR gate will be our final output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lG6NtDrbmIUVGdht.png" /></figure><p>Our final output.</p><h4>HDL: Implement and Test</h4><p>Now, if you have ICs lying around, you can quickly test this with a power supply or a 5V cell, and some wires. You will also need a multimeter or LED bulbs to check your output.</p><p>But, remember, we are building a computer from scratch when following this book. Using thousands of ICs to build a computer is not slightly practical unless you happen to have a contract with TSMC!</p><p>Something called HDL (Hardware Description Language) is used. It is an intuitive, high-level, special-purpose programming language that you use to design and test chips, and use previously created chips.</p><p>It is implemented in Java, but you do not have to worry about its implementation, you just need to use it. A GUI program is also supplied to do load and test chips.</p><p>For example, given a NAND gate, you will design an AND gate this way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6PxxMulBiONRSdyn.png" /></figure><p>As you can see, it is very intuitive, and you can pick it up in 20 minutes.</p><p>And, this is how you’d test this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lQZxuc6bGW03AELR.png" /></figure><p>To write our custom function in HDL, we would do-</p><pre>// Custom.hdl<br>// this is a part of Hashnode blog Convoluted demo</pre><pre>CHIP Custom {<br>    IN a, b, c;<br>    OUT out;</pre><pre>    PARTS:<br>    Not(in=a, out=nota);<br>    Not(in=b, out=notb);<br>    Not(in=c, out=notc);<br>    And(a=nota, b=notb, out=notanotb);<br>    And(a=notanotb, b=notc, out=w1);<br>    And(a=a, b=notb, out=anotb);<br>    And(a=anotb, b=notc, out=w2);<br>    And(a=anotb, b=c, out=w3);<br>    And(a=a, b=b, out=ab);<br>    And(a=ab, b=notc, out=w4);<br>    Or8Way(in[0]=w1, in[1]=w2, in[2]=w3, in[3]=w4, out=out);<br>}</pre><p>And as this is a custom chip, the .tst test file, and .cmp compare file are not supplied. So, for testing this chip, I wrote my own.</p><p>Here is the test (.tst) file-</p><pre>// Custom.tst<br>// test file for testing custom chip<br>// could be found at- https://gist.github.com/ghosh-r/c4e6f5ceb1e7ea2e3ba3601c9de121be</pre><pre>// test file for a custom chip in Convoluted, a Hashnode blog</pre><pre>load Custom.hdl,<br>output-file Custom.out,<br>compare-to Custom.cmp,<br>output-list a%B3.1.3 b%B3.1.3 c%B3.1.3 out%B3.1.3;</pre><pre>set a 0,<br>set b 0,<br>set c 0,<br>eval,<br>output;</pre><pre>set a 0,<br>set b 0,<br>set c 1,<br>eval,<br>output;</pre><pre>set a 0,<br>set b 1,<br>set c 0,<br>eval,<br>output;</pre><pre>set a 0,<br>set b 1,<br>set c 1,<br>eval,<br>output; </pre><pre>set a 1,<br>set b 0,<br>set c 0,<br>eval,<br>output;</pre><pre>set a 1,<br>set b 0,<br>set c 1,<br>eval,<br>output;</pre><pre>set a 1,<br>set b 1,<br>set c 0,<br>eval,<br>output;</pre><pre>set a 1,<br>set b 1,<br>set c 1,<br>eval,<br>output;</pre><p>And here is the comparison (.cmp) file. It contains the truth table that we expect.</p><pre>// Custom.cmp<br>// compare file for chip Custom.hdl<br>// found at- https://gist.github.com/ghosh-r/c4e6f5ceb1e7ea2e3ba3601c9de121be<br>// test file at- https://gist.github.com/ghosh-r/cef52b9f6ac017e00d64460b025a53fe</pre><pre>|   a   |   b   |   c   |  out  |<br>|   0   |   0   |   0   |   1   |<br>|   0   |   0   |   1   |   0   |<br>|   0   |   1   |   0   |   0   |<br>|   0   |   1   |   1   |   0   |<br>|   1   |   0   |   0   |   1   |<br>|   1   |   0   |   1   |   1   |<br>|   1   |   1   |   0   |   1   |<br>|   1   |   1   |   1   |   0   |</pre><p>Note that the text in Compare files is not robust to whitespaces.</p><p>It will be compared with the output file generated by the simulator.</p><p>Here’s how the successful run looks like-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KK_QD7jRi1EvnvxW.gif" /></figure><h4>Another Example: XOR Gate</h4><p>Suppose you want to implement a XOR gate from basic gates. And the truth-table would be-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/1*--pAIWSZKYSKZXkWFI2sBA.png" /></figure><p>This will be your Boolean expression-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*tgvpA2tuXdipacpCJ6B0Gw.png" /></figure><p>And this will be your HDL implementation.</p><pre>// Xor.hdl</pre><pre>CHIP Xor {<br>    IN a, b;<br>    OUT out;</pre><pre>    PARTS:<br>    Not(in=a, out=nota);<br>    Not(in=b, out=notb);<br>    And(a=a, b=notb, out=w1);<br>    And(a=nota, b=b, out=w2);<br>    Or(a=w1, b=w2, out=out);<br>}</pre><h3>Conclusion</h3><p>I showed you how to implement any Boolean function with nothing but three elementary logic gates. However, you should keep in mind that this approach is impractical when there are more variables, and the chip you want is more complicated.</p><p><a href="https://ghosh-r.github.io/">Ritobrata Ghosh</a> is a Physics undergrad, and a Deep Learning Consultant focused on Computer Vision. I am interested in ML in embedded devices, Private AI (federated learning), Deep RL, and GANs. I am also interested in Maths, problem-solving, and programming in general.</p><p>Follow me to get more similar posts.</p><p>Follow me on <a href="https://twitter.com/AllesistKode">Twitter</a> or connect with me on <a href="https://www.linkedin.com/in/ritobrata-ghosh/">LinkedIn</a>.</p><p><em>(Originally </em><a href="https://learning-deep.hashnode.dev/creating-boolean-function-nand2tetris-1"><em>published</em></a><em> in Convoluted, a Hashnode blog.)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55888187612a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Asking, Helping, and Thoughtful Behaviour]]></title>
            <link>https://medium.com/learningdeep/asking-helping-and-thoughtful-behaviour-7c2365587f14?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c2365587f14</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[content-creation]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[opinion]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 18:22:37 GMT</pubDate>
            <atom:updated>2021-03-26T18:22:37.985Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ntFRQVswXV-Sw7id" /><figcaption>Photo by <a href="https://unsplash.com/@jcotten?utm_source=medium&amp;utm_medium=referral">Joshua J. Cotten</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>A Better Kaggle</h4><h4>Lessons from A Recent Kaggle Discussion Grandmaster</h4><h4>Kaggle Communities- Missed Opportunity</h4><p>When you head over to Kaggle’s hot and new Communities section, you might be a little disappointed. I was. I <em>am</em>, mostly.</p><p>Initially, I was excited that Kaggle was very thoughtful and considerate to introduce this feature. But soon, I found that the Communities were abused to stack up upvotes and were filled with spam. Kaggle is not at any fault here.</p><p>There was helpful content as well, but, sadly, they were in the minority. Communities were filled with aggregated Notebooks, aggregations of posts, and aggregations of other aggregations… You get the idea.</p><p>I did not like this. Moreover, I gasped at the missed opportunity. There are several forums out there- <a href="https://datascience.stackexchange.com/">the Data Science Stack Exchange</a>, the <a href="https://reddit.com/r/machinelearning">Machine Learning Subreddit</a> on Reddit, <a href="https://stats.stackexchange.com/">Cross Validated</a>, and so on.</p><p>I missed a unified, organized platform, that functioned not only as a Q&amp;A site but also as a place where you go to post anything Data Science, Machine Learning, and Deep Learning and engage with similar content posted by others. I was happy to see Kaggle launch separate Communities.</p><p>I was excited about its future.</p><p>But, people who wanted to accumulate votes, and thence Medals to climb the ladder of the Kaggle hierarchy. So it kept being flooded by people wanting to accrue votes.</p><p>I felt hugely disappointed.</p><h4>There’s Hope</h4><p>While being flooded in the aggregations, there are still some genuinely helpful posts. And there are write-ups by winners of competitions, people genuinely posting content which are helpful in many ways.</p><p>Helpful content comes in many forms, but in my opinion, they are mostly from competitions. (I have tried writing posts stemming from my observations, such as <a href="https://www.kaggle.com/data/207117">this one</a>.) The discussions that are thoughtfully tagged by people writing them are to thank.</p><p>Even when someone is not taking part in a competition, or explicitly visiting the Discussion section of the competitions, they get to read valuable posts and related discussions. And above all, such posts are <em>useful</em> and add value to your learning journey.</p><p>And people who add value to our lives through their hard work, definitely deserve recognition.</p><h4>Lessons from a Freshly Minted Grandmaster</h4><p><a href="https://www.kaggle.com/gpreda">Gabriel Preda</a> has recently become a Discussion Grandmaster on Kaggle.</p><p>He <a href="https://www.kaggle.com/general/228140">shared his findings</a> and we can find sound advice from that post. Let’s go over them quickly-</p><ul><li>Engage in conversations, and create posts on Datasets and Competitions. I also think it is important to comment on Notebooks as well.</li><li>Teach. Share what you already know, in a structured, well-thought way.</li><li>What you teach does not always have to be full-length Notebooks, intended to be taken as <em>mini-courses</em>, feel free to share what you know in what Preda calls “pills”-sized chunks as well.</li><li>Be genuinely helpful and try to solve other people’s problems.</li><li>Praise other people, especially beginners for their hard work.</li><li>Don’t be spammy and never use the mention feature in a desperate attempt to gain an upvote.</li></ul><p>Gabriel’s advice is genuinely helpful, and I believe, will make Kaggle better for everyone.</p><p>Consider giving <a href="https://ghosh-r.github.io/">my website</a> a visit, and follow <a href="https://twitter.com/AllesistKode">me on Twitter</a>. Connect with me on <a href="https://www.linkedin.com/in/ritobrata-ghosh/">LinkedIn</a>, and subscribe to <a href="https://rito.substack.com/">my Substack</a>. (No paid promotional content anywhere.)</p><p>Cheers and peace!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c2365587f14" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learningdeep/asking-helping-and-thoughtful-behaviour-7c2365587f14">Asking, Helping, and Thoughtful Behaviour</a> was originally published in <a href="https://medium.com/learningdeep">LearningDeep</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Best 5 + 1 Podcasts for Machine Learning Learners and Practitioners]]></title>
            <link>https://medium.com/swlh/the-best-5-1-podcasts-for-machine-learning-learners-and-practitioners-4a844243fd8c?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a844243fd8c</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[podcast]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Thu, 18 Feb 2021 14:50:04 GMT</pubDate>
            <atom:updated>2021-02-19T18:36:23.393Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WgidcTZr3oWjvwRA" /><figcaption>Photo by <a href="https://unsplash.com/@icons8?utm_source=medium&amp;utm_medium=referral">Icons8 Team</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Amazing ML Podcasts</h4><h4>Podcasts to Keep You Updated on the Everchanging Field of AI</h4><h3>Introduction</h3><p>Podcasts are a great way to learn about novel fields and tools, as well as keeping yourself updated with the fields that you care about.</p><p>I also believe that podcasts which are mainly centered around interviews are a great way to learn about the rockstars and superheroes of the AI world. You get a glimpse of how they think, what are they working on, and howthey solved a particular problem.</p><p>I would also argue that the content you get access to by listening to podcasts is very unique, and you cannot access them somewhere else.</p><p>In this post, I am not going into the details of why I think podcasts are great and Machine Learning learners and practitioners should listen to them.</p><h3>The List</h3><p>Here are the podcasts that I highly recommend for ML learners and professionals-</p><h3>1. <a href="https://wandb.ai/site/podcast">Gradient Dissent</a></h3><p><em>from Weights and Biases, hosted by </em><a href="https://twitter.com/l2k?"><em>Lukas Biewald</em></a></p><blockquote>“The podcast episodes are very informative, crisp, to-the-point, and engaging.”</blockquote><p>It is a Machine Learning podcast that focuses on “Stories from machine learning experts solving real world problems”.</p><p>Lukas hosts his podcasts in his own style. He asks really meaningful questions and is well-informed on the topics. The podcast episodes are very informative, crisp, to-the-point, and engaging.</p><ul><li>Length per episode: usually 30–60 minutes</li><li>Favorite episode so far: <a href="https://www.youtube.com/watch?v=hVW1mwLtDcI">Peter Norvig, Google’s Director of Research — Singularity is in the eye of the beholder</a></li></ul><h3>2. <a href="https://deepmind.com/blog/article/welcome-to-the-deepmind-podcast">DeepMind: The Podcast</a></h3><p><em>from DeepMind, hosted by </em><a href="https://en.wikipedia.org/wiki/Hannah_Fry"><em>Hannah Fry</em></a></p><blockquote>“The engaging, passionate host also gives you a big picture view surrounding the problem, and what the future holds.”</blockquote><p>Hannah Fry is a superb host, as good as any professional podcast host. That sets this podcast apart from the others. Hanna Fry is a Mathematician and has had experience in hosting podcasts. She is passionate and knowledgeable about AI, and passionate about this podcast. This podcast likely has a team working behind it, and the sound effects and the music tells us so. They also make the experience absolutely entertaining.</p><p>This podcast focuses on works being done on DeepMind and hosts people working on those problems within DeepMind. The problems and solutions are described in plain words. The engaging, passionate host also gives you a big picture view surrounding the problem, and what the future holds. This podcast is really well-structured, well-designed, and is really informative and edifying.</p><ul><li>Length per episode: 30 minutes</li><li>Favorite episode so far: <a href="https://www.youtube.com/watch?v=OkAwsrHMTgM">Episode 2: Go to Zero</a></li></ul><h3>3. <a href="https://lexfridman.com/podcast/">Lex Fridman Podcast</a></h3><p><em>hosted by </em><a href="https://lexfridman.com/"><em>Lex Fridman</em></a></p><blockquote>“His interviews are generally long, and hence have much more scope to discuss topics in an in-depth, detailed manner.”</blockquote><p>Lex Fridman is an AI researcher working on autonomous vehicles, and human-robot interaction. He also teaches at MIT. The way he is unique as a podcast host is that he is very focused on long-term goals, and far-reaching implications of the works of the guests. He is interested in deep things such as consciousness and the idea of AGI. He asks deep, fundamental questions and lets us know about the guests’ views on these questions.</p><p>The topics on his podcast transcend the AI universe. He has had guests like Roger Penrose, Richard Dawkins, and Noam Chomsky. A significant portion of his interviews <em>is</em> on AI. His interviews are generally long, and hence have much more scope to discuss topics in an in-depth, detailed manner. I really like that.</p><ul><li>Length per episode: 60–180 minutes</li><li>Favorite episode so far: <a href="https://www.youtube.com/watch?v=uPUEq8d73JI">David Silver: AlphaGo, AlphaZero, and Deep Reinforcement Learning | Lex Fridman Podcast #86</a></li></ul><h3>4. <a href="https://sanyambhutani.com/tag/chaitimedatascience/">Chai Time Data Science</a></h3><p><em>hosted by </em><a href="https://sanyambhutani.com/"><em>Sanyam Bhutani</em></a></p><blockquote>“It is very interesting to see the diverse set of people from diverse backgrounds win Kaggle competitions, and talk about their careers, lives, and Kaggle on this podcast.”</blockquote><p>Sanyam Bhutani is a community man. Period. As a Data Scientist at h2o.ai, he writes blogs, hosts interviews, and hosts book-reading clubs and other clubs with Machine Learning Tokyo. He is also very active in the <a href="https://fast.ai/">fast.ai</a> Communities. And he never monetizes his content! When he is interviewing guests on his podcast, he is not asking questions for the interview, but for learning, too! I like his inquisitive, humble manner of asking questions.</p><p>This podcast hosts a lot of Kaggle Competition winners and Grandmasters. He talks about the guests’ journey, career, and current research, projects, and interests. And, then there is Kaggle! He often interviews winners of particular competitions and asks about their thinking and approach to those particular competitions. These are really informative for people competing on Kaggle, and/or interested in developing full pipelines for any project. It is very interesting to see the diverse set of people from diverse backgrounds win Kaggle competitions, and talk about their careers, lives, and Kaggle on this podcast.</p><ul><li>Length per episode: 30–90 minutes</li><li>Favorite episode so far: <a href="https://www.youtube.com/watch?v=QGCvycOXs2M">Chris Deotte | Secrets to Becoming 4x Kaggle Grandmaster | Discussions and Notebooks</a></li></ul><h3>5. <a href="https://www.youtube.com/channel/UCMLtBahI5DMrt0NPvDSoIRQ">Machine Learning Street Talks</a></h3><p><em>hosted by </em><a href="https://twitter.com/ykilcher"><em>Yannic Kilcher</em></a><em>, </em><a href="https://twitter.com/ecsquendor"><em>Dr. Tim Scarfe</em></a><em>, and </em><a href="https://mit.academia.edu/KeithDuggar"><em>Keith Dugger</em></a></p><blockquote>“The fact that there is more than one host adds value to the conversations, rather than being a liability. The listeners get to hear from multiple perspectives and get acquainted with multiple views.”</blockquote><p>This is the only entry in the list which has multiple hosts. Yannic is famous for his paper-explaining videos, and his sunglasses. Dr. Scarfe and Keith also maintain an online presence and are involved in Deep Learning.</p><p>This podcast deliberately maintains a hacker, open-source sort of aura about them. That is evident from their choice of backgrounds, style of presentation, and many more things. They delve deep into research topics and interview the person(s) attached to them. The fact that there is more than one host adds value to the conversations, rather than being a liability. The listeners get to hear from multiple perspectives and get acquainted with multiple views. The guests are also much more likely to shed light on different aspects of the research.</p><ul><li>Length per episode: 90–120 minutes</li><li>Favorite episode so far: <a href="https://www.youtube.com/watch?v=2PenK06tvE4">#040​ — Adversarial Examples</a></li></ul><h3>The +1. <a href="https://www.youtube.com/user/AtGoogleTalks">Talks at Google</a>, <a href="https://www.youtube.com/user/MicrosoftResearch">Microsoft Research</a>, and <a href="https://www.ted.com/">TED/TEDx</a></h3><blockquote>“I remember listening to a talk- […] which was given back in 2015 that highlights how creative, yet simple Data Analysis can reveal many important insights, and how it can make lives better by influencing government policies.”</blockquote><p>Of course, you have noticed that “+1” in the title. I am including these resources together as one, because, all of the content present at the first two resources are not focused on ML or AI. And although TED has a few talks based on this topic and broader topics, it has some really good talks on ML, Data Science, and AI.</p><p>If you visit the Microsoft Research YouTube page, you will see many playlists that will kindle your excitement. For example, the <a href="https://www.youtube.com/playlist?list=PLD7HFcN7LXRdF6EcEFmrXGo4pngaR4Z_p">AI Distinguished Lecture Series</a> contains many thought-provoking talks in AI. The same goes with Talks at Google.</p><p>TED has quite a few talks on Data Science, AI, and its impact. And TED has been covering Data Analysis, AI, etc. years before these fields blew up. I remember listening to a talk- <a href="https://www.youtube.com/watch?v=6xsvGYIxJok">Making data mean more through storytelling | Ben Wellington</a> which was given back in 2015 that highlights how creative, yet simple Data Analysis can reveal many important insights, and how it can make lives better by influencing government policies. There’s another talk that I will mention- <a href="https://www.youtube.com/watch?v=U6FvJ6jMGHU">Daphne Koller: What we’re learning from online education</a>. The co-founder of Coursera gives us many deep insights about online education and how data are at the core and crux of it. This is yet another example of data transforming something fundamental like education, and impacting the lives of millions positively.</p><ul><li>Length per episode: mixed</li></ul><h3>Conclusion</h3><p>Podcasts about and around Machine Learning have seen a boom in recent times. It is important not to get overwhelmed in this overflow. I have listened to many podcasts about ML/Data Science and decided on these as the bests.</p><p>If you have any suggestions or questions, please let me know in the comments.</p><p>I write about Deep Learning, AI, Deep RL, and GANs on <a href="https://ghosh-r.github.io/">my website</a> (free, not monetized), be sure to subscribe. Don’t forget to follow me on <a href="https://twitter.com/AllesistKode">Twitter</a> for updates.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a844243fd8c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/the-best-5-1-podcasts-for-machine-learning-learners-and-practitioners-4a844243fd8c">The Best 5 + 1 Podcasts for Machine Learning Learners and Practitioners</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Use Numerical Data with ConvNets]]></title>
            <link>https://medium.com/learningdeep/how-to-use-numerical-data-with-convnets-4161a628ce46?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4161a628ce46</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[housing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Fri, 18 Dec 2020 06:48:47 GMT</pubDate>
            <atom:updated>2020-12-18T06:48:47.975Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WST3yH2IaBr8VxEHSgcgqQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@sixties?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Sixties Photography</a> on <a href="https://unsplash.com/s/photos/beautiful-house?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>Using Additional Data with Pictures in Vision Models</h4><h4>Guide on How to Use Additional Numeric Data with Images for Training a Convolutional Neural Network</h4><p><em>[You can access a free version </em><a href="https://ghosh-r.github.io/2020-12-16-numerical-data-additional-input/"><em>here</em></a><em> (for non-Medium Members)]</em></p><h4>Introduction</h4><p>This problem appeared to me as a question in a Kaggle Community forum. Someone wants to use location data along with pictures of houses to predict house prices. This is my take on how to do that and additional thoughts.</p><h4>Dealing with the Images</h4><p>I am assuming that you are trying to predict the prices of the houses where the pictures of the houses are among the inputs.</p><p>This can be accomplished by putting the prices as targets y. And then have the NN predict the price for previously unseen house pictures as y^.</p><p>How I would approach this problem-</p><ul><li>Form a dataset that has the prices as labels y and the images as inputs.</li><li>Split the dataset in train-valid-test splits (remember to shuffle it)</li><li>Create and train the NN to output a single number y^ which will be the price (remember that the output layer has to have a single output node that outputs a raw number, preferably a floating-point number, to predict the price).</li></ul><p>Up to this point, it is quite a simple problem. Note that I am not taking into account the location information at all. So this model will be unusable in the real world. A mansion in rural Texas will definitely cost a lot less than a 2 bedroom house in counties near San Fransisco. You get the idea. So, we will have to take the location into account. Even after that, it will not be very useful, either. Will come to that later.</p><h4>Using the Location Information</h4><p>It was very simple till now. This is the part where it becomes tricky. How to integrate the additional location information into the input of the NN? There are two approaches to this.</p><p>Adding an Additional Layer</p><p>The images will come in three-layer RGB format, the trick is to add an additional fourth layer that contains the location information.</p><p>This is essentially what you do-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3cLXVtn7ILUmota8.png" /><figcaption>[Embedding the location information into an additional layer | Source: Author]</figcaption></figure><ul><li>Pro: The whole ConvNet gets to see the location data and learns well.</li><li>Con: ConvNets are not good at dealing with such information, so this approach might not be very effective.</li></ul><p>Concatenating Information after Feature Extraction by ConvNets, and before the FC Layers</p><p>In architectures like ResNet50, there are several fully connected (FC) layers trailing the convolutional layers. The goal is to put tabular data into those FC layers and let those last FC layers learn from the location information.</p><p>The architecture will look similar to this-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mpl3HdbAA_KNwwTm.png" /><figcaption>[ Concatenating Informations after Feature Extraction by ConvNets, and before the FC Layers | Source: <a href="https://www.nature.com/articles/s41598-019-42294-8">Comparison of Deep Learning Approaches for Multi-Label Chest X-Ray Classification</a>]</figcaption></figure><ul><li>Pro: Inputting numerical data directly to the FC layers which are comparatively much better than ConvNets in dealing with raw numbers.</li><li>Con: The ConvNet is not being utilized in this approach. (Maybe even mess with the extracted features, I am not sure.)</li></ul><p>See more on comparisons of these two approaches <a href="https://datascience.stackexchange.com/questions/68450/how-can-you-include-information-not-present-in-an-image-for-neural-networks">in Data Science Stack Exchange</a>.</p><h4>Concluding Thoughts</h4><p>Even after this, the model will have none to severely limited capabilities in the real world. Because all pictures of houses will not be captured by professionals, and pictures of houses taken from different angles will be perceived very differently by the ConvNet. Additionally, a very large dataset will have to be present for any possible real-world application.</p><p><em>[</em><a href="https://www.kaggle.com/discussion/203341#1115340"><em>Original comment on Kaggle</em></a><em>]</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4161a628ce46" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learningdeep/how-to-use-numerical-data-with-convnets-4161a628ce46">How To Use Numerical Data with ConvNets</a> was originally published in <a href="https://medium.com/learningdeep">LearningDeep</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Choose Pre-trained Models]]></title>
            <link>https://medium.com/learningdeep/how-to-choose-pre-trained-models-875084694508?source=rss-f9cf7cbc73c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/875084694508</guid>
            <category><![CDATA[guidelines]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[transfer-learning]]></category>
            <dc:creator><![CDATA[Rito Ghosh]]></dc:creator>
            <pubDate>Fri, 11 Dec 2020 10:10:39 GMT</pubDate>
            <atom:updated>2021-01-21T09:38:31.143Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sm5RHZoXeXbzYmPPpcW3-w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@urielsc26?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Uriel SC</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>Getting Started with Transfer Learning</h4><h4>Guide on How to Begin Choosing Pretrained Models for Solving a Problem</h4><p><em>[You can access a free version </em><a href="https://ghosh-r.github.io/2020-12-04-selecting-pretrained-models/"><em>here</em></a><em> (for non-Medium Members)]</em></p><h4>Introduction</h4><p>When it comes to Deep Learning models, there are many architectures, and then there are variations of those architectures. Then there are hyperparameters to tune. It is easy to feel a bit overwhelmed when it comes to available options and choosing from them to solve the problem at hand. However, you shouldn’t feel helpless. These are some general advice to get started with using pre-trained architectures for transfer learning, or using an architecture for training the model from scratch-</p><h4>Read Respective Papers</h4><p>It is not as hard as it sounds. Because all those models are discussed in detail in some papers. For example, this is the ResNet paper- <a href="https://arxiv.org/abs/1512.03385">Deep Residual Learning for Image Recognition</a>. You can learn about ResNet there. And, it is very likely that your framework’s documentation has explicit links to papers where the concerned model was discussed. This one is the link to PyTorch’s page-</p><p><a href="https://pytorch.org/docs/stable/torchvision/models.html">TORCHVISION.MODELS</a></p><h4>Study Benchmarks</h4><p>You should study benchmarks. Benchmarks are a great way to achieve better results and to see whether an architecture fits your needs. For example, the last time I used MobileNet, I remember it being just about 17 MB in size with pre-trained weights and works great for narrow use cases such as recognizing sign-language. So, you can deploy the model to mobile devices, Raspberry Pi- you name it! On the other hand, you would want to use ResNet-50 for achieving state-of-the-art results.</p><ul><li>You can rely on standard benchmarks such as <a href="https://dawn.cs.stanford.edu/benchmark/">DAWNBench- An End-to-End Deep Learning Benchmark and Competition</a>, powered by Stanford, and,</li><li>benchmarks by researchers- <a href="https://github.com/jcjohnson/cnn-benchmarks#cnn-benchmarks">cnn-benchmarks</a>– this one is by Justin Johnson, who is now at UofM, and used to teach Stanford’s reputed CNN course.</li></ul><h4>Study Others’ Works</h4><ol><li>Look at projects created by others, see what they used, and if they have had put blog posts accompanying the projects- read those and look for justification for using a certain framework over another. Or just look at their code and their results.</li><li>Look at open and old Kaggle competitions’ submissions- look at what architecture they are using, and read about the justification, if any.</li></ol><h4>Prototype a Lot</h4><p>Whether it’s a school project or personal, whether it is Kaggle competitions, prototype a lot with the same data- use different architectures, different variants, and so on. And judge for yourself which is the best. Ultimately, using models for a certain task is a skill that you master through practice. You have to do experiments, make prototypes with different pre-trained models to get a feel for them.</p><p>(Originally <a href="https://www.kaggle.com/getting-started/201230#1101714">a Kaggle discussion post</a> by the Author.)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=875084694508" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learningdeep/how-to-choose-pre-trained-models-875084694508">How To Choose Pre-trained Models</a> was originally published in <a href="https://medium.com/learningdeep">LearningDeep</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>