<?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 Pixalytix on Medium]]></title>
        <description><![CDATA[Stories by Pixalytix on Medium]]></description>
        <link>https://medium.com/@pixalytix?source=rss-0ec6df3255a9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*RvDYWRyU0UInQAKo</url>
            <title>Stories by Pixalytix on Medium</title>
            <link>https://medium.com/@pixalytix?source=rss-0ec6df3255a9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 12:45:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pixalytix/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[Overview of Different Optimisers in Deep Learning]]></title>
            <link>https://medium.com/@pixalytix/overview-of-different-optimisers-in-deep-learning-1649112cee17?source=rss-0ec6df3255a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/1649112cee17</guid>
            <dc:creator><![CDATA[Pixalytix]]></dc:creator>
            <pubDate>Mon, 20 Jan 2025 14:53:43 GMT</pubDate>
            <atom:updated>2025-01-20T14:53:43.532Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Optimisers are the backbone of training deep learning models. They play a crucial role in adjusting the model’s weights to minimise the loss function and enhance accuracy. Choosing the right optimiser can significantly impact the speed and effectiveness of the training process. Let’s dive into some of the most widely used optimisers and their characteristics.</blockquote><h3>1. Gradient Descent (GD)</h3><p>Gradient Descent is the foundation of optimisation algorithms. It minimises the loss function J(θ) by updating the weights θ in the opposite direction of the gradient:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*iYmsod-Jzz9uRzLbanzUyg.png" /></figure><h4>Pros:</h4><ul><li>Simple and effective for small datasets.</li></ul><h4>Cons:</h4><ul><li>Requires the entire dataset per step, making it computationally expensive for large datasets.</li><li>Can get stuck in local minima or saddle points.</li></ul><h3>2. Stochastic Gradient Descent (SGD)</h3><p>SGD updates weights using a single sample at a time instead of the entire dataset:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*oT5pXFFOEBvjAJ9qbt_yhg.png" /></figure><h4>Pros:</h4><ul><li>Faster updates and more computationally efficient.</li><li>Helps escape local minima due to noise in updates.</li></ul><h4>Cons:</h4><ul><li>Converges slower than full-batch GD.</li><li>Fluctuations in the optimisation trajectory.</li></ul><h3>3. Momentum</h3><p>Momentum accelerates SGD by adding a fraction of the previous update to the current update:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*NWiabyMc65bFS0_1l80UPA.png" /></figure><h4>Pros:</h4><ul><li>Speeds up convergence in the relevant direction.</li><li>Helps escape shallow local minima.</li></ul><h4>Cons:</h4><ul><li>Requires tuning of the momentum coefficient.</li></ul><h3>4. AdaGrad</h3><p>AdaGrad adjusts the learning rate for each parameter based on historical gradients:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*9E0jRGeQHByP2LiqM9bctg.png" /></figure><h4>Pros:</h4><ul><li>Effective for sparse data.</li><li>Adapts learning rates dynamically.</li></ul><h4>Cons:</h4><ul><li>Learning rate becomes too small over time, slowing convergence.</li></ul><h3>5. RMSProp</h3><p>RMSProp solves AdaGrad’s diminishing learning rate issue by using an exponentially decaying average of squared gradients:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*P874zwhh791gUHmoACHDjw.png" /></figure><h4>Pros:</h4><ul><li>Handles non-stationary objectives well.</li><li>Prevents diminishing learning rates.</li></ul><h4>Cons:</h4><ul><li>Sensitive to the choice of hyper-parameters.</li></ul><h3>6. Adam (Adaptive Moment Estimation)</h3><p>Adam combines Momentum and RMSProp, maintaining exponentially decaying averages of gradients and squared gradients:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i1dNoy8aD-fhwAwHepf1YA.png" /></figure><h4>Pros:</h4><ul><li>Works well out of the box.</li><li>Handles sparse gradients efficiently.</li></ul><h4>Cons:</h4><ul><li>Computationally intensive.</li></ul><h3>Choosing the Right Optimiser</h3><ol><li><strong>Start with Adam</strong>: It’s a robust choice for most problems.</li><li><strong>Use SGD or Momentum</strong>: If training large datasets with consistent gradients.</li><li><strong>Choose AdaGrad/RMSProp</strong>: For sparse or non-stationary data.</li></ol><p><strong>Final Thoughts</strong><br><em>Optimisers are the secret sauce of deep learning training. Understanding their behaviour and mathematics is crucial for selecting the right one for your task. Experimentation and tuning are often required, but the right choice can make a significant difference.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1649112cee17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing CUDA and cuDNN on Ubuntu 20.04 for Deep Learning]]></title>
            <link>https://medium.com/@pixalytix/installing-cuda-and-cudnn-in-ubuntu-20-04-for-deep-learning-666bfd2ea069?source=rss-0ec6df3255a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/666bfd2ea069</guid>
            <dc:creator><![CDATA[Pixalytix]]></dc:creator>
            <pubDate>Tue, 04 Jun 2024 15:45:02 GMT</pubDate>
            <atom:updated>2024-06-04T19:59:04.891Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="nvidia-smi command" src="https://cdn-images-1.medium.com/max/919/1*YwPATmykAXhw2s6VI-azww.png" /><figcaption>A snapshot of the GPU hardware details from the “nvidia-smi” command output.</figcaption></figure><p><strong>FYI: This guide is also compatible and has been tested on Ubuntu 22.04.</strong></p><p>Two important tools made to capitalize on GPU acceleration for deep neural networks are the<strong> NVIDIA CUDA Toolkit</strong> and the <strong>NVIDIA CUDA Deep Neural Network</strong> <strong>library (cuDNN)</strong>.</p><p>The CUDA Toolkit, a development environment for creating GPU-accelerated apps that run on NVIDIA hardware, is utilised by the primitives in the cuDNN library.</p><p>We presume that you have a fresh Ubuntu installation and some basic experience with running commands in Bash. This instance does not cover any optimizations or customizations.</p><p>If you run into any problems during the installation, please don’t hesitate to comment.</p><p>Having said that, this is how to install cuDNN 9.8.7 and CUDA Toolkit 12.2 on Ubuntu 20.04 .</p><p>If you want to use Docker, pull the Docker image using the below command:</p><pre>$  sudo docker pull nvidia/cuda:12.0.1-runtime-ubuntu20.04</pre><p>Check if the Docker image is installed and get image details:</p><pre>$  sudo docker images</pre><p><strong>To run the Docker image:</strong></p><p>Replace &lt;IMAGE ID&gt; with the image ID that you got from the previous command.</p><pre>$  sudo docker run -it --gpus all &lt;IMAGE ID&gt; bash</pre><p>Once you are inside the Docker environment, clear up the pre-installed Cuda version.</p><p>To do so, follow the below mentioned steps:</p><pre>$ cd usr/local/<br>$ rm -rf &lt;folder name&gt;</pre><ol><li><strong>Pre-Requisites</strong></li></ol><p><strong>a. Let’s start:</strong></p><p>Make sure your NVIDIA hardware is CUDA capable first. Use the following command to accomplish this, and look for an output that resembles this one:</p><pre>$ lspci | grep -i nvidia<br><br>13:00.0 3D controller: NVIDIA Corporation Device 27b8 (rev a1)</pre><p>Next, navigate to your home directory, install the Linux kernel headers, and update the package manager’s state:</p><pre>$ cd ~<br>$ sudo apt update<br>$ sudo apt upgrade<br>$ sudo apt install linux-headers-$(uname -r)</pre><p><strong>b. Download NVIDIA CUDA Toolkit:</strong></p><p>Open the cuda-downloads link <a href="https://developer.nvidia.com/cuda-12-2-0-download-archive">https://developer.nvidia.com/cuda-12-2-0-download-archive</a> and choose Linux &gt; x86_64 &gt; Ubuntu &gt; 20.04 &gt; runfile (local). This should be the suggested command that appears as a result:</p><pre>$ apt-get install wget<br>$ wget https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run</pre><p><strong>c. Disable the Nouveau drivers:</strong></p><p>The next step is to disable the Nouveau drivers, which are installed by default on most Ubuntu installs and interfere with the CUDA installation process.</p><p>Make the following file at /etc/modprobe.d/blacklist-nouveau.conf to accomplish this:</p><pre>blacklist nouveau<br>options nouveau modeset=0</pre><p>And regenerate the kernel initramfs:</p><pre>$ sudo update-initramfs -u</pre><p>R<strong>eboot your device</strong> so the Nouveau drivers get unloaded.</p><p><strong>d. Install the NVIDIA driver from command line:</strong></p><p>Check the available drivers for your hardware</p><pre>$ sudo ubuntu-drivers list</pre><p>You should see a list such as the following:</p><pre>nvidia-driver-470<br>nvidia-driver-470-server<br>nvidia-driver-535<br>nvidia-driver-535-open<br>nvidia-driver-535-server<br>nvidia-driver-535-server-open<br>nvidia-driver-550<br>nvidia-driver-550-open<br>nvidia-driver-550-server<br>Nvidia-driver-550-server-open</pre><p><strong>Installing the driver</strong></p><p>You can either rely on automatic detection, which will install the driver that is considered the best match for your hardware:</p><pre>sudo ubuntu-drivers install</pre><p>Or you can tell the ubuntu-drivers tool which driver you would like installed. If this is the case, you will have to use the driver version (such as 550) that you saw when you used the ubuntu-drivers list command.</p><p>We have installed 550 driver:</p><pre>sudo ubuntu-drivers install nvidia:550</pre><p>Use the nvidia-smi command to confirm that the NVIDIA driver is installed and operational:</p><figure><img alt="nvidia-smi command result" src="https://cdn-images-1.medium.com/max/919/1*YwPATmykAXhw2s6VI-azww.png" /><figcaption>nvidia-smi command result</figcaption></figure><p>2. <strong>Install the CUDA Toolkit</strong></p><p><strong>a. Run the installer and update the shell:</strong></p><p>With everything ready, let’s begin installing the CUDA Toolkit.</p><p>Execute the subsequent command to install the Toolkit directly without the need for extra tools, like the driver (which is already installed) .</p><pre>$ apt-get install libxml2<br>$ sudo sh cuda_12.2.0_535.54.03_linux.run --toolkit --silent --override</pre><p>Check that the library files exist as indicated in the image to ensure that CUDA was installed correctly:</p><figure><img alt="CUDA installation" src="https://cdn-images-1.medium.com/max/1024/1*K4yeXfZrIV5GRc-Scs3sLQ.png" /><figcaption>Checking CUDA files</figcaption></figure><p>To open file in command prompt:</p><pre>$ apt-get install nano <br>$ nano ~/.bashrc</pre><p>Adding these lines at the end to the shell:</p><pre># NVIDIA CUDA Toolkit<br>export CUDA_HOME=/usr/local/cuda-12.2<br>export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH<br>export PATH=${CUDA_HOME}/bin:${PATH}</pre><p>And <em>resource</em> the file to update the current terminal session:</p><pre>$ source ~/.bashrc</pre><p><strong>b. Check Cuda installation</strong></p><p>It is advised to test the installation before proceeding with the cuDNN installation.</p><p>Use the following command to make sure the driver version that is loaded is the proper one:</p><pre>$ nano proc/driver/nvidia/version</pre><figure><img alt="check cuda version" src="https://cdn-images-1.medium.com/max/907/1*mxiQ052Z82WgC3oOMVL-YQ.png" /></figure><p>Verify that the compiler is installed with nvcc — version:</p><figure><img alt="cuda installation check" src="https://cdn-images-1.medium.com/max/472/1*fviQKmxy3Ce1oALhLqt8HQ.png" /></figure><p>Now, use Git to obtain the CUDA Samples repository from GitHub (run $ sudo apt install git if it’s not already installed):</p><pre>$ git clone https://github.com/NVIDIA/cuda-samples.git</pre><p>Next, locate the deviceQuery utility’s directory and compile it:</p><pre>$ cd cuda-samples/Samples/1_Utilities/deviceQuery/<br>$ make</pre><p>Once it has been compiled, run it:</p><pre>$ ./deviceQuery</pre><p>This output, which shows that CUDA is correctly installed and operating, should appear to you.</p><pre>./deviceQuery Starting...<br>CUDA Device Query (Runtime API) version (CUDART static linking)<br>Detected 1 CUDA Capable device(s)<br>Device 0: &quot;NVIDIA L4&quot;<br> CUDA Driver Version / Runtime Version          12.2 / 12.2<br> ...<br>Result = PASS</pre><p>3. <strong>Install the cuDNN library</strong></p><p>Refresh the repository metadata:</p><pre>$ sudo apt-get update</pre><p>The runtime library, development library, examples, and samples will all be installed. <a href="https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-897/install-guide/index.html">Click here</a> for more details.</p><p>Use the following instructions to accomplish this:</p><pre>$ sudo apt-get install libcudnn8=9.8.7.29-1+cuda12.2<br>$ sudo apt-get install libcudnn8-dev=9.8.7.29-1+cuda12.2<br>$ sudo apt-get install libcudnn8-samples=9.8.7.29-1+cuda12.2</pre><p><strong>Test the CuDNN installation</strong></p><p>We will use the mnistCUDNN sample to verify that cuDNN is installed and operating as intended.</p><p>Copy the samples to a writable directory, enter it, and compile mnistCUDNN to accomplish this:</p><pre>$ cp -r /usr/src/cudnn_samples_v8/ $HOME<br>$ cd  $HOME/cudnn_samples_v8/mnistCUDNN<br>$ make clean &amp;&amp; make</pre><p>Install the FreeImage library with $ sudo apt install libfreeimage3 libfreeimage-dev if you receive an error about a missing or incorrectly configured FreeImage.h.</p><p>To test the installation, run the sample now:</p><pre>$ ./mnistCUDNN </pre><p>An output similar to this one should appear, indicating that the installation of CUDA and cuDNN is complete and ready for use!</p><pre>Test Passed!</pre><p><strong>Clean up</strong></p><p>Certain files can be securely removed after installation as we won’t need them any longer:</p><pre>$ rm -rf cuda-samples cuda_12.2.0_535.54.03_linux.run<br>$ sudo apt autoremove -y</pre><p><strong>Sources:</strong></p><ul><li>NVIDIA CUDA Installation Guide for Linux <a href="https://docs.nvidia.com/cuda/cuda-installation-guide-linux/">https://docs.nvidia.com/cuda/cuda-installation-guide-linux/</a></li><li>NVIDIA cuDNN Installation Guide <a href="https://docs.nvidia.com/deeplearning/cudnn/install-guide/">https://docs.nvidia.com/deeplearning/cudnn/install-guide/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=666bfd2ea069" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>