<?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://sahillmulani.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://sahillmulani.github.io/" rel="alternate" type="text/html" /><updated>2025-08-16T13:15:10-07:00</updated><id>https://sahillmulani.github.io/feed.xml</id><title type="html">Sahil Mulani</title><subtitle>personal description</subtitle><author><name>Sahil Mulani</name><email>smulani239@gmail.com</email></author><entry><title type="html">Understanding Overfitting using Garlic Bread Analogy</title><link href="https://sahillmulani.github.io/blog/Overfitting" rel="alternate" type="text/html" title="Understanding Overfitting using Garlic Bread Analogy" /><published>2024-08-27T00:00:00-07:00</published><updated>2024-08-27T00:00:00-07:00</updated><id>https://sahillmulani.github.io/blog/Overfitting</id><content type="html" xml:base="https://sahillmulani.github.io/blog/Overfitting"><![CDATA[<p>During my internship at BankofAmerica, a fellow intern explained overfitting in machine learning using a garlic bread analogy. The explanation was so straightforward and memorable that it made the concept much easier for me to understand.</p>

<p>Here’s how it goes</p>

<p>Imagine you’re trying to create the perfect garlic bread recipe. You invite a few friends over to taste several batches, each one slightly different based on their feedback. One friend loves extra garlic, another prefers it mild, and someone else likes their bread ultra crispy. So, you keep adjusting the recipe to perfectly match each of their preferences. Eventually, you end up with a recipe that’s exactly tailored to their tastes but might not work for the average person.
This is a great analogy for overfitting in machine learning.</p>

<p>When a model becomes too focused on the specific details and noise in the training data, it’s like your garlic bread recipe being too tailored to the small group of tasters. It might work great on that data (the training set), but when you introduce new data (new people tasting your bread), the model struggles to perform well because it hasn’t learned the broader patterns that generalize across various scenarios.</p>

<p>Overfitting is a common issue in machine learning. To avoid it, we simplify models, use more diverse training data, and employ techniques like regularization. The key is to strike a balance—just like creating a garlic bread recipe that appeals to a wide range of tastes, rather than only catering to a small, specific group.</p>

<p>By keeping the model or recipe simple and general, we ensure better performance when faced with new, unseen data.</p>]]></content><author><name>Sahil Mulani</name><email>smulani239@gmail.com</email></author><category term="Machine Learning" /><category term="Overfitting" /><summary type="html"><![CDATA[During my internship at BankofAmerica, a fellow intern explained overfitting in machine learning using a garlic bread analogy. The explanation was so straightforward and memorable that it made the concept much easier for me to understand.]]></summary></entry><entry><title type="html">Dask Library in Python: A Comprehensive Guide</title><link href="https://sahillmulani.github.io/blog/Dask" rel="alternate" type="text/html" title="Dask Library in Python: A Comprehensive Guide" /><published>2024-08-16T00:00:00-07:00</published><updated>2024-08-16T00:00:00-07:00</updated><id>https://sahillmulani.github.io/blog/Dask</id><content type="html" xml:base="https://sahillmulani.github.io/blog/Dask"><![CDATA[<p>Are you handling a large dataset which a pandas dataframe can’t load and numpy arrays are causing issues?</p>

<h2 id="introduction">Introduction</h2>
<p>In the era of Large Language Models (LLM’s) and Artificial Intelligence, where a large amount of data is being stored and processed, handling large datasets efficiently has become a challenge. Traditional libraries like NumPy and Pandas provide excellent tools for handling data, but they fall short when dealing with datasets that do not fit into memory. Dask library can used to overcome this inefficiencies.</p>

<p>Dask is flexible parallel computing library for Python that helps scale the computation across CPUs or even distributed clusters, enabling users to handle large datasets and perform complex computations efficiently.
This article introduces Dask, its core components, and why it is a powerful tool for modern data science and machine learning workflows.</p>

<h2 id="what-is-dask">What is Dask?</h2>
<p>Dask is an open-source parallel computing library in Python that enables scalable and efficient computation. It is particularly popular for handling large-scale data processing tasks that cannot be efficiently managed using conventional tools like Pandas, NumPy, or Scikit-learn alone.
Dask provides parallelism across tasks and data structures through multi-core processors and distributed systems, and it achieves this by breaking down large tasks into smaller, manageable ones. This makes it ideal for computations that would otherwise require significant resources to complete.</p>

<h2 id="dask-components">Dask Components</h2>
<p>Dask consists of two main components: Dask DataFrames and Dask Arrays. Additionally, Dask offers a lower-level Dask Delayed API and Dask Bags, which are used for parallelizing custom workloads and processing unstructured data, respectively.</p>
<ol>
  <li>Dask DataFrames
The Dask DataFrame API is very similar to Pandas DataFrame, and it’s used to process large datasets that don’t fit into memory. Internally, Dask DataFrame breaks the data into smaller Pandas DataFrames and processes them in parallel.</li>
  <li>Dask Arrays
Dask Array is designed for large, multi-dimensional arrays and mimics the behavior of NumPy arrays. The key advantage is that Dask Array can handle arrays larger than memory by dividing them into smaller NumPy arrays and parallelizing operations.</li>
  <li>Dask Delayed
The dask.delayed API allows for converting normal Python functions into lazy, parallelized computations. It’s a flexible, low-level API suitable for more custom workloads. dask.delayed works by delaying the execution of functions and building a task graph for parallel execution.</li>
  <li>Dask Bags
Dask Bags are ideal for processing large collections of unstructured data, such as JSON or log files, where each element may have different structures. It is similar to PySpark’s RDD.
    <h2 id="dask-scheduler">Dask Scheduler</h2>
    <p>Dask operates using schedulers to manage the execution of tasks. There are different types of schedulers available depending on the scale of the application:</p>
    <ul>
      <li>Single-threaded scheduler: For debugging purposes.</li>
      <li>Threaded scheduler: Used for parallelism on a single machine.</li>
      <li>Distributed scheduler: This allows computation across multiple machines in a distributed environment.</li>
    </ul>
  </li>
</ol>

<p>The distributed scheduler is highly recommended for large-scale applications that require parallel computation across
clusters.</p>

<h2 id="when-to-use-dask-">When to Use Dask ?</h2>
<p>Dask is ideal in scenarios where:</p>
<ol>
  <li>Data is too large to fit in memory: Dask breaks data into smaller chunks and computes results in parallel, so even data that doesn’t fit in memory can be processed efficiently.</li>
  <li>Multi-core and distributed computing is required: Dask leverages multi-core processors and can run computations on distributed systems, making it an excellent fit for scalable, high-performance computing.</li>
  <li>You need to parallelize existing code: With minimal modification, Dask can parallelize existing Python code based on NumPy, Pandas, or custom functions.</li>
  <li>Real-time and streaming data processing: Due to its low latency and efficiency in handling large data, Dask is a suitable choice for real-time applications.</li>
</ol>

<h2 id="integration-with-other-libraries">Integration with Other Libraries</h2>
<p>Dask integrates seamlessly with many popular Python libraries:</p>
<ul>
  <li>Scikit-learn: Dask can parallelize machine learning models from Scikit-learn, allowing training on large datasets.</li>
  <li>XGBoost and LightGBM: Both libraries can leverage Dask for distributed training.</li>
  <li>CuPy and RAPIDS: These GPU-accelerated libraries can use Dask for scaling computations across multiple GPUs.</li>
  <li>Dask-ML: This is a library built on top of Dask that extends Scikit-learn’s API to handle larger datasets in parallel</li>
</ul>

<h2 id="conclusion">Conclusion</h2>
<p>Dask is a powerful and flexible library that helps Python developers handle large datasets and scale their computations across multiple cores or distributed systems. By integrating with a variety of popular libraries and offering various APIs for different needs, Dask has established itself as a go-to solution for efficient, large-scale computation in Python</p>]]></content><author><name>Sahil Mulani</name><email>smulani239@gmail.com</email></author><category term="Dask," /><category term="Pytho," /><category term="Parallel" /><category term="Computing" /><summary type="html"><![CDATA[Are you handling a large dataset which a pandas dataframe can’t load and numpy arrays are causing issues?]]></summary></entry></feed>