<?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 Utkarsh on Medium]]></title>
        <description><![CDATA[Stories by Utkarsh on Medium]]></description>
        <link>https://medium.com/@khalibartan?source=rss-de0581108f1a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*DoYnvFJg5DpJa2mI.</url>
            <title>Stories by Utkarsh on Medium</title>
            <link>https://medium.com/@khalibartan?source=rss-de0581108f1a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 06:38:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@khalibartan/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[Google Summer of Code Week 1]]></title>
            <link>https://medium.com/@khalibartan/google-summer-of-code-week-1-7c61b67e343?source=rss-de0581108f1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c61b67e343</guid>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Utkarsh]]></dc:creator>
            <pubDate>Sat, 04 Jun 2016 06:22:36 GMT</pubDate>
            <atom:updated>2016-06-04T06:23:45.481Z</atom:updated>
            <content:encoded><![CDATA[<p>This week of work proved to be quite productive. I was consistent with my proposed time line. For this week work I proposed to write base class structure for Hamiltonian Monte Carlo (HMC), and implement methods for leapfrog, modified Euler and algorithm for finding a reasonable starting value of epsilon. During the start I wrote the leapfrog and modified Euler as methods of HMC class, but my mentor told me to write a base class and using that base class write leapfrog and modified Euler as different classes.</p><p>The earlier structure looked something like this:</p><pre>class HamiltonianMCda(object):<br>    def __init__(self, discretize_time=&#39;leapfrog&#39;, *args):<br>        # Some arguments and parameters<br>        # chooses discretization algorithm depending upon<br>        # the string passed to discretize_time<br>        pass<br>    def leapfrog(self):<br>        pass<br>    def modifiedEuler(self):<br>        pass</pre><p>But why did we settle upon base class implementation? With the earlier structure things were not flexible from user point of view. What if user want to plug-in his own implementations. After the changes I created a base class called <strong>DiscretizeTime , </strong>class inheriting this could then be passed as an argument for discretization of time. Advantage of having a base class is that it provides a basic structure to the things, and adds extensibility. Now things look something like this:</p><pre>class DiscretizeTime(object):<br>    def __init__(self, *args):<br>        pass</pre><pre>    def discretize_time(self):<br>        # returns the initialized values<br>        pass</pre><pre>class LeapFrog(DiscretizeTime):<br>    def __init__(self, *args):<br>        pass</pre><pre>    def _discretize_time(self):<br>        # computes the values and initializes the parameters<br>        pass</pre><pre>class HamiltonianMCda(object):<br>    def __init__(self, discretize_time=LeapFrog, *args):<br>        # discretize_time is a subclass of DiscretizeTime<br>        pass</pre><p>Now using these base class user can pass his/her own implementations as an argument.</p><p>I also wrote other base classes for finding Log of probability Distribution and Gradient of the log. During the time of writing my GSoC proposal me and my couldn’t decide how these methods for finding log and its gradient should be implemented. In this week meeting with the mentor, I proposed that I’ll write method in each model classes we will be implementing, and use that, if user doesn’t provide a class inheriting the base class for gradients and we settled upon it.</p><p>Though this week work was great, but still there are things which remain unclear, from theoretical point. How to parameterize a continuous model still remains in doubt. Currently I have assumed that model parameterization will be of a matrix or array type structure. This assumption is good enough for the most of the common models I have came across, but things cannot be stated with certainty that it will generalize to all kind of continuous models. Me and my mentor are looking into things more deeply and hopefully we will find some solution soon. For the next week I’ll try to finish the Hamiltonian Monte Carlo sampler.</p><p><strong>Links</strong></p><ol><li><em>Pull Request for Hamiltonian Monte Carlo</em> :<a href="https://github.com/pgmpy/pgmpy/pull/691">https://github.com/pgmpy/pgmpy/pull/691</a></li><li><em>My GSoC Proposal Draft</em>: <a href="https://docs.google.com/document/d/1W0iGbof58Jf98PCK1xKXdHY7-2dUwdctHDppWfE2sO4/edit?usp=sharing">https://docs.google.com/document/d/1W0iGbof58Jf98PCK1xKXdHY7-2dUwdctHDppWfE2sO4/edit?usp=sharing</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c61b67e343" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GSoC 2016 with pgmpy]]></title>
            <link>https://medium.com/@khalibartan/gsoc-2016-with-pgmpy-288f53fdadb?source=rss-de0581108f1a------2</link>
            <guid isPermaLink="false">https://medium.com/p/288f53fdadb</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[gsoc]]></category>
            <dc:creator><![CDATA[Utkarsh]]></dc:creator>
            <pubDate>Sun, 15 May 2016 07:31:27 GMT</pubDate>
            <atom:updated>2016-05-15T07:35:46.517Z</atom:updated>
            <content:encoded><![CDATA[<p>This all started around a year back, when I got introduced to open source (Free and Open Source, Free as in speech) world. Feeling of being a part of something big was itself amazing and to add someone will be using my work in something great this proved to be more than driving force needed to get me going. The more I worked the more addicted I got. In around October 2015 through my <a href="https://medium.com/@hargup">brother</a> and some answers on Quora I came to know about <a href="http://pgmpy.org/"><strong>pgmpy</strong></a>(A python library for Probabilistic Graphical Models), and since then I have been contributing continuously. Working with pgmpy have been a great learning experience, I learned lots of new things about python which I didn’t know earlier and of-course Probabilistic Graphical Models. I also came to know about PEP (Python Enhancement Proposals), and especially PEP8 , which made Python code more beautiful to read.</p><p><a href="https://docs.google.com/document/d/1W0iGbof58Jf98PCK1xKXdHY7-2dUwdctHDppWfE2sO4/edit?usp=sharing"><strong>The Proposal</strong></a></p><p>My Proposal deals with adding two new sampling algorithms in pgmpy namely:</p><ul><li>Hamiltonian Monte Carlo</li><li>No U Turn Sampler</li></ul><p>If they don’t click anything to you, then no need to worry, even I wasn’t familiar with them before February 2016. Some more blog posts from my side and hopefully you will feel at home with these terms.</p><p>These two algorithms have become quite popular in recent time due to there accuracy and speed. Hamiltonian Monte Carlo (HMC) and No U Turn Sampler(NUTS) are Markov chain Monte Carlo (MCMC) algorithms / methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*xfK_RdBZOkE4buKDPDZdKg.png" /><figcaption>A Markov Chain [1]</figcaption></figure><p>Markov Chains is a transition model with property that the probability distribution of next state in the chain depends on the transition function associated with current state, not the other preceding states in the process. A random walk in Markov Chain gives a sample of that distribution. Markov Chain Monte Carlo sampling is a process that mirrors this behavior of Markov Chain.</p><p>Currently pgmpy provides two sampling classes, A range of algorithms namely Forward sampling, Rejection Sampling and Likelihood weighted sampling which are specific to Bayesian Model and Gibbs Sampling a MCMC algorithm that generates samples from both Bayesian Network and Markov models. Hamiltonian/Hybrid Monte Carlo (HMC<strong>) </strong>is a MCMC algorithm that adopts physical system dynamics rather than a probability distribution to propose future states in the Markov chain. No U Turn Sampler (NUTS)<strong> </strong>is an extension of Hamiltonian Monte Carlo that does not require the number of steps L (a parameter that is crucial for good performance in case of HMC).</p><p><strong>Post Script: </strong>The next series of posts will serve as an introduction to probabilistic sampling and Markov Chain Monte Carlo, specifically with introduction to Hoeffding’s inequality, Markov Chains, MCMC techniques such as Metropolis-Hastings, Gibbs sampler, and HMC.</p><p><strong>References</strong></p><p>[1] <a href="https://en.wikipedia.org/wiki/Markov_chain">Wikipedia, Markov Chain</a></p><p>[2] <a href="https://mitpress.mit.edu/books/probabilistic-graphical-models">Probabilistic Graphical Models Principles and Techniques: Daphne Koller, Nir Friedman</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=288f53fdadb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>