<?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 Vineet Joshi on Medium]]></title>
        <description><![CDATA[Stories by Vineet Joshi on Medium]]></description>
        <link>https://medium.com/@safarnamabyvineet?source=rss-fb7aade8b6fa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iuNefnM6ACxggApFC_K2Bw.jpeg</url>
            <title>Stories by Vineet Joshi on Medium</title>
            <link>https://medium.com/@safarnamabyvineet?source=rss-fb7aade8b6fa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:10:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@safarnamabyvineet/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[DL 1O1: Understanding Softmax Function]]></title>
            <link>https://medium.com/@safarnamabyvineet/dl-1o1-understanding-softmax-function-cf012d897fdf?source=rss-fb7aade8b6fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf012d897fdf</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[softmax]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Vineet Joshi]]></dc:creator>
            <pubDate>Sun, 20 Jan 2019 05:15:52 GMT</pubDate>
            <atom:updated>2019-01-20T05:15:52.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9wHrewC1Dyf2Au_qEqwWcg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/B3l0g6HLxr8?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Blake Connally</a> on <a href="https://unsplash.com/search/photos/computer?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Softmax function calculates the probabilities distribution of the event over ’n’ different events. In general way of saying, this function will calculate the probabilities of each target class over all possible target classes. Later the calculated probabilities will be helpful for determining the target class for the given inputs.</p><p>For example, let say our model returned a vector Y as [1.0, 2.0, 3.0], then the softmax function will return the probabilities of each class from the input logits. The softmax function is given by :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*-xLu-djyAfEo2UUfVuNMoA.png" /><figcaption>Image Source: <a href="https://www.google.com/url?sa=i&amp;source=images&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwjszNWHyPvfAhUHs48KHTTlBecQjhx6BAgBEAM&amp;url=https%3A%2F%2Fwww.oreilly.com%2Flibrary%2Fview%2Fpractical-convolutional-neural%2F9781788392303%2F2e8989a5-acd0-460a-bd66-44602f26a926.xhtml&amp;psig=AOvVaw1r-017PGpMVIvzkPfRlj4H&amp;ust=1548046310806048">Softmax in Python</a></figcaption></figure><h3>Properties of Softmax Function:</h3><p>Few of the import properties of Softmax functions are:</p><ol><li>The calculated probabilities will be in the range of 0 to 1.</li><li>The sum of all the probabilities is equals to 1.</li><li>If you multiply the scores obtain by the function with 10, the probabilities will get closer to 0 &amp; 1.</li><li>If you divide the scores by 10, the scores will get closer to a uniform distribution.</li></ol><h3>Softmax Function Usage</h3><ul><li>Used in multiple classification logistic regression model.</li><li>In building neural networks softmax functions used in different layer level.</li></ul><pre><strong>import</strong> <strong>numpy</strong> <strong>as</strong> <strong>np</strong><br><strong>import</strong> <strong>matplotlib.pyplot</strong> <strong>as</strong> <strong>plt</strong><br></pre><pre><strong>#Function to implement Softmax Function<br>def</strong> softmax(x):<br>   <strong>return</strong> np.exp(x)/np.sum(np.exp(x))</pre><pre><strong>#Function to plot the graph between Logits and Scores<br>def</strong> graph():<br>  X=range(0,21)<br>  Y=softmax(X)<br>  plt.plot(X, Y)<br>  plt.xlabel(&#39;Logits&#39;)<br>  plt.ylabel(&#39;Scores&#39;)<br>  plt.show()<br>  print(&#39;All the scores of a feature adds up to 1 since they are probabilities&#39;)<br>  print(np.sum(Y))<br>   <br><strong>def</strong> main():<br>  scores = [[1.0, 2.0, 3.0]]<br>  print(softmax(scores))<br>  print(&#39;Visual Representation of Softmax Function&#39;)<br>  graph()<br>  <br><strong>if</strong> __name__==&quot;__main__&quot;:<br>  main()</pre><h4>OUTPUT:</h4><p>[[0.09003057 0.24472847 0.66524096]]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*6LtlKVqIaSa4788W5yePbQ.png" /><figcaption>Visual Representation of Softmax Function</figcaption></figure><p>All the scores of a feature adds up to 1 since they are probabilities.</p><h4>To Learn More:</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQFkoVLvG_5s%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQFkoVLvG_5s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQFkoVLvG_5s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c8d4b3109996102f6fb35b3db99925a/href">https://medium.com/media/8c8d4b3109996102f6fb35b3db99925a/href</a></iframe><ul><li><a href="http://dataaspirant.com/2017/03/07/difference-between-softmax-function-and-sigmoid-function/">Difference between Softmax Function and Sigmoid Function</a></li><li><a href="https://medium.com/@uniqtech/understand-the-softmax-function-in-minutes-f3a59641e86d">Understand the Softmax Function in Minutes</a></li><li><a href="https://in.udacity.com/course/deep-learning--ud730-india">Deep Learning by Google</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf012d897fdf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Convert your images into PDF with just 4 lines of code.]]></title>
            <link>https://medium.com/@safarnamabyvineet/convert-your-images-into-pdf-with-just-4-lines-of-code-1d093a6a7b2f?source=rss-fb7aade8b6fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d093a6a7b2f</guid>
            <category><![CDATA[image]]></category>
            <category><![CDATA[pdf]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[script]]></category>
            <category><![CDATA[everyday-technology]]></category>
            <dc:creator><![CDATA[Vineet Joshi]]></dc:creator>
            <pubDate>Mon, 14 Jan 2019 13:50:39 GMT</pubDate>
            <atom:updated>2019-01-14T14:44:39.925Z</atom:updated>
            <content:encoded><![CDATA[<h3>Convert your image to PDF using just 4 lines of code.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q874E1DQT1XBByXG7MJsSw.jpeg" /><figcaption>Image source: <a href="https://unsplash.com/search/photos/coding">Unsplash.com</a></figcaption></figure><p>Today,<strong> Camscanner </strong>is<strong> </strong>one of the most well known and widely used applications for scanning and sharing of documents. It allows the user to scan via there mobile, apply image straightening and share multiple documents simultaneously as a PDF.</p><p>Often times, we face a similar situation in our system where we need to convert a pile of Images into a PDF, for ease of sharing and compaction. This tutorial will give you a basic 4 line python code to replicate this specific functioning of Camscanner and achieve the task.</p><h4>Let’s start</h4><p>Although a number of libraries are available on the internet which can be used to convert images into pdf but for this tutorial, we will use <a href="https://pypi.org/project/img2pdf/"><strong>img2pdf</strong></a>.</p><p>So before we understand how to use img2pdf, let&#39;s install it.</p><blockquote>Open the command prompt on your system and run the following script.</blockquote><pre>pip install img2pdf</pre><p>As explained in the original documentation, img2pdf allows us to perform a lossless conversion of images into PDF. A lossless conversion will always have the exact same color information for every pixel as the input, which is often the desired property. img2pdf gives a very basic function <strong>img2pdf.convert</strong>, to perform this task.</p><p>Now that our required library is installed, let&#39;s move ahead.</p><blockquote>Create a file chat.py and import os and img2pdf libraries.</blockquote><pre>import os<br>import img2pdf</pre><p>The OS module in Python provides a way of using operating system dependent functionality. We will be using it for accessing the images name in the CWD (Current Working Directory).</p><blockquote>Open the Output.pdf file in “wb” mode</blockquote><pre>with open(&quot;output.pdf&quot;, &quot;wb&quot;) as f:</pre><p>The “wb” indicates that we are writing in our output.pdf in binary mode.</p><blockquote>Run a loop inside the write method which pics up a “.jpeg” image,converts it and writes it to the pdf file.</blockquote><pre>with open(&quot;output.pdf&quot;, &quot;wb&quot;) as f:<br>    f.write(img2pdf.convert([i for i in os.listdir(&#39;.&#39;) if i.endswith(&quot;.jpg&quot;)]))</pre><p>The above code can be broken down for a better understanding. The <em>os.listdir()</em> method returns a list of all the files in the current directory, iterator ‘<em>i’, </em>traverses through the list and pics up jpeg images one by one, converts them and then write them to the output.pdf we opened earlier.</p><blockquote>To run the converter, just go to the command prompt and type</blockquote><h4>python Converter.py</h4><h4>Source Code:</h4><pre>import os<br>import img2pdf<br>with open(&quot;output.pdf&quot;, &quot;wb&quot;) as f:<br>    f.write(img2pdf.convert([i for i in os.listdir(&#39;.&#39;) if i.endswith(&quot;.jpg&quot;)]))</pre><p>Note: If you are straightaway copying the code for use, please make sure that all your images are in your CWD (Current Working Directory).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d093a6a7b2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>