<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://c-a-s-t-l-e.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://c-a-s-t-l-e.github.io/" rel="alternate" type="text/html" /><updated>2025-06-27T19:21:38+00:00</updated><id>https://c-a-s-t-l-e.github.io/feed.xml</id><title type="html">Regal Writing</title><subtitle>A personal blog that helps both of us get the gist.</subtitle><entry><title type="html">Thoughts on Growing the Garden</title><link href="https://c-a-s-t-l-e.github.io/2025/06/27/filename.html" rel="alternate" type="text/html" title="Thoughts on Growing the Garden" /><published>2025-06-27T00:00:00+00:00</published><updated>2025-06-27T00:00:00+00:00</updated><id>https://c-a-s-t-l-e.github.io/2025/06/27/filename</id><content type="html" xml:base="https://c-a-s-t-l-e.github.io/2025/06/27/filename.html"><![CDATA[<h3 id="a-problem">A Problem</h3>
<p>I'm not sure if everybody's had a problem like this.</p>
<p>With that said, think about a time when you've wondered down a rabbit whole of links while learning about a topic.</p>
<p>Now think about reviewing where you've gone down and then having sudden inspiration to make a new branch based on a new thought.</p>
<p>Do this a few more times and you've got ideas and connections going everywhere.</p>
<p>How do you then organize it all?</p>
<h3 id="a-mind-opening-solution">A Mind Opening Solution</h3>
<p>Recently, I've come upon an open source project called <a href="https://github.com/jackyzha0/quartz">Quartz</a>.</p>
<p>It's basically a really handy static site generator for Obsidian vaults.</p>
<p>(If you don't know what Obsidian is, definitely feel free to check out the free, privacy conscious software <a href="https://obsidian.md">here</a>.)</p>
<p>The premise is that the website Quartz generates is like a graph in the mathematical sense of the word.</p>
<p>Each markdown document is a node and each link between the markdown documents are edges.</p>
<h3 id="why-i-think-this-approach-matters">Why I Think This Approach Matters</h3>
<p>I think that this approach matters because once you've got a graph to look at you can see all the patterns you're mind as made over time.</p>
<p>You can shore up parts that you're lacking and have an infinite supply of new inspiration each time you look at the whole.</p>
<p>This could prove to be a way to enjoy your work and learning more.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[A Problem]]></summary></entry><entry><title type="html">Why I Want to Improve My Writing</title><link href="https://c-a-s-t-l-e.github.io/2025/03/28/filename.html" rel="alternate" type="text/html" title="Why I Want to Improve My Writing" /><published>2025-03-28T00:00:00+00:00</published><updated>2025-03-28T00:00:00+00:00</updated><id>https://c-a-s-t-l-e.github.io/2025/03/28/filename</id><content type="html" xml:base="https://c-a-s-t-l-e.github.io/2025/03/28/filename.html"><![CDATA[<p>There are a few reasons why
I want to improve my writing.</p>
<p>The first is that when you can communicate clearly
people can better understand you and your goals.</p>
<p>The second is that when you can write well
you can inspire others.</p>
<p>The first thing I would like to do
is to use sense-line formatting.</p>
<p>This approach will allow me
to identify ways to improve
the structure of the text.</p>
<p>At the very least,
it will also make
this blog easier to read
on mobile.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[There are a few reasons why I want to improve my writing.]]></summary></entry><entry><title type="html">An Overview of Tabnet - Tabular Data Deep Learning</title><link href="https://c-a-s-t-l-e.github.io/2025/01/11/filename.html" rel="alternate" type="text/html" title="An Overview of Tabnet - Tabular Data Deep Learning" /><published>2025-01-11T00:00:00+00:00</published><updated>2025-01-11T00:00:00+00:00</updated><id>https://c-a-s-t-l-e.github.io/2025/01/11/filename</id><content type="html" xml:base="https://c-a-s-t-l-e.github.io/2025/01/11/filename.html"><![CDATA[<p>Hey guys! I've been exploring the tabnet model for a few days since stumbling upon it in a Github repo. For the sake of the this post, I would just like to put down in words my understanding of the model to help you and I better understand it.</p>
<p>First and foremost, I would like to credit Francesco Pochetti for the images and symbolic dictionary from <a href="https://francescopochetti.com/tabular-deep-leaning-tabnet-deep-dive/">his blog post</a> on Tabnet. I would also like to point you in the direction of <a href="https://arxiv.org/pdf/1908.07442">the paper</a> and <a href="https://github.com/dreamquark-ai/tabnet">Dreamquark's Github repo</a> that has the model implemented in Pytorch.</p>
<p>With that being said, we could probably start with an initial overview of the model with the image below:</p>
<p><img src="http://c-a-s-t-l-e.github.io/images/tabnet/all_together.png" alt="" /></p>
<hr />
<p>To understand what we're looking at, we can reference the dictionary provided:</p>
<p><img src="http://c-a-s-t-l-e.github.io/images/tabnet/symbol_dictionary.png" alt="" /></p>
<p>As well as noting that:</p>
<p><strong>BS</strong> -&gt; batch size</p>
<p><strong>input</strong> -&gt; shape of the input dataset, e.g. number of features passed to the model.</p>
<p><strong>n_d</strong> -&gt; size of the decision layer, e.g. input features are mapped to n_d (where n_d&lt;input) in Fully Connected (FC) layers.</p>
<p><strong>n_a</strong> -&gt; size of the attention bottleneck, e.g. input features are mapped to n_a (where n_a&lt;input) and then to input again, giving the model a chance to learn which attributes to focus on.</p>
<hr />
<p>Now, we could focus on the first part of the model:</p>
<p><img src="http://c-a-s-t-l-e.github.io/images/tabnet/first_select_together.png" alt="" /></p>
<hr />
<h2 id="bn---batch-normalization">BN - Batch Normalization</h2>
<p>The first part to notice is that we have the input that leads to &quot;BN&quot; or the batch normalization component.</p>
<p>Batch normalization can be understood through this mathematical pseudo-code:</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="k">def</span> <span class="nf">batch_norm_math</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">X</span><span class="p">):</span>
        <span class="c1"># For batch B of size m
</span>        <span class="n">μᵢ</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="o">/</span><span class="n">m</span><span class="p">)</span><span class="n">Σₘ</span> <span class="n">xᵢᵐ</span>            <span class="c1"># Mean per feature
</span>        <span class="n">σ</span><span class="err">²</span><span class="n">ᵢ</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="o">/</span><span class="n">m</span><span class="p">)</span><span class="n">Σₘ</span><span class="p">(</span><span class="n">xᵢᵐ</span> <span class="o">-</span> <span class="n">μᵢ</span><span class="p">)</span><span class="err">²</span>    <span class="c1"># Variance per feature
</span>        <span class="n">x</span><span class="err">̂</span><span class="n">ᵢ</span> <span class="o">=</span> <span class="p">(</span><span class="n">xᵢ</span> <span class="o">-</span> <span class="n">μᵢ</span><span class="p">)</span><span class="o">/</span><span class="err">√</span><span class="p">(</span><span class="n">σ</span><span class="err">²</span><span class="n">ᵢ</span> <span class="o">+</span> <span class="n">ε</span><span class="p">)</span>   <span class="c1"># Normalized features
</span>        
        <span class="k">return</span> <span class="n">x</span><span class="err">̂</span><span class="n">ᵢ</span>
</code></pre></div></div>
<p>Essentially, you could think of manipulating the data to mitigate extremes among other characteristics in the input dataset.</p>
<p>Also, the reason why we use the word &quot;batch&quot; is because a batch of data is sent to the model as input.</p>
<hr />
<h2 id="feature-trans---feature-transformer">Feature Trans - Feature Transformer</h2>
<p>After the normalized data is created, it gets fed into the feature transformer which can be understood it through the following image:</p>
<p><img src="http://c-a-s-t-l-e.github.io/images/tabnet/feature_transformer.png" alt="" /></p>
<p>And, to then understand the first part of the feature transformer (the GLU layer), we can understand it through this image:</p>
<p><img src="http://c-a-s-t-l-e.github.io/images/tabnet/glu_layer.png" alt="" /></p>
<p>This could then be understood through this mathematical pseudo-code:</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="k">def</span> <span class="nf">step_by_step</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="c1"># 1. Linear Transformation
</span>          <span class="n">W</span> <span class="err">∈</span> <span class="n">ℝᵈˣ</span><span class="err">²</span><span class="n">ᵐ</span> <span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="nb">input</span> <span class="n">dim</span><span class="p">,</span> <span class="n">m</span><span class="p">:</span> <span class="n">output</span> <span class="n">dim</span><span class="p">)</span>
          <span class="n">x</span> <span class="err">∈</span> <span class="n">ℝᵇˣᵈ</span> <span class="p">(</span><span class="n">b</span><span class="p">:</span> <span class="n">batch</span> <span class="n">size</span><span class="p">)</span>
          <span class="n">h</span> <span class="o">=</span> <span class="n">xW</span>
        
        <span class="c1"># 2. Batch Normalization
</span>          <span class="n">μ</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="o">/</span><span class="n">B</span><span class="p">)</span><span class="n">Σᵢ</span> <span class="n">hᵢ</span>
          <span class="n">σ</span><span class="err">²</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="o">/</span><span class="n">B</span><span class="p">)</span><span class="n">Σᵢ</span><span class="p">(</span><span class="n">hᵢ</span> <span class="o">-</span> <span class="n">μ</span><span class="p">)</span><span class="err">²</span>
          <span class="n">ĥ</span> <span class="o">=</span> <span class="p">(</span><span class="n">h</span> <span class="o">-</span> <span class="n">μ</span><span class="p">)</span><span class="o">/</span><span class="err">√</span><span class="p">(</span><span class="n">σ</span><span class="err">²</span> <span class="o">+</span> <span class="n">ε</span><span class="p">)</span>
        
        <span class="c1"># 3. GLU
</span>          <span class="n">Split</span> <span class="n">ĥ</span> <span class="n">into</span> <span class="n">ĥₜ</span> <span class="ow">and</span> <span class="n">ĥg</span>
          <span class="n">output</span> <span class="o">=</span> <span class="n">ĥₜ</span> <span class="err">⊙</span> <span class="n">σ</span><span class="p">(</span><span class="n">ĥg</span><span class="p">)</span>
</code></pre></div></div>
<h2 id="the-decision-step---a-decision-tree-like-component">The Decision Step - A Decision Tree Like Component</h2>
<p>With these components of the model now roughly understood, the last part that it is essential to knowing how Tabnet works is by looking at the decision step.</p>
<p>Within this part, there is:</p>
<ul>
<li>
<p>the mask</p>
</li>
<li>
<p>the attentive transformer</p>
</li>
</ul>
<p><img src="http://c-a-s-t-l-e.github.io/images/tabnet/decision_step.png" alt="" /></p>
<hr />
<h3 id="the-mask">The Mask</h3>
<p>You can think of the mask as a matrix that filters out what's unimportant. This also allows us to see which features Tabnet focuses on for each prediction (since it has instancewise feature selection); meaning that the model is also then very interpretable.</p>
<p>Here's <a href="https://github.com/dreamquark-ai/tabnet/blob/develop/forest_example.ipynb">an example</a> you can run that shows what I mean.</p>
<hr />
<h3 id="the-attentive-transformer">The Attentive Transformer</h3>
<p>The attentive transformer is what allows the model to focus on the different features through the iterative cycle of training. How it's set-up can be observed by the following image:</p>
<p><img src="http://c-a-s-t-l-e.github.io/images/tabnet/attentive_transformer.png" alt="" /></p>
<p>All of these components together create an output for each decision that are then all added together to make a decision.</p>
<h2 id="how-a-prediction-is-made-after-all-the-decision-steps">How A Prediction is Made After All the Decision Steps</h2>
<p>After the whole step process that's done, all the outputs from each of the steps are added together.A fully conneted layer is then applied for regression or a fully connected layer and then a softmax function are then applied to get a class prediction. All of this can be seen in the mathematical pseudocode below.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">tabnet_prediction_math</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">decision_steps</span><span class="p">):</span>
    <span class="c1"># dᵢ represents output from decision step i
</span>    <span class="c1"># Sum all decision step outputs into final hidden representation
</span>    <span class="n">h</span> <span class="o">=</span> <span class="n">Σᵢ</span> <span class="n">dᵢ</span>                      

    <span class="c1"># For Classification:
</span>    <span class="c1"># W is the weight matrix of final layer
</span>    <span class="c1"># b is the bias term
</span>    <span class="c1"># zⱼ is the logit for class j
</span>    <span class="n">z</span> <span class="o">=</span> <span class="n">Wh</span> <span class="o">+</span> <span class="n">b</span>                     <span class="c1"># Linear transformation to C classes
</span>    
    <span class="c1"># pⱼ is probability for class j
</span>    <span class="c1"># C is the number of classes
</span>    <span class="n">pⱼ</span> <span class="o">=</span> <span class="n">exp</span><span class="p">(</span><span class="n">zⱼ</span><span class="p">)</span><span class="o">/</span><span class="n">Σₖexp</span><span class="p">(</span><span class="n">zₖ</span><span class="p">)</span>        <span class="c1"># Softmax for class probabilities
</span>    
    <span class="c1"># ŷ is the final prediction (class label)
</span>    <span class="n">ŷ</span> <span class="o">=</span> <span class="n">argmaxⱼ</span><span class="p">(</span><span class="n">pⱼ</span><span class="p">)</span>               <span class="c1"># Final class prediction
</span>    
    <span class="c1"># For Regression:
</span>    <span class="c1"># ŷ is the final prediction (regression value)
</span>    <span class="c1"># W is the weight matrix of final layer
</span>    <span class="c1"># b is the bias term
</span>    <span class="n">ŷ</span> <span class="o">=</span> <span class="n">Wh</span> <span class="o">+</span> <span class="n">b</span>                     <span class="c1"># Linear transformation is final prediction
</span>    
    <span class="k">return</span> <span class="n">ŷ</span>
</code></pre></div></div>
<p>In my next post, if you guys are interested, I can then go through how Tabnet trains itself on the data and its respective unsupervised pretraining characteristics.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[Hey guys! I've been exploring the tabnet model for a few days since stumbling upon it in a Github repo. For the sake of the this post, I would just like to put down in words my understanding of the model to help you and I better understand it.]]></summary></entry><entry><title type="html">Senior Project</title><link href="https://c-a-s-t-l-e.github.io/2024/11/19/filename.html" rel="alternate" type="text/html" title="Senior Project" /><published>2024-11-19T00:00:00+00:00</published><updated>2024-11-19T00:00:00+00:00</updated><id>https://c-a-s-t-l-e.github.io/2024/11/19/filename</id><content type="html" xml:base="https://c-a-s-t-l-e.github.io/2024/11/19/filename.html"><![CDATA[<p>Hey everybody!</p>
<p>So I was just wanting to give an update on my senior project experience; what orignally started out as a side project has now become my full-time project.</p>
<p>The gist is that I've created (and am currently refining) a program that allows one to upload their general entries as txt documents, have a model do fine-grained emotion analysis of the text, and then show a dashboard that displays historical data as to when various emotions have been most prominent over time.</p>
<p>Progress has been great, and I'll eventually have it all up here on Github.</p>
<p>In general, I'd like to think of it as an exploration into what language modeling can do to help us become better at figuring out who we are.</p>
<p>I'll also probably write-up some documentation for all of this really soon as well.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[Hey everybody!]]></summary></entry><entry><title type="html">Update #2 - Redressing Strategies</title><link href="https://c-a-s-t-l-e.github.io/2024/10/11/filename.html" rel="alternate" type="text/html" title="Update #2 - Redressing Strategies" /><published>2024-10-11T00:00:00+00:00</published><updated>2024-10-11T00:00:00+00:00</updated><id>https://c-a-s-t-l-e.github.io/2024/10/11/filename</id><content type="html" xml:base="https://c-a-s-t-l-e.github.io/2024/10/11/filename.html"><![CDATA[<h3 id="as-for-scrib">As for Scrib...</h3>
<p>As of the current moment, I've decided that I don't have enough time as a student balancing my classes this semester on top of my job as a technical project manager building the web app for Aspire365 to be able to dedicate my time to developing Scrib because of the more chellenging nature of the project.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[As for Scrib...]]></summary></entry><entry><title type="html">Another Update 😆</title><link href="https://c-a-s-t-l-e.github.io/2024/09/05/filename.html" rel="alternate" type="text/html" title="Another Update 😆" /><published>2024-09-05T00:00:00+00:00</published><updated>2024-09-05T00:00:00+00:00</updated><id>https://c-a-s-t-l-e.github.io/2024/09/05/filename</id><content type="html" xml:base="https://c-a-s-t-l-e.github.io/2024/09/05/filename.html"><![CDATA[<h3 id="so-basically">So Basically...</h3>
<p>Since last time I've contributed to this blog, there's been quite a bit of stuff that has gone down that had made it difficult to write in here / I kind of forgot about this until now.</p>
<p>With that being said though:</p>
<ol>
<li>I've decided I'll graduate at the end of this year (unless something crazy happens).</li>
<li>I've decided that I'll try and stretch my creative wings more by doubling down on what I like by trying to build some decently sized but doable projects as well as continue studying. This includes continuing to build out deep learning models and honing my skills with traditional machine learning as well as building out tools for processing texts and documents and being a &quot;non-traditional artist&quot;.</li>
</ol>
<p>With all that being said, I've decided to build out some of my ideas I have been collecting for about a year or so.</p>
<p><img src="http://c-a-s-t-l-e.github.io/images/scrib-logo.png" alt="scrib logo" /></p>
<p>The first I would like to introduce is called scrib. I now hope to make it a PDF viewer that let's the user navigate docs easier and make them more interactive. I'd like to thank the course in design thinking that I took last semester for helping identify a problem.</p>
<p>Overall though, let's see where this path takes us...</p>]]></content><author><name></name></author><summary type="html"><![CDATA[So Basically...]]></summary></entry><entry><title type="html">Realizations and An Update</title><link href="https://c-a-s-t-l-e.github.io/2024/03/15/filename.html" rel="alternate" type="text/html" title="Realizations and An Update" /><published>2024-03-15T00:00:00+00:00</published><updated>2024-03-15T00:00:00+00:00</updated><id>https://c-a-s-t-l-e.github.io/2024/03/15/filename</id><content type="html" xml:base="https://c-a-s-t-l-e.github.io/2024/03/15/filename.html"><![CDATA[<h3 id="the-gist">The Gist</h3>
<p>Well, so far this year has been an interesting one to put it lightly. Looking back over my previous post at the start of the year, it might be time to provide some realizations and an update.</p>
<h4 id="realizations">Realizations</h4>
<ol>
<li><strong>Design Thinking... Who Knew?</strong></li>
<li><strong>What Would C.S. Pierce's Texts Look Like?</strong></li>
<li><strong>It's the Consistency That Counts</strong></li>
</ol>
<h4 id="the-update">The Update</h4>
<p>Now, with that being said, here's the update on my goals to get through those two books mentioned in the previous post: I haven't gotten through ISLP, but I have gone through quite a for chapters of Practical Deep Learning for Coders. Those chapters have been espeically useful in constructing the neural networks we are assigned to build in my machine learning class.</p>
<p>That's pretty much it though.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[The Gist]]></summary></entry><entry><title type="html">Trying Something New for the New Year</title><link href="https://c-a-s-t-l-e.github.io/2024/01/04/filename.html" rel="alternate" type="text/html" title="Trying Something New for the New Year" /><published>2024-01-04T00:00:00+00:00</published><updated>2024-01-04T00:00:00+00:00</updated><id>https://c-a-s-t-l-e.github.io/2024/01/04/filename</id><content type="html" xml:base="https://c-a-s-t-l-e.github.io/2024/01/04/filename.html"><![CDATA[<p><img src="http://c-a-s-t-l-e.github.io/images/purple_firework.png" alt="" /></p>
<h3 id="the-gist">The Gist</h3>
<p>I'm going to keep this kind of short, but I just wanted to state that in the personal_study repo that is available on my Github I have a collection of my notes from the stuff I'm studying in my free-time.</p>
<p>The main motivation of writing this here is to then hold myself accountable since I know a silent crowd (real or imaginary) knows that I'm trying to do this too.</p>
<p>Two resources I hope to get through by the end of the year (depending on classes, life, etc.):</p>
<ul>
<li><a href="https://www.statlearning.com/">Introduction to Statistical Learning with Appplications in Python (ISLP)</a></li>
<li><a href="https://course.fast.ai/">Practical Deep Learning for Coders</a></li>
</ul>
<p>I'm working on the first right now.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">Web-Scraping to the Moon</title><link href="https://c-a-s-t-l-e.github.io/2023/11/14/filename.html" rel="alternate" type="text/html" title="Web-Scraping to the Moon" /><published>2023-11-14T00:00:00+00:00</published><updated>2023-11-14T00:00:00+00:00</updated><id>https://c-a-s-t-l-e.github.io/2023/11/14/filename</id><content type="html" xml:base="https://c-a-s-t-l-e.github.io/2023/11/14/filename.html"><![CDATA[<p><img src="http://c-a-s-t-l-e.github.io/images/astronaut_laptop.png" alt="" /></p>
<h2 id="summary">Summary</h2>
<p>Here's a little notebook that finds a bunch of NASA missions and saves them as a CSV.
It's pretty chilisimo.</p>
<h2 id="the-breakdown">The Breakdown</h2>
<h3 id="problem">Problem</h3>
<p>As a metadata intern at NASA, it might be handy to have a way to extract relevant NASA missions from their own website and save them in a CSV.</p>
<p>The website:</p>
<p><a href="https://www.nasa.gov/missions/">NASA Missions Website</a></p>
<h3 id="solution">Solution</h3>
<p>So, as a possible solution, here's a little script to do so.</p>
<p><a href="https://nbviewer.org/github/c-a-s-t-l-e/nasa_stuff/blob/main/notebooks/mission_scraper.ipynb">The Notebook</a></p>]]></content><author><name></name></author><summary type="html"><![CDATA[]]></summary></entry></feed>