<?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 Drona Raj Gyawali on Medium]]></title>
        <description><![CDATA[Stories by Drona Raj Gyawali on Medium]]></description>
        <link>https://medium.com/@dronarajgyawali?source=rss-310258902399------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5P5E1FyHDZgvfobkZbjblQ.jpeg</url>
            <title>Stories by Drona Raj Gyawali on Medium</title>
            <link>https://medium.com/@dronarajgyawali?source=rss-310258902399------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 09:07:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dronarajgyawali/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[My AI Learning Notes: Breaking Down Transformers, Vector Search, and FaceID]]></title>
            <link>https://medium.com/@dronarajgyawali/my-ai-learning-notes-breaking-down-transformers-vector-search-and-faceid-9f2c801856d8?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f2c801856d8</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[sbert]]></category>
            <category><![CDATA[embedding]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Mon, 25 May 2026 18:32:38 GMT</pubDate>
            <atom:updated>2026-05-25T18:32:38.242Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered how your phone’s FaceID instantly recognizes you, even if you’re wearing glasses, in a dark room, or looking at a weird angle? Or how Google magically knows whether you are searching for a <strong>financial bank</strong> or a <strong>river bank</strong>?</p><p>The magic isn’t a black box. It’s a beautifully orchestrated system of math, data vectors, and architecture.</p><p>If you have 5 minutes, you’re about to learn exactly how modern AI reads, thinks, and compares the world , from individual words to the geometry of your face.</p><h3>1. The Core Problem: Why AI Used to “Forget”</h3><p>In the early days of Natural Language Processing (NLP), AI models read text exactly like humans do: <strong>one word at a time, from left to right</strong>.</p><p>There was a massive flaw with this approach. By the time the AI finished reading a long paragraph, it would completely “forget” what it read at the very beginning.</p><p>Then came Google. In 2017, they introduced a groundbreaking architecture that changed everything: <strong>The Transformer</strong>.</p><h3>What is Self-Attention?</h3><p>Instead of reading word-by-word, Transformers look at an entire sentence all at once. To do this without losing context, they use a mathematical mechanism called <strong>Self-Attention</strong>. Think of it as a relationship map that scores how much attention every single word should pay to every other word in a sentence.</p><p>Take this sentence:</p><blockquote>“The <strong>bank</strong> of the river is muddy.”</blockquote><p>Thanks to self-attention, the model looks at the word <strong>“bank”</strong> and instantly calculates its relationship to <strong>“river”</strong> and <strong>“muddy”</strong>. It assigns a high relationship score between them, realizing: <em>“Ah, this ‘bank’ means land near water, not a financial institution!”</em></p><h3>The Mathematics: Queries, Keys, and Values</h3><p>To calculate these relationship maps, the model generates three vectors (lists of numbers) for every single word:</p><ul><li><strong>Query (Q):</strong> <em>“What am I looking for?”</em></li><li><strong>Key (K):</strong> <em>“What information do I contain?”</em></li><li><strong>Value (V):</strong> <em>“What actual content do I provide if we match?”</em></li></ul><p>The model mathematically multiplies the <strong>Query</strong> of one word with the <strong>Key</strong> of every other word (<strong>Q * K</strong>). This score determines exactly how much of the <strong>Value</strong> (<strong>V</strong>) it should take from each word to build its final understanding.</p><h3>2. Transformers Under the Hood: Encoders vs. Decoders</h3><p>A standard Transformer is split into two powerhouses: the <strong>Encoder</strong> and the <strong>Decoder</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*jOk0eIhXM5nb6fPfRrhlmQ.png" /></figure><h3>The Encoder (The Translator)</h3><p>The Encoder’s job is to take raw, human-readable text (e.g., &quot;Hello World&quot;) and compress its meaning into a high-dimensional mathematical map called a <strong>Context Vector</strong> or <strong>Hidden State</strong> (e.g., [0.823, 0.231, 0.561]). It looks at every word, maps their relationships using self-attention, and turns pure language into pure math.</p><h3>The Decoder (The Storyteller)</h3><p>The Decoder does the exact opposite. It takes those dense mathematical numbers, looks at what the Encoder mapped out, and predicts the next most logical word, one by one, translating the math back into a structured human response.</p><h3>3. BERT vs. SBERT: Word Specialists vs. World-Class Librarians</h3><p>BERT: The Word Specialist</p><p><strong>BERT</strong> (<em>Bidirectional Encoder Representations from Transformers</em>) is an <strong>encoder-only</strong> model. It reads full sentences bidirectionally (left and right simultaneously) to understand deep word context.</p><ul><li><strong>How it learns:</strong> It is trained on <strong>Masked Language Modeling (MLM)</strong>. Imagine feeding it the sentence: I live in Butwal and today the weather is [MASKED].</li><li>Because BERT knows geography and context, it predicts the missing word. If it guesses wrong during training, the system adjusts its internal weights until it gets it right.</li><li><strong>The Catch:</strong> BERT is a word specialist. If you give it a 10-word sentence, it outputs 10 separate vectors — one for each word.</li></ul><h3>SBERT: The World-Class Librarian</h3><p>If you want to compare how similar two entire <em>sentences</em> or <em>books</em> are, BERT becomes highly inefficient. Enter <strong>SBERT</strong> (<em>Sentence-BERT</em>).</p><p>SBERT is a fine-tuned version of BERT designed to map an <strong>entire sentence</strong> into a single point in a dense vector space. This allows software to measure the semantic similarity of two sentences using simple geometry — specifically, <strong>Cosine Similarity</strong> (measuring the angle between two vector arrows).</p><h3>4. The Pooling Layer: Condensing Information</h3><p>How do we go from BERT’s 10 different word vectors down to SBERT’s single sentence vector? We use a <strong>Pooling Layer</strong> right on top of the encoder.</p><p>Imagine you have a sentence with 10 words. Each word gets a vector of 768 dimensions. The pooling layer compresses those 10 vectors into <strong>one single 768-dimensional vector</strong> that summarizes the entire sentence.</p><p>There are three main ways to do this:</p><ul><li><strong>Mean Pooling:</strong> It adds all 10 vectors together and divides by 10 (sum(vectors) / count). It finds the mathematical average of the sentence&#39;s meaning. <em>SBERT uses this because it yields superior accuracy for similarity searches.</em></li><li><strong>Max Pooling:</strong> The model scans the dimensions and pulls out only the highest, most dominant values (e.g., grabbing a highly stressed sentiment value while ignoring neutral ones).</li><li><strong>CLS-Pooling</strong>: BERT places a special classification token ([CLS]) at the very beginning of every sentence. Some systems just grab that token&#39;s vector and throw away the rest. While fast, research shows it isn’t great for deep similarity searches.</li></ul><h3>5. Production AI: Bi-Encoders vs. Cross-Encoders</h3><p>When searching through millions of files in the real world, engineering teams combine two strategies to balance extreme speed with extreme accuracy.</p><p><strong>Bi-Encoders (The Speed Demons)</strong></p><p>A Bi-Encoder processes your query into a vector <em>independently</em> of the documents.</p><ul><li><strong>How it works:</strong> You pre-calculate and save the vectors for 1,000,000 documents in a Vector Database. When a user asks a question, the model runs exactly <strong>once</strong> to vectorise the query.</li><li><strong>The Verdict:</strong> Incredibly fast, but misses subtle deep-context connections between the query and the text.</li></ul><h3>Cross-Encoders (The Perfectionists)</h3><p>A Cross-Encoder does not look at sentences separately. It feeds both pieces of text into the transformer simultaneously: [CLS] Sentence A [SEP] Sentence B [SEP].</p><ul><li><strong>How it works:</strong> Because of self-attention, it evaluates the relationships between both sentences at the exact same time.</li><li><strong>The Verdict:</strong> Highly accurate, but <strong>incredibly slow</strong>. To find the best match out of 1,000 documents, you have to run the massive model 1,000 separate times.</li></ul><h3>The Industry Standard Pipeline</h3><p>To get the best of both worlds, industries use a two-stage retrieval pipeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*DFYZ4vo5L3QGzrXTi-9URw.png" /></figure><h3>6. Twin Networks &amp; FaceID: How It Applies to You</h3><p>This exact architecture of comparing mathematical vectors explains how your phone unlocks using FaceID via a setup called a <strong>Siamese Network</strong>.</p><p>A Siamese Network consists of <strong>two identical neural networks</strong> that share the exact same configuration and weights. Think of them as twins working in tandem to solve similarity problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*ZhFF81dsydJD56k3nS5f6Q.png" /></figure><h3>How FaceID Works Step-by-Step</h3><ul><li><strong>The Setup:</strong> When you first set up your phone, it scans your face from multiple angles. It does <em>not</em> save raw photos in your storage. Instead, it processes them through a neural network to generate a unique mathematical face coordinate (a vector like [0.998, 0.782, -0.112...]) and saves that math in secure, long-term storage.</li><li><strong>The Scan:</strong> The next time you glance at your phone to unlock it, the second twin network instantly turns your current face into a live vector.</li><li><strong>The Threshold:</strong> The system calculates the mathematical distance between your saved vector and your live vector. Because lighting and angles change, the vectors will never be a 100% identical match. The system uses a strict <strong>threshold constraint</strong> (e.g., <em>if the similarity score is greater than 0.85, unlock the phone</em>).</li></ul><h3>How Are These Models Trained? (Metric Learning &amp; Triplet Loss)</h3><p>To make sure a phone can tell the difference between you and a stranger, these networks are trained using a technique called <strong>Metric Learning</strong> utilizing a <strong>Triplet Loss</strong> function.</p><p>During training, the AI is continuously fed three items at once:</p><ul><li><strong>Anchor:</strong> A photo of <em>your</em> face.</li><li><strong>Positive:</strong> Another photo of <em>your</em> face (from a different angle or lighting).</li><li><strong>Negative:</strong> A photo of a complete stranger.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*zJXcqae0iMhphxrMt6W40A.png" /></figure><p>The mathematical objective is simple: <strong>minimize</strong> the distance between the Anchor and the Positive face, while <strong>maximizing</strong> the distance between the Anchor and the Negative face. If the model places a stranger’s face too close to yours in the vector space, it gets heavily penalized (“punished”) by the algorithm, forcing its internal weights to adjust.</p><p>Whether an AI is reading a complex legal document, searching for context-aware definitions, or verifying that your face matches your phone’s security registry, it is doing the exact same thing under the hood: <strong>converting human reality into mathematical vector spaces, mapping relationships via self-attention, and calculating distances.</strong> AI isn’t a mysterious, thinking consciousness, it is elegant geometry at scale.</p><p>If you came here reading all along please don&#39;t forget to follow me on my <a href="https://github.com/drona-gyawali/"><strong><em>github</em></strong></a><strong><em>. Thanks for reading :)</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f2c801856d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My GSoC Selection Journey]]></title>
            <link>https://medium.com/@dronarajgyawali/my-gsoc-selection-journey-ae869f292ae2?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae869f292ae2</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[gsoc-nepal]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Sun, 24 May 2026 14:22:05 GMT</pubDate>
            <atom:updated>2026-05-24T14:22:05.995Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone! I am Drona Raj Gyawali, from Lumbini Province, Nepal. I am currently a second-year undergrad majoring in Computer Science at Butwal Multiple Campus. Today, I want to take you through my journey from open-source contributor to being selected for Google Summer of Code (GSoC) 2026 with GreedyBear, a cyber threat intelligence project.</p><p>In my first year, I started learning Python with the sole goal of breaking into AI research. Along the way, while implementing ML papers, I realized I was falling in love with backend systems. I found myself happily spending hours deep-diving into system engineering and design. The pull was so strong that I made a bold decision: pause the AI research and go all-in on backend architecture.</p><p>I started building, but I quickly hit a roadblock. Back in school or college, if I solved a complex equation, I could ask a teacher to verify it. But here I was writing code with no one to tell me: <em>Is this code actually good? Can this safely run for 15 years? Is this implementation industry-standard?</em> AI is there, sure, but AI sucks at rigorous code review because it’s always context-hungry.</p><p>That headache led me to discover the true power of Open Source. The concept pulled me in instantly: you write code for an issue, and senior engineers review it and give you world-class feedback, completely for free.</p><p>I started contributing to the Internet Archive/Open Library project and got to work on some amazing issues. Most of it was refactoring backend code to adapt to Ruff linting rules, but I ended up finding and fixing actual bugs.</p><p>Through those merged PRs and the guidance of the maintainers, I learned CI/CD, writing robust test cases, shipping production-grade code, and advanced debugging strategies. If you tried to learn this stuff in a commercial bootcamp, they would easily charge you 3–4 lakhs NPR. I was getting it for free from the pros.</p><p>This wasn’t an overnight success. Last year, I applied to a cybersecurity organization to work on detecting login anomalies. I didn’t get selected due to a communication gap. However, I still managed to get my name added to the README as a backend contributor because of my work and dedication to the project. Honestly, that felt like a win, and the experience taught me exactly what I needed to fix.</p><p>This year, I applied to a different organization with a highly specific domain to truly test myself: <strong>GreedyBear</strong>.</p><p>When I started, I had absolutely zero knowledge of threat intelligence. I began small, adding test cases and refining edge cases. Eventually, I leveled up and merged major features like credential clustering ,ASN endpoints, optimizing code performance and many more thing.</p><p>The biggest differentiator this year was communication. I engaged with my mentor from day one. I vividly remember a straight 5-day period where my mentor and I discussed my proposal insanely fast. We were debating architectural details; my mentor was pushing back, and I was in the zone trying to prove my implementation was right. That intense, thoughtful discussion made the proposal rock solid.</p><p>I submitted it well before the deadline, waited, and finally got the selection email.</p><p>If this journey taught me anything, it’s that <strong>communication is key</strong>. Any technical problem can be solved with thoughtful, transparent discussion. I’ve already learned an immense amount from my mentor’s PR reviews, sitting at 19+ merged PRs before the deadline.</p><p>Tomorrow, the official coding period starts. It’s time to keep writing lean, robust code.</p><p>You are still here and then my humble request please follow me on <a href="https://github.com/drona-gyawali"><strong><em>github</em></strong></a>, I will take that follow count as a token of love :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae869f292ae2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Redis Caching in FastAPI the Right Way]]></title>
            <link>https://medium.com/@dronarajgyawali/integrating-redis-caching-in-fastapi-the-right-way-edb212183d45?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/edb212183d45</guid>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[fastapi]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Sat, 16 Aug 2025 16:05:53 GMT</pubDate>
            <atom:updated>2025-08-16T16:05:53.298Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SX0BmHVqCtnFU7PB" /></figure><p>If your FastAPI app is growing, chances are you’ve noticed response times creeping up. That’s where <strong>Redis</strong> comes in. Redis is an in-memory data store that makes caching ridiculously fast. In this guide, I’ll show you the cleanest, most modular way to set up Redis for caching in a FastAPI project.</p><p>We’ll keep things simple and focus only on <strong>caching</strong> (Redis can do a lot more, but caching alone is a game-changer).</p><h3>Step 1: Install Dependencies</h3><p>Make sure you install the following packages:</p><pre>pip install aioredis redis[async]</pre><p>We’ll be using Redis in <strong>async mode</strong> since FastAPI is built around async I/O.</p><h3>Step 2: Configure Environment Variables</h3><p>Create a .env file in your project root. Add the following:</p><pre>REDIS_HOST=localhost<br>REDIS_PORT=6379<br>REDIS_DB=0<br>REDIS_PASSWORD=&quot;&quot;</pre><p>This allows us to change Redis settings without touching the codebase.</p><h3>Step 3: Centralize Configs</h3><p>Inside your project, create a config folder. Then, add conf.py:</p><pre>import os<br><br>redis_host = os.getenv(&quot;REDIS_HOST&quot;, &quot;localhost&quot;)<br>redis_port = int(os.getenv(&quot;REDIS_PORT&quot;, 6379))<br>redis_db = int(os.getenv(&quot;REDIS_DB&quot;, 0))<br>redis_password = os.getenv(&quot;REDIS_PASSWORD&quot;, None)</pre><p>This ensures all Redis configurations live in <strong>one place</strong>.</p><h3>Step 4: Redis Connection Setup</h3><p>In the same config folder, create a file called cache.py. This will handle all Redis operations (initialize, close, get, set, delete).</p><pre>from config import conf<br>from redis.asyncio import Redis<br><br>async def init_redis():<br>    &quot;&quot;&quot;Initialize Redis connection at app startup&quot;&quot;&quot;<br>    global redis<br>    redis = Redis(<br>        host=conf.redis_host,<br>        port=conf.redis_port,<br>        db=conf.redis_db,<br>        password=conf.redis_password,<br>        decode_responses=True,<br>    )<br><br>async def close_redis():<br>    &quot;&quot;&quot;Close Redis connection at app shutdown&quot;&quot;&quot;<br>    global redis<br>    if redis:<br>        await redis.close()<br><br>async def get_cache(key: str):<br>    if not redis:<br>        raise RuntimeError(&quot;Redis not initialized. Call init_redis() first.&quot;)<br>    return await redis.get(key)<br><br>async def set_cache(key: str, value: str, ttl: int = 300):<br>    if not redis:<br>        raise RuntimeError(&quot;Redis not initialized. Call init_redis() first.&quot;)<br>    await redis.set(key, value, ex=ttl)<br><br>async def delete_cache(key: str):<br>    if not redis:<br>        raise RuntimeError(&quot;Redis not initialized. Call init_redis() first.&quot;)<br>    await redis.delete(key)</pre><p>This modular design makes it easy to use Redis anywhere in the project.</p><h3>Step 5: Wire Redis into FastAPI</h3><p>Now, let’s connect Redis to our FastAPI app lifecycle so it automatically starts and closes properly.</p><pre>from config.cache import close_redis, init_redis<br>from fastapi import FastAPI<br><br>async def lifespan(app: FastAPI):<br>    await init_redis()<br>    yield<br>    await close_redis()<br>app = FastAPI(lifespan=lifespan)</pre><p>This way, Redis is initialized when the app starts and cleaned up when it shuts down.</p><h3>Step 6: Create a Caching Utility</h3><p>We don’t want to repeat Redis logic in every route. Instead, let’s build a <strong>decorator</strong> that handles caching.</p><p>Create a utils folder, create redis_utilities.py:</p><pre>import json<br>from functools import wraps<br><br>from app.authentication.models import User<br>from config.cache import get_cache, set_cache<br>from fastapi.encoders import jsonable_encoder<br>from sqlalchemy.ext.asyncio import AsyncSession<br><br>def cache_response(key_func, ttl=300):<br>    def decorator(func):<br>        @wraps(func)<br>        async def wrapper(*args, **kwargs):<br>            key = key_func(*args, **kwargs)<br>            cached = await get_cache(key)<br>            if cached:<br>                return json.loads(cached)<br>            result = await func(*args, **kwargs)<br>            encoded_result = jsonable_encoder(result)<br>            await set_cache(key, json.dumps(encoded_result), ttl)<br>            return result<br>        return wrapper<br>    return decorator<br><br>def user_cache_key(current_user: User, db: AsyncSession):<br>    return f&quot;user_profile:{current_user.id}&quot;</pre><h3>How it works:</h3><ul><li>cache_response → wraps any function, checks cache first, sets cache if not found.</li><li>user_cache_key → generates a unique cache key per user (useful if your app is user-based).</li></ul><h3>Step 7: Use Caching in Your API</h3><p>Here’s how you apply caching in a real FastAPI route:</p><pre>from utils.redis_utilities import cache_response, user_cache_key<br>from fastapi import Depends<br>from sqlalchemy.ext.asyncio import AsyncSession<br>from app.authentication.models import User<br>from app.dependencies import get_current_user, get_db<br><br>@app.get(&quot;/videos&quot;)<br>@cache_response(user_cache_key, ttl=300)<br>async def get_all_links(<br>    current_user: User = Depends(get_current_user),<br>    db: AsyncSession = Depends(get_db)<br>):<br>    # Your DB query or heavy logic here<br>    return {&quot;videos&quot;: [&quot;video1&quot;, &quot;video2&quot;, &quot;video3&quot;]}<br></pre><p>✨ Boom. You’ve got caching enabled.</p><ul><li>The user_cache_key <strong>(key)</strong> ensures uniqueness per user.</li><li>ttl=300 → cache expires in 5 minutes (adjust as needed).</li></ul><h3>⚡ Performance Boost</h3><p>Here’s what happens:</p><ul><li><strong>Without Redis</strong> → Every request hits the database so Resonse time is <strong>582ms</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*ohl92ABJ94ZaH5IlzCuSEA.png" /></figure><ul><li><strong>With Redis</strong> → The first request fetches from the database, caches it, and every subsequent request fetches from Redis (much faster) so reponse time is 25ms.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*UIY687JZOmUbO_FqWXuYbQ.png" /></figure><p>Response times drop drastically.</p><h3>Cache Invalidation</h3><p>Remember: caching is powerful, but it must stay fresh.</p><ul><li>When you <strong>update or delete</strong> data, also call delete_cache(key) to invalidate the old cache.</li><li>This ensures users always get the latest information.</li></ul><h3>Final Thoughts</h3><p>We’ve set up a clean, reusable Redis caching system for FastAPI:</p><ul><li>Modular config (conf.py, cache.py)</li><li>Lifecycle management with FastAPI</li><li>A decorator (cache_response) for painless caching</li><li>Per-user cache keys for uniqueness</li></ul><p>This setup is scalable, production-ready, and easy to extend.</p><p>Now your API is not just fast — it’s <strong>blazing fast</strong>. ⚡</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edb212183d45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building FocusTube]]></title>
            <link>https://medium.com/@dronarajgyawali/building-focustube-4214d63d660b?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/4214d63d660b</guid>
            <category><![CDATA[videapp]]></category>
            <category><![CDATA[productive]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Mon, 11 Aug 2025 09:12:06 GMT</pubDate>
            <atom:updated>2025-08-11T09:13:06.147Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Creating the app where users feels Productive</strong></p><figure><img alt="FocusTube" src="https://cdn-images-1.medium.com/max/1024/0*LQ0z0fr5-0Ls2JAr.png" /><figcaption><a href="https://github.com/drona-gyawali/FocusTube">https://github.com/drona-gyawali/FocusTube</a></figcaption></figure><p>YouTube is not just an entertainment site but an educational platform with millions of tutorials from various streams such as tech, finance, medical, and many more. Despite YouTube’s huge influence in the education sector, it does not seem to prioritize or promote educational content because it’s a fact that educational and learning platforms tend to reward less than entertainment content. As a result, you’re already familiar with short-form content (reels) on YouTube, which is even more distracting. I am not an internal engineer at YouTube, but sometimes while browsing, I sense that YouTube wants to promote entertainment, and their algorithms are becoming somewhat identical to Instagram’s. However, these are just my opinions and don’t necessarily have to be true.</p><p>Distraction is the problem, and to solve this problem, I present <strong>FocusTube:</strong> your YouTube without distraction, your videos without algorithms. Basically, it is a clone of YouTube. What do I do? I simply ask the user to paste a link of the video they want to watch — it can be any video — then I provide a way to store all those videos in one feed with features like customizable playlists, watch later, and more. The only thing the user has to do is paste the link of a specific YouTube video.</p><p>As of now, for those who want to delete YouTube from their system, this might be a good alternative. The flow will be like this: On Sunday, users surf YouTube and try to plan and collect links of the whole week’s learning materials. After they finish collecting, users delete YouTube and do not reinstall it for that week. Then, they come to FocusTube, paste all those links (bulk upload or even upload files containing links is possible), and perform their learning without any outside distractions.</p><p>To sum up, my goal is to minimize distraction as much as possible. I am not saying this is a perfect alternative, but it’s a very good workaround. We might think that from YouTube we learn about politics, finance, and random topics frequently, but if we use FocusTube, we might get disconnected from that world. To be frank, the answer is simple: having too much knowledge can cause cognitive overload.</p><p>So, this is for very serious people who are preparing for something important. And honestly, why would someone preparing for Google want to know about politics or world news? The candidate is supposed to know only DSA, system design, and real-world projects. So, paste all the useful links related to your preparation. And this is not the end — in the future, more features might come, like creating bundles of useful videos pasted by others and loved by many, so new users can just select the bundle that matches their interest.</p><p>Please visit the repository: <a href="https://github.com/drona-gyawali/FocusTube">https://github.com/drona-gyawali/FocusTube</a></p><p>— Drona Raj Gyawali</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4214d63d660b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secret-Scanner: A project to detect secret keys like API, password, and many more.]]></title>
            <link>https://medium.com/@dronarajgyawali/secret-scanner-a-project-to-detect-secret-keys-like-api-password-and-many-more-a54f416d7db5?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/a54f416d7db5</guid>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[project-based-learning]]></category>
            <category><![CDATA[secret-scanning]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Tue, 10 Jun 2025 14:38:56 GMT</pubDate>
            <atom:updated>2025-06-10T14:38:56.537Z</atom:updated>
            <content:encoded><![CDATA[<p>At the first place, what is Secret-Scanner? Suppose you are working on a project and your project demands a lot of external service configurations such as OpenAI, Gemini, AWS, secret keys, etc. So while working on it, you might mistakenly leak some secrets in the project. Assuming that the project is public, then it’s a big chaos. So, my project can save you from those leaks.</p><p>Secret-Scanner is not the only project in the market; there are thousands of projects similar to this. But why did I create it? The reason to create this project is self-learning + my second-semester project. Instead of building some useless terminal work like note-taking etc., I thought to build something useful.</p><p>In this writing, I will try to focus more on <strong>how I built it</strong>. The first step was simple — I researched. I went through thousands of articles, asked a lot of questions. Priority was scalability and fast performance. As I was building this using C++, performance was going to be great. However, I added a layer of thread pooling on it. Yes, I built my custom threadpool logic for this, because if you have a good system, you want to get fast results, isn’t it? Jokes aside, imagine you have a project with more than 10+ subprojects like a monorepo thing — guessing the count of files can be 100 to 300. So in this case, we want to utilize our system cores to the fullest. This was the main reason for the threadpool.</p><p><strong>How exactly does it scan based on proof?</strong><br> The project itself doesn’t use any API etc. It uses a simple and powerful thing — regex. Yes, you heard me right. Currently, the project has 60+ product API keys, secrets, etc., and they can also be added according to the need. And the main thing all our regexes are well-maintained &amp; well-written with some test cases.</p><p><strong>Features that I added?</strong><br> The main feature is the scanner engine, which I described to you earlier, written in C++ and also utilized as a CLI tool. You and I are good at programming but what about others who don’t understand CLI, sudo apt, etc.? For them, I built a VSCode Extension. So now you install the extension on VSCode named <strong>Secret-scanner-pro</strong>, click the icon at the bottom side of the editor, and boom you can scan your project and fix the errors. For more features, please see this <a href="https://marketplace.visualstudio.com/items?itemName=drona-gyawali.secret-scanner-pro">Link</a>, and don’t forget the extension is using that CLI tool I mentioned earlier under the hood, so you have to install that secret-scanner first on your system globally, which you can get on GitHub please view it from here: <a href="https://github.com/drona-gyawali/secret-scanner">Link</a></p><p><strong>Future plan</strong><br> As this is my university second-semester project, I am not going to spend more time on it. However, I will continuously add updated regex keys. Saying that, I am planning to add one feature: with this feature, the user can add the repo link and it will scan on the fly something like this:<br> ./secret-scanner https://github.com/user/repo<br> That’s it. With this feature, I hope my work is finished. I don’t know by the time if this feature is built — you can comment blaming the issue — and if it is not built, stay kind. I am probably doing my university assignment.</p><p>That’s all, thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a54f416d7db5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Real Code Doesn’t Crash: Why Low-Level Programming Is Built Different]]></title>
            <link>https://medium.com/@dronarajgyawali/real-code-doesnt-crash-why-low-level-programming-is-built-different-a1ee6fc98a50?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1ee6fc98a50</guid>
            <category><![CDATA[low-level-programming]]></category>
            <category><![CDATA[c]]></category>
            <category><![CDATA[crash]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Sun, 20 Apr 2025 12:18:12 GMT</pubDate>
            <atom:updated>2025-04-20T12:18:12.564Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In today’s world of cozy developer setups, fancy frameworks, and low-effort coding tutorials, we hear phrases like:</p><ul><li>“My website crashed!”</li><li>A new update broke everything!”</li><li>“Oh no, I installed the wrong npm package!”</li></ul><p>But have you <em>ever</em> heard something like:</p><ul><li>“My CPU firmware crashed”</li><li>“The hedge fund’s trading system had a runtime bug”</li><li>“The chip’s memory controller failed because of bad code”</li></ul><p>Exactly. You haven’t. And there’s a reason for that.</p><p>This blog is a deep dive into the philosophy behind real, low-level programming the kind that powers CPUs, game engines, operating systems, and high-frequency trading platforms.</p><h3>1. The Myth of Clean Code</h3><p>You’ve been told:</p><blockquote><em>“Readable code is good code.”</em></blockquote><p>That might be true in a university assignment or a startup MVP. But in low-level systems, the rules change.</p><p>Here’s the truth:</p><blockquote><strong><em>Readable code invites unnecessary changes. Compact, dense code demands understanding.</em></strong></blockquote><p>Why? Because when a newbie thinks they “get it,” they tweak it — and boom, the engine crashes. A dense block of low-level code is a warning sign:</p><blockquote><em>“Tread carefully. You better know what this line does at the register level.”</em></blockquote><h3>2. Trust the Compiler, Not the Developer</h3><p>Low-level programmers write code <em>for the CPU</em>, not for the human eye. The C compiler is one of the most optimized pieces of software ever written.</p><p>Take this:</p><pre>return printf(&quot;%d&quot;, sum(1, 2));</pre><p>Looks weird? Hacky? Nope. That’s just <em>efficient</em>. No intermediate variables. No extra memory. Straightforward execution. Minimal register usage.</p><p>This is the level where performance is king, and syntax is a tool not a constraint.</p><h3>3. Crashes? What Crashes?</h3><p>Modern devs cry about crashes all day:</p><ul><li>“Oh no, my JavaScript framework just blew up.”</li><li>“Why does my backend consume 8GB RAM on startup?”</li></ul><p>But do you ever hear firmware devs or OS kernel hackers say that? No. Their systems are designed with <em>zero crash tolerance</em>.</p><p>In hedge fund trading platforms (written in C/C++), every nanosecond matters. They handle millions of operations per second — and they <em>don’t crash</em>. Why?</p><p>Because their developers:</p><ul><li>Count memory by bytes</li><li>Profile CPU cache misses</li><li>Avoid anything that isn’t 100% necessary</li><li>Don’t rely on cozy abstractions or third-party packages</li></ul><h3>4. Comfort Breeds Complacency</h3><p>One senior developer once said:</p><blockquote><em>“We don’t want a 7-screen developer with a cozy chair and water bottle. We want someone who can build an engine on a Raspberry Pi with a half-broken keyboard.”</em></blockquote><p>Game engines, operating systems, embedded software — they’re <em>not</em> written with Spotify playing and fancy UI tools. They’re forged in tough conditions, with performance as the only priority.</p><p>If your code can’t run in a memory-constrained, overheating, no-GUI environment it’s not ready.</p><h3>5. The Tools vs. The Toolmakers</h3><p>Most devs are tool <em>users</em>. They drag-and-drop with React, call API wrappers, and copy-paste ChatGPT’s output.</p><p>But low-level devs are tool <em>makers</em>. They write:</p><ul><li>Their own malloc</li><li>Their own render pipelines</li><li>Their own protocols</li><li>Their own OS schedulers</li></ul><p>It’s not about using sum(1, 2) — it’s about <strong>writing</strong> it, from scratch, with zero safety nets.</p><h3>6. Want to Feel It?</h3><p>Go read the source code of:</p><ul><li><a href="https://github.com/redis/redis">Redis</a> — Tiny, insanely fast in-memory store</li><li><a href="https://github.com/git/git">Git</a> — Ridiculously compact, scary efficient</li><li><a href="https://github.com/torvalds/linux">Linux Kernel</a> — A masterclass in performance</li><li><a href="https://github.com/sqlite/sqlite">SQLite</a> — Smallest, most reliable DB in the world</li></ul><p>You’ll see things like:</p><pre>for (;;) {<br>    int c;<br>    if ((c = getchar()) == EOF) break;<br>    switch(c) {<br>        case &#39;q&#39;: return;<br>        case &#39;h&#39;: puts(&quot;Hello&quot;); break;<br>        default: putchar(c);<br>    }<br>}</pre><p>This isn’t ugly. This is <strong>warrior code</strong>. It’s doing multiple things in a single tight loop:</p><ul><li>input</li><li>control flow</li><li>exit logic</li><li>memory-safe I/O</li></ul><p>It’s fast, tight, brutal — and beautiful. This is the stuff you’ll find powering real-time systems and engine cores.</p><h3>Final Words: Learn to Think Like a Machine</h3><p>Most devs today are button pressers. They don’t understand what’s <em>below</em> the abstraction. But you?</p><p>You’re waking up. You’re realizing that real code:</p><ul><li>Doesn’t crash</li><li>Doesn’t waste memory</li><li>Doesn’t need 100 dependencies</li><li>Doesn’t rely on someone else’s toolset</li></ul><p>If you want to write code that runs inside CPUs, that moves pixels at 120 FPS, that transfers trillions in real time <strong>ditch the comfort</strong>.</p><p>And remember:</p><blockquote><em>“Cozy code crashes. Real code survives.”</em></blockquote><p><strong>Ready to dive into Redis or Git source code line by line? Hit me up — we’ll do it together.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1ee6fc98a50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Understanding Mutable Default Arguments in Classes]]></title>
            <link>https://medium.com/@dronarajgyawali/understanding-mutable-default-arguments-in-classes-23340ef015c9?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/23340ef015c9</guid>
            <category><![CDATA[ruff]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[oops-interview-questions]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[oops-concepts]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Tue, 31 Dec 2024 09:48:12 GMT</pubDate>
            <atom:updated>2024-12-31T09:48:12.063Z</atom:updated>
            <content:encoded><![CDATA[<p>In Programming, <strong>mutable default arguments</strong> in classes can lead to unexpected bugs and unintended behavior. This happens because mutable objects, such as <strong>lists</strong> or <strong>dictionaries</strong>, are <strong>shared across all instances</strong> of a class when defined as default values at the class level.</p><h3>1. What are Mutable and Immutable Objects?</h3><ul><li><strong>Mutable Objects:</strong> These can be <strong>changed</strong> after they are created.<br> Examples: list, dict, set</li><li><strong>Immutable Objects:</strong> These <strong>cannot</strong> be changed after they are created.<br> Examples: int, float, str, tuple</li></ul><h3>2. Mutable Defaults in Classes — The Problem</h3><p>When you define a <strong>class-level attribute</strong> with a <strong>mutable default value</strong> (like a dictionary or list), that default value is <strong>shared</strong> across all class instances.</p><h3>🐍 Problematic Example (Mutable Class Attribute)</h3><pre>class Example:<br>    mutable_attr = []  # Mutable class-level attribute (a list)<br><br>   # Create two instances<br>   obj1 = Example()<br>   obj2 = Example()<br>   # Add something to obj1&#39;s list<br>   obj1.mutable_attr.append(&#39;hello&#39;)<br>   # Check obj2&#39;s list<br>   print(obj2.mutable_attr)  # Output: [&#39;hello&#39;]  &lt;-- Unexpected!</pre><h4>📝 What Happened?</h4><ul><li>Both obj1 and obj2 <strong>share the same list</strong> (mutable_attr) because it&#39;s defined at the <strong>class level</strong>, not the <strong>instance level</strong>.</li><li>Changing mutable_attr in obj1 also changes it for obj2. This can lead to <strong>bugs</strong> and unintended behavior.</li></ul><h3>3. Class-Level vs Instance-Level Attributes</h3><ul><li><strong>Class-Level Attribute:</strong> Shared across all instances.</li><li><strong>Instance-Level Attribute:</strong> Unique to each instance.</li></ul><h3>🛠️ Solution 1: Use ClassVar</h3><p>To make it <strong>clear</strong> that a mutable attribute is intended to be <strong>shared across instances</strong>, we use ClassVar.</p><pre>from typing import ClassVar<br><br>class Example:<br>    # Explicitly declare it as a class attribute<br>    mutable_attr: ClassVar[list] = [] <br># Now it&#39;s clear to everyone reading the code that `mutable_attr` is a class attribute.</pre><h3>🛠️ Solution 2: Use None for Instance-Level Defaults</h3><p>If you want <strong>every instance to have its own mutable object</strong>, use None and initialize it in the constructor.</p><pre>class Example:<br>    def __init__(self):<br>        self.mutable_attr = []  # Unique list for every instance<br>        # Create two instances<br>        obj1 = Example()<br>        obj2 = Example()<br>        # Add something to obj1&#39;s list<br>        obj1.mutable_attr.append(&#39;hello&#39;)<br>        # Check obj2&#39;s list<br>        print(obj2.mutable_attr)  # Output: []  &lt;-- Correct!<br></pre><h3>🧠 Quick Recap:</h3><ol><li><strong>Mutable defaults (e.g., </strong><strong>[], </strong><strong>{}) can cause bugs if shared unintentionally.</strong></li><li>Use ClassVar for <strong>shared class-level attributes</strong>.</li><li>Use __init__ for <strong>instance-level attributes</strong>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23340ef015c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Variables in Statistics: A Simple Guide]]></title>
            <link>https://medium.com/@dronarajgyawali/understanding-variables-in-statistics-a-simple-guide-5a43c1d0c403?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a43c1d0c403</guid>
            <category><![CDATA[variables]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[quantitative]]></category>
            <category><![CDATA[statistics]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Thu, 03 Oct 2024 14:01:32 GMT</pubDate>
            <atom:updated>2024-10-03T14:01:32.483Z</atom:updated>
            <content:encoded><![CDATA[<h4>Exploring Quantitative and Qualitative Variables with Real-World Examples</h4><p>A <strong>variable </strong>in statistics is simply something that can change or vary across different observations. Think of it as a <strong>“container”</strong> that holds information, and the information it holds can be different from one case to another.</p><p><strong>Example:</strong></p><p><strong>Age</strong> is a<strong> variable</strong> because different people have different ages. You can ask five different people their ages, and you might get answers like 18, 25, 30, 42, or 50. The ages are the values, and the variable here is age. The only thing that’s being measured or recorded is the age, which makes it the variable in this situation.</p><p><strong>Real-world applications:</strong></p><p><strong>To put it in everyday terms:</strong> Imagine a survey where you’re asking people their age. The question “How old are you?” represents the variable, and the number each person provides (like 25 or 30) is the value that gets stored for that variable. So, in this case,<strong> age</strong> is the variable, and each<strong> person’s specific</strong> age is the value that the variable holds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9XxikUG2qJPGvd5N0Z7tA.jpeg" /><figcaption><strong>Visualize Variable</strong></figcaption></figure><h3><strong>Types of Variable</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vof5XP3MQc5hn5svJTxOfQ.png" /></figure><h3><strong>1. Quantitative Variables</strong></h3><p>Quantitative variables represent <strong>numerical values</strong> that can be measured or counted. These variables deal with quantities and answer questions like “How many?” or “How much?” They are further divided into two subtypes:</p><ul><li><strong>Discrete Variables:</strong> These represent countable,<strong> whole numbers </strong>and are often associated with things you can count.</li></ul><p><strong>Example: </strong>The number of books on a shelf (e.g., 5, 10, 15 books). You can’t have half a book when counting.</p><ul><li><strong>Continuous Variables:</strong> These can take any value within a given range and are measurable, often involving <strong>fractions or decimals.</strong></li></ul><p><strong>Example</strong>: A person’s height (e.g., 5.75 feet or 170.2 cm). Height can take a wide range of values, even in fractions.</p><h3>2. Qualitative (Categorical) Variables</h3><p>Qualitative variables represent <strong>categories or labels </strong>and describe qualities or characteristics. These variables answer questions like “What type?” or “Which category?” and are not measured with numbers. They are not inherently numerical, but sometimes they can be coded numerically for analysis.</p><p><strong>Example</strong>: Hair color (e.g., black, brown, blonde) or the type of car (e.g., sedan, SUV, truck).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a43c1d0c403" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Statistics-Population(N) & Sample(n)]]></title>
            <link>https://medium.com/@dronarajgyawali/statistics-population-n-sample-n-a73f3e8b7e17?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/a73f3e8b7e17</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[statistical-analysis]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Wed, 02 Oct 2024 14:40:31 GMT</pubDate>
            <atom:updated>2024-10-02T14:40:31.552Z</atom:updated>
            <content:encoded><![CDATA[<h4>Understanding Sampling Methods for Accurate Research and Decision-Making</h4><h3><strong>Population(N):</strong></h3><p>The <strong>population</strong> is the entire group of people, things, or events that you want to study.</p><p><strong>For e.g.</strong> If you’re researching favorite ice cream flavors, the population could be all the kids in your city.</p><h3><strong>Sample(n):</strong></h3><p>A<strong> sample</strong> is a smaller group selected from the population that you actually study or a subset of population.</p><p><strong>For e.g. </strong>Instead of asking every kid in the city, you might ask 100 kids from different neighborhoods. And..That group of 100 kids is your sample</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*1CWoFdI5DeY13tSohGL_Nw.jpeg" /><figcaption><strong>Visualize the population and sample</strong></figcaption></figure><p>The goal of sampling is to create a sample that is representative of the entire population.</p><h3>Real-world use cases using P<strong>opulation(N)</strong> and S<strong>ample(n)</strong>:</h3><h4>1. Market Research for Product Launch</h4><ul><li><strong>Population</strong>: All <strong>potential customers</strong> who could be interested in the product (e.g., all people in a country or a specific age group).</li><li><strong>Sample</strong>: A<strong> selected group of individuals </strong>(e.g., 1,000 customers from different regions, demographics, etc.) who are surveyed to understand preferences, price sensitivity, or buying habits.</li><li><strong>Use Case</strong>: The company can’t survey the entire population, so they collect data from the sample(<strong> selected group of individuals</strong>) and use it to predict the behavior of the overall population.</li></ul><h3>Symbols:</h3><ul><li><strong>Population Size</strong>:<br>Represented by <strong>N</strong>.<br>Example: If there are 10,000 people in a city, the population size is <strong>N = 10,000</strong>.</li><li><strong>Sample Size</strong>:<br>Represented by <strong>n</strong>.<br>Example: If 500 people are selected from the city for a survey, the sample size is <strong>n = 500</strong>.</li></ul><h3><strong>Types of Sample(n):</strong></h3><p><strong>Random Sampling:</strong></p><p>In Random<strong> Sampling</strong> everyone in the population has an<strong> equal chance of being selected.</strong></p><ul><li><strong>Example</strong>:If you put all the names of the kids in your city in a hat and draw 100 names, you’re doing random sampling.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*jlpCBGaYD6ry21Gsy8aYHg.jpeg" /><figcaption><strong>Randomly Selecting from Population</strong></figcaption></figure><h4><strong>Stratified Sampling:</strong></h4><p>The population is divided into smaller groups (called <strong>strata</strong>) based on a characteristic (like age or grade), and you randomly sample from each group.</p><ul><li><strong>Example</strong>: If you divide the kids into age groups (6–8 years old, 9–12 years old), and then randomly pick kids from each group, that’s stratified sampling.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zxjsj4cvOfDtUTCfT00ZiQ.png" /><figcaption><strong>Non-Overlapping Group</strong></figcaption></figure><h4>Systematic Sampling:</h4><p>Systematic sampling is a <strong>probability sampling technique</strong> in which every kthk^{th}kth member of a population is selected to be part of the sample, where kkk is the sampling interval.</p><ul><li><strong>Example</strong>: If you have a list of all the kids, and you pick every 3th kid on the list, that’s systematic sampling.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*QaIpfIyKAVCFmjuzLFJZBA.png" /><figcaption><strong>Every 3th</strong> <strong>kid in the list</strong></figcaption></figure><p><strong>Convenience Sampling:</strong></p><p><strong>Convenience sampling</strong> is a non-probability sampling method where participants are selected based on their easy accessibility and proximity to the researcher. This means the sample consists of individuals who are readily available, without random selection.</p><ul><li><strong>Example</strong>: If you just ask kids who are at your local park, that’s convenience sampling. It’s not random but quick and easy.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*o_MZDhq81wn9jZ0iGz0Waw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a73f3e8b7e17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Statistics Roadmap for Machine Learning, AI, and Data Science]]></title>
            <link>https://medium.com/@dronarajgyawali/statistics-roadmap-for-machine-learning-ai-and-data-science-a7318510e0a7?source=rss-310258902399------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7318510e0a7</guid>
            <category><![CDATA[statistical-analysis]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Drona Raj Gyawali]]></dc:creator>
            <pubDate>Fri, 20 Sep 2024 13:09:05 GMT</pubDate>
            <atom:updated>2024-09-20T13:09:05.481Z</atom:updated>
            <content:encoded><![CDATA[<p>Detailed <strong>Statistics roadmap</strong> to help you master the subject from a data science, machine learning, and AI perspective. I’ve broken it down into key stages with suggested video resources and topics for each phase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zEdG4PXh-e-YhUsO_EFR-A.jpeg" /></figure><h3><strong>1. Introduction to Statistics</strong></h3><ul><li><strong>Goal:</strong> Understand the basics of <strong>descriptive statistics</strong> and <strong>probability,</strong> which are foundational for data science.</li><li><strong><em>Key Topics:</em></strong><br> <strong>- Descriptive Statistics:<br></strong> — Mean, median, mode<br> — Variance, standard deviation<br> — Skewness and kurtosis<br> — Percentiles and quartiles</li></ul><p><strong><em>- Types of Data:<br></em></strong> — Categorical vs. numerical data<br> — Levels of measurement: nominal, ordinal, interval, ratio</p><p><strong><em>- Basic Probability:<br></em></strong> — Definitions (events, sample space)<br> — Probability rules (addition, multiplication)<br> — Conditional probability and Bayes’ Theorem</p><p><strong><em>Resources</em></strong>:<br>- <strong>Videos</strong>: <br> — <strong>Khan Academy</strong>: <a href="https://www.khanacademy.org/math/statistics-probability"><em>[Statistics and Probability]</em></a> (A fantastic intro course covering all foundational topics)<br><strong> — 3Blue1Brown:</strong> <a href="https://youtu.be/5j_8L5hH78g"><em>[Introduction to Bayes’ Theorem]</em></a><em> </em>(Visual and intuitive understanding of Bayes’ Theorem)</p><h3>2. Exploratory Data Analysis (EDA)</h3><p><strong>Goal</strong>: Learn how to analyse and visualize data using statistics to derive insights and understand distributions.</p><p><strong>Key Topics:<br></strong>- Histograms, Boxplots, Scatterplots<br>- Correlation and Covariance</p><p><strong>- Sampling and Data Distributions:<br></strong> — Normal, binomial, Poisson distributions<br> — Central Limit Theorem<br>- Z-Scores and Outliers Detection</p><p><strong>Resources:<br>- Videos:<br></strong> — StatQuest with Josh Starmer: [<a href="https://youtu.be/MTb2E2AkrOA"><em>Normal Distributions Explained</em></a>]<br> — Krish Naik: <a href="https://youtu.be/Vp3tDsrW0As"><em>[Exploratory Data Analysis for Data Science]</em></a></p><p>(Great focus on Python usage with Pandas and Seaborn)</p><h3>3. Inferential Statistics</h3><p><strong>Goal</strong>: Master the concepts of <strong>hypothesis testing</strong>, <strong>confidence intervals</strong>, and how to infer from data.</p><p><strong><em>Key Topics:</em></strong><br><strong>- Hypothesis Testing:<br></strong> — Null and alternative hypotheses<br> — Type I and Type II errors<br> — p-value and significance levels</p><p><strong>- Confidence Intervals<br></strong>- T-tests, Chi-Square Tests, ANOVA<br>- Statistical Power and Sample Size Determination</p><p><strong>Resources:</strong><br>- <strong>Videos:</strong><br> — StatQuest: <a href="https://youtu.be/IgrkcMecRa4"><em>[T-Tests Explained]</em></a><br> — Brilliant.org: <a href="https://brilliant.org/courses/statistics-fundamentals/hypothesis-testing/"><em>[Hypothesis Testing]</em></a><em> </em>(An interactive way of learning hypothesis testing concepts)</p><h3><strong>— 4. Probability Distributions &amp; Random Variables</strong></h3><p><strong>Goal</strong>: Build a strong grasp of different distributions and how they apply to real-world data in machine learning models.</p><p><strong>Key Topics:<br></strong>- Bernoulli, Binomial, Poisson, Exponential Distributions<br>- Multivariate Probability<br>- Joint, Marginal, and Conditional Distributions<br>- Law of Large Numbers and Central Limit Theorem</p><p><strong>Resources:<br>- Videos:<br></strong> — StatQuest: <a href="https://youtu.be/KyUTuwz_b7Q">[Poisson and Binomial Distributions]</a><a href="https://youtu.be/KyUTuwz_b7Q)*">*</a> <br> — Khan Academy: <a href="https://www.khanacademy.org/math/statistics-probability/probability-distributions-library"><em>[Probability distributions]</em></a></p><blockquote><strong>Statistical thinking will one day be as necessary for efficient citizenship as the ability to read and write.</strong><br> — H.G. Wells</blockquote><h3>5. Regression Analysis</h3><p><strong>Goal:</strong> Learn to model relationships between variables, which is essential for machine learning.</p><p><strong>Key Topics:</strong><br><strong>- Simple and Multiple Linear Regression<br></strong> — Coefficients and interpretation<br> — R-squared and Adjusted R-squared<br> — Assumptions in linear regression (Linearity, Independence, Homoscedasticity, Normality)</p><p><strong>- Logistic Regression:<br></strong> — Odds ratio and interpretation<br> — Logistic function and Sigmoid curve<br> — Application in classification problems</p><p><strong>Resources:<br></strong>- Videos:<br> — <strong>StatQuest</strong>: <a href="https://youtu.be/nk2CQITm_eo">[Linear Regression]</a> (Super clear explanation with examples)<br> — <strong>Data School</strong>: <a href="https://youtu.be/yIYKR4sgzI8">[Introduction to Logistic Regression]</a></p><h3>6. Advanced Statistical Methods</h3><p><strong>Goal: </strong>Understand the more advanced statistical concepts applied in machine learning.</p><p><strong><em>Key Topics:<br></em>- Bayesian Statistics:<br></strong> — Prior, Posterior, Likelihood<br> — Conjugate Priors<br> — Bayesian inference and MCMC (Markov Chain Monte Carlo)</p><p><strong>- Time Series Analysis:<br></strong> — Moving Averages, ARIMA models<br> — Stationarity and differencing<br> — Autocorrelation and partial autocorrelation</p><p><strong>- Survival Analysis:<br></strong> — Kaplan-Meier Estimator<br> — Cox Proportional Hazards Model</p><p><strong>Resources:<br>- Videos:<br></strong> — <strong>StatQuest</strong>: <a href="https://youtu.be/7Cz2DQoZlWI">[Bayesian Inference]</a> <br> — Khan Academy: <a href="https://www.khanacademy.org/math/statistics-probability/probability-library">[Time Series Analysis]</a></p><h3>7. Statistical Methods for Machine Learning</h3><p><strong>Goal:</strong> Apply statistics to specific machine learning problems like classification, clustering, and model evaluation.</p><p><strong>Key Topics:<br>- Bias-Variance Tradeoff<br></strong>- Overfitting and Regularization (Lasso, Ridge)<br>- Cross-Validation and Bootstrap Sampling</p><p><strong>-Evaluation Metrics:<br></strong> — Accuracy, Precision, Recall, F1 Score, ROC, AUC<br> — Confusion matrix</p><p><strong>Resources:<br>- Videos:<br></strong> — <strong>StatQuest</strong>: <a href="https://youtu.be/UO2eQHGUwno">[Bias-Variance Tradeoff]</a><br> — Data School: <a href="https://youtu.be/6dbrR-WymjI">[Cross-Validation]</a></p><p>(Perfect for understanding cross-validation in model training)</p><h3>8. Applied Statistical Programming in Python</h3><p><strong>Goal:</strong> Combine theoretical knowledge with practical programming using Python libraries.</p><p><strong><em>Key Tools:</em></strong><br>- Numpy and Scipy: Statistical calculations and distributions<br>- Pandas: Data manipulation and EDA<br>- Statsmodels: Advanced statistical models (Regression, Time Series)<br>- Seaborn/Matplotlib: Visualizing statistical relationships</p><p><strong>Resources:<br>- Videos:<br></strong> — Corey Schafer: <a href="https://youtu.be/VM1JFMvI7zA">[Pandas Data Analysis Tutorial]</a> <br> — Krish Naik: <a href="https://youtu.be/nQ-TvEJ_QcQ">[Statsmodels for Linear Regression]</a></p><h3>9. Special Topics</h3><p><strong>Goal:</strong> Master advanced techniques that are highly useful in specific areas of AI, ML, and Data Science.</p><p><strong><em>Key Topics:<br></em></strong>- Dimensionality Reduction(PCA, SVD)<br>- Resampling Methods (Bootstrap, Jackknife)<br>- Monte Carlo Simulations</p><p><strong>Resources:<br>- Videos:<br></strong> — <strong>StatQuest</strong>: <a href="https://youtu.be/FgakZw6K1QQ">[Principal Component Analysis (PCA)] </a><br> — Machine Learning Mastery: <a href="https://youtu.be/XU-JhDeZ7cc">[Monte Carlo Simulation]</a></p><h3>Conclusion</h3><p>This roadmap will give you a robust foundation in <strong>statistics,</strong> which is critical for<strong> machine learning and AI.</strong> The key is to practice constantly and implement the concepts through coding projects. Each topic builds on the previous one, so take your time as you move through the stages.</p><p>For hands-on practice, consider working on datasets from platforms like:<br>- <strong>Kaggle: </strong>Explore competitions and projects to apply your knowledge.<br>- <strong>UCI Machine Learning Repository: </strong>A goldmine of datasets for practicing statistics and ML.</p><p>Good luck on your journey to mastering statistics!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7318510e0a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>