<?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 Aishwarya Rajapur on Medium]]></title>
        <description><![CDATA[Stories by Aishwarya Rajapur on Medium]]></description>
        <link>https://medium.com/@platform-10?source=rss-371800e620bd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7gUa-UHjNBmLewRx4Hn3gw.png</url>
            <title>Stories by Aishwarya Rajapur on Medium</title>
            <link>https://medium.com/@platform-10?source=rss-371800e620bd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 01:36:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@platform-10/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[Leetcode Premium: Binary Vertical Order Traversal]]></title>
            <link>https://platform-10.medium.com/leetcode-premium-binary-vertical-order-traversal-31028903eede?source=rss-371800e620bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/31028903eede</guid>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[binary-tree]]></category>
            <category><![CDATA[leetcode-medium]]></category>
            <dc:creator><![CDATA[Aishwarya Rajapur]]></dc:creator>
            <pubDate>Wed, 11 Jun 2025 16:55:17 GMT</pubDate>
            <atom:updated>2025-06-11T16:55:17.009Z</atom:updated>
            <content:encoded><![CDATA[<h3>Description</h3><p>Given the root of a binary tree, return the vertical order traversal of its nodes’ values (from top to bottom, column to column). If two nodes are in the same row and column, the order should be from left to right.</p><h3>First Thoughts</h3><p>The words “vertical order traversal” reminded me of “level order traversal”, which is another binary tree problem most commonly implemented with <strong>BFS</strong>. The description of this problem uses the words <strong>“column”</strong> and <strong>“row”,</strong> which made me consider this problem like a grid or matrix.</p><p>If we have to look at the binary tree through the lens of columns, we can assume that the root node of the tree will be at column 0. If you imagine the root node of the tree at the origin of a Cartesian grid, everything to the left hand side would be negative values and everything to the right hand side would be positive.</p><h3>Approach</h3><p>If we assume the root node is column 0, and it’s left child is column -1 and it’s right child is column +1, we can see where this is leading. We can use BFS and a dict of some sort to store information in the form of (<strong>column: [list of nodes]).</strong> We have to modify our BFS to take in a second parameter — a column value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DUx7kd7_SDsp_ZhD5jDf0g.png" /></figure><p>For the tree above, notice that the nodes at column 0 are: [1, 10, 9, 6]. The nodes at column -1 are: [2, 5]. The nodes at column 1 are: [3]. The nodes at column -2 are: [4]. The nodes at column 2 are: [11]</p><h3>Code</h3><pre>class Solution:<br>    def verticalOrder(self, root: Optional[TreeNode]) -&gt; List[List[int]]:<br>        ret = []<br><br>        def bfs(node, col):<br>            d = defaultdict(list)<br>            q = deque()<br>            q.append((node, col))<br>            while (q):<br>                n, c = q.popleft()<br>                d[c].append(n.val)<br>                if n.left:<br>                    q.append((n.left, c - 1))<br>                if n.right:<br>                    q.append((n.right, c + 1))<br>            return d<br><br>        vertical = bfs(root, 0)<br>        for i in sorted(vertical.items()):<br>            ret.append(i[-1])<br>        return ret</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31028903eede" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating the PyTorch Repo Part 1]]></title>
            <link>https://platform-10.medium.com/navigating-the-pytorch-repo-part-1-c6b9c139688a?source=rss-371800e620bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6b9c139688a</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[autograd]]></category>
            <dc:creator><![CDATA[Aishwarya Rajapur]]></dc:creator>
            <pubDate>Mon, 28 Apr 2025 20:46:03 GMT</pubDate>
            <atom:updated>2025-04-28T20:46:03.481Z</atom:updated>
            <content:encoded><![CDATA[<p>These are just a few notes and things I have learned while doing a deep dive on the PyTorch repo</p><h3>Intro</h3><p>I want to first start off by saying I do not work for PyTorch. I was interested in trying to contribute to open source and have spent about four weeks understanding the codebase. I will highlight a few resources from people (who I believe are closely affiliated with PyTorch) that have helped me in my learning.</p><p>The repo I am referring to is located here: <a href="https://github.com/pytorch/pytorch">https://github.com/pytorch/pytorch</a></p><h3>High Level</h3><h4>Note on Devices and Dispatching</h4><p>CUDA allows us to run our code on GPUs instead of our machine’s CPUs. Here is an example of using PyTorch on a GPU:</p><pre>x = torch.tensor([1.0, 2.0, 3.0], device=&#39;cuda&#39;)<br>y = x ** 2</pre><p>Tensor x is allocated on GPU memory. Y is the result of squaring tensor x (otherwise using pow()). PyTorch dispatches math operations to CUDA’s kernel functions. The CUDA kernels run in parallel on the GPU. PyTorch’s dynamic dispatch function is a huge topic — one that is covered well in this article: <a href="https://blog.ezyang.com/2020/09/lets-talk-about-the-pytorch-dispatcher/">https://blog.ezyang.com/2020/09/lets-talk-about-the-pytorch-dispatcher/</a>.</p><h4>Backend</h4><p>PyTorch’s backend is written in C++ (ATen, Caffe). C++ is a strongly-typed language, offering more control on memory allocation and multithreading capabilities. C++ is very <strong>fast </strong>because it compiles directly to machine code. In addition, CUDA is based on C++. These are located in <a href="https://github.com/pytorch/pytorch/tree/main/aten"><strong>aten/ </strong></a>and <a href="https://github.com/pytorch/pytorch/tree/main/c10"><strong>c10/</strong></a><strong>.</strong></p><p><strong>aten/ </strong>is the core tensor library that is reponsible for all the math that happens to tensors. If you are looking at tensor math issues, looking into <strong>aten/ </strong>would be helpful in providing context.</p><p><strong>c10/ </strong>is still quite mysterious to me. I believe it helps with devices and memory management somehow.</p><h4>Autograd</h4><p>The autograd engine is the component that computes gradients. Whenever you call <em>.backward()</em>, you are using the autograd engine. This computes the vector-Jacobian product. Here is a really good video explaining automatic differentiation: <a href="https://www.youtube.com/watch?v=wG_nF1awSSY">https://www.youtube.com/watch?v=wG_nF1awSSY</a>. The autograd files are located in <a href="https://github.com/pytorch/pytorch/tree/main/torch/csrc/autograd"><strong>torch/crsc/autograd</strong></a><strong>.</strong></p><p>Inside <a href="https://github.com/pytorch/pytorch/tree/main/torch/csrc/autograd"><strong>torch/crsc/autograd</strong></a>/, bindings between C++ and Python are auto-generated. The Core autograd engine responsible for the backward graph execution and Python bindings also lives here.</p><pre>c = torch.mul(a, b) #corresponds to MulBackward<br>c.backward() #c.grad_fn = MulBackward</pre><p>When variable <em>c </em>is created, PyTorch creates a MulBackward computation graph node to be used in the backward pass. For the backward pass, we have to compute <em>dc/da </em>and <em>dc/db </em>which MulBackward handles. When we call <em>c.backward(), </em>the autograd engine will start running from<em> c</em>’s grad function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*5WJgl7CUdB8YjvBAHe5J8g.png" /><figcaption>Ignore my bad handwriting please</figcaption></figure><h4>Frontend</h4><p>The frontend is written in Python. This is the component most people are familiar with. The frontend has modules like the classic nn.Sequential, optimizers, losses, and a lot of other useful ones. The frontend files are usually in <a href="https://github.com/pytorch/pytorch/tree/main/torch"><strong>torch/</strong></a><strong>.</strong></p><pre>model = torch.nn.Linear(10, 5)<br>output = model(input)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6b9c139688a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Music and Abstract Algebra]]></title>
            <link>https://medium.com/platform10/music-and-abstract-algebra-04a019fb3993?source=rss-371800e620bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/04a019fb3993</guid>
            <category><![CDATA[group-theory]]></category>
            <category><![CDATA[music-theory]]></category>
            <category><![CDATA[algebra]]></category>
            <category><![CDATA[abstract-algebra]]></category>
            <category><![CDATA[music]]></category>
            <dc:creator><![CDATA[Aishwarya Rajapur]]></dc:creator>
            <pubDate>Sat, 19 Apr 2025 22:36:12 GMT</pubDate>
            <atom:updated>2025-04-19T22:36:12.304Z</atom:updated>
            <content:encoded><![CDATA[<h3>Intro</h3><p>A friend of mine told me about a paper that made the connection between music and group theory. The paper is called <a href="https://arxiv.org/pdf/0711.1873">“Musical Actions of Dihedral Groups”</a>. The paper goes into mathematical rigor defining the actions using more group theory, but I think dihedral groups are a really cool and interesting way to think about music. Since a lot of people are familiar with the musical clock, a group theory application has been waiting to happen. This paper was so fun to read and also very dense.</p><h4>Dihedral Group</h4><p>A dihedral group is the group of symmetries of a regular polygon. This means all the ways you can flip or rotate the shape so it looks the same. If we think about a triangle, we can rotate and flip the points (purple, orange, blue) in a few ways.</p><ul><li>We can pretend this triangle did a cartwheel (120 degrees clockwise) so that the purple point is on the bottom right and the orange point is on top</li><li>We can pretend this triangle did another cartwheel again (240 degrees clockwise) so that the orange point is on the bottom right and the blue point is on top</li><li>We can draw a vertical line through the triangle and split it in half and flip it about this vertical line</li><li>We can flip the triangle in 2 ways diagonally and still achieve the same shape</li></ul><p>We can also do nothing, which is the identity element in this dihedral group (D3)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2F2nNGSFua_3PBbEcpmbEw.png" /></figure><h3>Modeling Pitch Classes as Integers Mod 12</h3><h4>Musical Clock</h4><p>The paper assumes equal tempered tuning, so an octave is divided into 12 pitch classes. This translates well to a “clock” of integers modulo 12. We can determine the interval from one pitch class to another. The authors use the example of D to G# — which has an interval of 6 semitones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-yGu5ENUTdbJMHYCaeUXuw.png" /><figcaption>Z12</figcaption></figure><h4>Major and Minor Triads</h4><ul><li>A major triad consists of a root note, a second note (4 semitones above), and a third note (7 semitones above) — <strong>&lt;0, 4, 7&gt;</strong></li><li>A minor triad consists of a root note, a second note (3 semitones above), and a third (7 semitones above) —<strong> &lt;0, 3, 7&gt;</strong></li></ul><p>If we take C major (C, E, G) and apply an inversion with <em>n = 0, </em>the result is an f minor triad. We can do this for all of the major triads and get a resulting minor triad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QGgsW-VI-ShPH5tzxm9Ang.png" /><figcaption>Yellow = Cmaj, Pink = fminor</figcaption></figure><h3>Musical Actions Part 1</h3><h4>Transposition</h4><p>The general idea of a transposition is that it moves a sequence of pitches up or down. From the Integers mod 12 clock above, the authors define a transposition by an integer mod 12. A transposition on the musical clock where <em>n = 1</em> (T1) can be represented as a rotation clockwise by 1/12 of a turn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*Nt-eW4YrPglzKkydshzzcA.png" /></figure><h4>Inversion</h4><p>An inversion can be represented on the musical clock by the same flipping action we did with triangles earlier. The inversion with <em>n = 0</em> is essentially flipping about the 0–6 axis on the musical clock.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*lRRxYBWuksNEPmC2Freu7g.png" /></figure><h4>Using Both Inversions and Transpositions</h4><p>Inversions with<em> n = 0 </em>and transpositions with <em>n = 1 </em>generate the dihedral group of symmetries for our (assumed to be smooth circle for simplicity) 12-gon. <strong>We can combine 12 transpositions and 12 inversions to form a dihedral group of order 24.</strong></p><h3>Musical Actions Part 2</h3><h4>PLR</h4><p>I think this part is really cool. I am going to give a brief summary of what these letters mean:</p><ul><li>P : <strong>parallel</strong> — maps a major triad to its parallel minor, <strong>ex: P(C-major) = c-minor</strong></li><li>L : <strong>leading tone exchange </strong>— maps a major triad to the minor by lowering the root by a semitone, <strong>ex: L(C-major) = e-minor</strong></li><li>R : <strong>relative</strong> — maps a major triad to its relative minor, <strong>ex: R(C-major) = a-minor</strong></li></ul><p>The authors of the paper define a PLR-group as the subgroup of the symmetric group on the set S generated by the bijections P, L, and R. The setup they make is truly clever — they characterize P, L, and R as types of inversions. The only catch is that the axis of inversion (when we drew a line from 0 to 6 above) depends on the aggregate input triad.</p><p>P, L, and R all serve as involutions. The authors prove that the PLR-group is generated by L and R and is a dihedral of order 24.</p><h3>Sources</h3><ul><li>Musical Actions of Dihedral Groups Alissa S. Crans, Thomas M. Fiore, and Ramon Satyendra November 26, 2024</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04a019fb3993" width="1" height="1" alt=""><hr><p><a href="https://medium.com/platform10/music-and-abstract-algebra-04a019fb3993">Music and Abstract Algebra</a> was originally published in <a href="https://medium.com/platform10">platform10</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kolmogorov-Arnold Networks Simplified]]></title>
            <link>https://medium.com/platform10/kolmogorov-arnold-networks-simplified-7967538eb106?source=rss-371800e620bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/7967538eb106</guid>
            <dc:creator><![CDATA[Aishwarya Rajapur]]></dc:creator>
            <pubDate>Sun, 06 Apr 2025 21:06:57 GMT</pubDate>
            <atom:updated>2025-04-06T22:30:58.380Z</atom:updated>
            <content:encoded><![CDATA[<h3>Intro</h3><p>The full paper can be found here: <a href="https://arxiv.org/pdf/2404.19756">https://arxiv.org/pdf/2404.19756</a>. This article should provide a simpler explanation for the background, model architecture, model performance, and areas of further research.</p><p>The biggest takeaway for me is that these networks can perform better than a multi-layer perceptron (MLP) because it greatly reduces the effects of the “curse of dimensionality”. The most promising quality of KANs are its applications to solving and approximating differential equations compared to MLPs. From a mathematical physics standpoint, it can be used to approximate symbolic and special functions.</p><h3><strong>Background</strong></h3><p>The Kolmogorov-Arnold Representation Theorem (KART) says that if <em>f </em>is a multivariate continuous function, then<em> f </em>can be written as a finite composition of continuous univariate functions and the operation of addition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*BNu10sW18mOgQPb72Yp05w.png" /><figcaption>KART Definition from Wikipedia</figcaption></figure><p>In short, the multivariate continuous function <em>f </em>can be expressed as a superposition or linear combination of continuous univariate functions.</p><h3>KART Into Network</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K3jukFyYSpBSmrrf3q8mCg.png" /><figcaption>KART into Network</figcaption></figure><p>In the diagram above, you can see this is basically already a shallow network — with the first KAN layer (first row of functions above inputs) of size <strong>5 x 2 </strong>and the second layer of size <strong>1 x 5</strong>. The main idea here is that the 1D activation functions on the edges are <strong>learnable. </strong>This shallow representation can be made deeper if the function <em>f </em>has more compositions.</p><h3>How are They Making Activations Learnable?</h3><p>In the paper, an activation function is parameterized as a <strong>basis spline</strong> function (B-Spline), which allows for grid switching. A <strong>spline </strong>is a “piecewise” by polynomials. In numerical analysis, multigrids are a way to solve differential equations by discretizing. The use of B-splines allow you to switch between coarse-grained and fine-grained grids.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gT9uqV-252pPuJGQzG5-bQ.png" /><figcaption>K = 3 implies a cubic spline</figcaption></figure><p>The c<em>i</em> in the image above are all trainable. The spline grids are updated on the fly. The authors of the paper use this way of updating because splines have bounds (in the image above, these are the dotted vertical lines). Because splines are bounded, some activation values can evolved out of this bounded region during training. The <em>G </em>in the image above is the number of intervals or grid points.</p><p>In my opinion, this is pretty important because it is a significant reason for why KANs can approximate functions well, indepedent of dimension. <strong>Main takeaway: they are using splines to approximate 1D functions.</strong></p><h3>Grid Extension</h3><p>In the section about grid extension in the paper, the authors say “a spline can be made arbitrarily accurate to a target function as the grid can be arbitrarily fine-grained”. This is just saying increasing the grid size can lead to better approximations.</p><p>I am not going to go into too much detail here. <strong>The important thing to take away is that MLPs can not do any fine graining.</strong></p><h3>Sources</h3><ul><li><a href="https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Arnold_representation_theorem">https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Arnold_representation_theorem</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7967538eb106" width="1" height="1" alt=""><hr><p><a href="https://medium.com/platform10/kolmogorov-arnold-networks-simplified-7967538eb106">Kolmogorov-Arnold Networks Simplified</a> was originally published in <a href="https://medium.com/platform10">platform10</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>