<?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"><channel><title><![CDATA[Deep Learning Decoded]]></title><description><![CDATA[Deep Learning Decoded]]></description><link>https://deeplearningwithizu.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Nov 2026 07:10:49 GMT</lastBuildDate><atom:link href="https://deeplearningwithizu.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Delving into the Realm of Losses and Costs:]]></title><description><![CDATA[Embark on an insightful journey through the labyrinth of data science, where losses and costs unveil their hidden secrets. Discover the power of mean…]]></description><link>https://deeplearningwithizu.hashnode.dev/delving-into-the-realm-of-losses-and-costs</link><guid isPermaLink="true">https://deeplearningwithizu.hashnode.dev/delving-into-the-realm-of-losses-and-costs</guid><category><![CDATA[loss function]]></category><category><![CDATA[Data Science]]></category><category><![CDATA[Machine Learning]]></category><dc:creator><![CDATA[Izu]]></dc:creator><pubDate>Sun, 03 Dec 2023 11:40:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/hpjSkU2UYSU/upload/b96dc0444ad975d45075a06404baf4f5.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome to the fascinating world of deep learning, where we embark on a quest to unravel the intricate patterns and hidden insights embedded within data. Along this journey, we encounter losses, which serve as beacons, highlighting the discrepancies between our predictions and the true predictions. Our ultimate objective is to refine our models and minimize these deviations, achieving unparalleled precision and accuracy.</p>
<p>Losses act as feedback, showing how far our predictions are from reality. The overall cost, which is a combination of these individual losses, measures the quality of our data analysis.</p>
<p>In this article, we will delve into three fundamental types of losses, each with its unique characteristics and applications. Together, we will uncover hidden stories in data using algorithms.</p>
<p><strong>Mean absolute error:</strong> Imagine you're trying to predict the weight of different objects. For each object, you weigh it on a scale and record the actual weight. Then, you use a machine learning model to predict the weight of each object based on its features.</p>
<p>Mean Absolute Error (MAE) is a way to measure how accurate your predictions are. It calculates the average absolute difference between your predicted weights and the actual weights. In other words, it measures how far off your predictions are, on average.</p>
<p>The lower the MAE, the more accurate your predictions are. A perfect MAE of 0 would mean that your predictions were always exactly correct. However, a perfect MAE is not realistic, so a low MAE is generally considered good.</p>
<p>Here is the formula for MAE:</p>
<p>$$MAE = \frac{1}{n} \sum_{i=1}^{n} |y_i - \hat{y}_i|$$</p><ul>
<li><p>n is the number of datapoints</p>
</li>
<li><p>y i is the actual value for the i-th data point</p>
</li>
<li><p>ŷi is the predicted value for the i-th data point</p>
</li>
<li><p>In summary you calculate the absolute difference between the predicted and actual values and then average these absolute differences over all data points.</p>
</li>
</ul>
<p><strong>Mean squared error:</strong></p>
<p>Imagine you're a carpenter and you're trying to build a perfectly level table. To assess the levelness of the table, you use a spirit level to measure the angle of the tabletop at different points. Mean Squared Error (MSE) is like a tool that helps you quantify the overall levelness of the table.</p>
<p>The lower the MSE, the more level the table is, indicating better craftsmanship. A perfect MSE of 0 would mean that the table is perfectly level at every point, while a higher MSE indicates that there are more variations in the levelness of the table.</p>
<p>MSE measures the average squared difference between the actual angle of the tabletop at different points and the desired angle of 0 degrees. By squaring the differences, MSE gives more weight to larger deviations, making it sensitive to outliers. This means that if there are a few points on the table that are significantly off-level, MSE will be higher.</p>
<p>Here's the formula MSE:</p>
<p>$$MSE = \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2$$</p><ul>
<li><p>The squared differences in the formula have the effect of penalizing larger errors more heavily than smaller ones. This makes MSE sensitive to outliers, meaning that outliers can have a significant impact on the overall metric.</p>
</li>
<li><p>Since the differences are squared, the units of MSE are squared units of the original data. This can make interpretation more challenging, especially when comparing models on different scales</p>
</li>
<li><p>MSE is a differentiable function, which is important for optimization algorithms used in training machine learning models, such as gradient descent</p>
</li>
<li><p>Similar to MAE, lower MSE values indicate better model performance, and an MSE of 0 represents a perfect fit where the predicted values exactly match the actual values.</p>
</li>
</ul>
<p><strong>Binary cross entropy:</strong> often referred to as BCE or log loss, is a loss function commonly used in binary classification problems. It measures the difference between the actual and predicted probability distributions for a binary outcome.</p>
<p>In the context of machine learning and binary classification, let's break down the components of Binary Cross Entropy:</p>
<ol>
<li><p>Binary classification refers to problems where there are only two possible classes or outcomes.</p>
</li>
<li><p>In binary classification, the model predicts the probability of an instance belonging to the positive class (e.g., spam, fraudulent) and the complementary probability of belonging to the negative class. These probabilities are usually denoted as P(y) for the positive class and P(¬y) for the negative class.</p>
</li>
<li><p>The actual labels are binary (0 or 1), indicating whether an instance belongs to the positive class (1) or the negative class (0).</p>
</li>
<li><p>The Binary Cross Entropy loss for a single instance is calculated using the following formula:</p>
</li>
</ol>
<p>$$BCE(y, \hat{y}) = - \left(y \cdot \log(\hat{y}) + (1 - y) \cdot \log(1 - \hat{y})\right)$$</p><ul>
<li><p>“y” is the actual predicted model</p>
</li>
<li><p>“ŷ” is the predicted probability of belonging to the positive class</p>
</li>
<li><p>The formula essentially penalizes the model more if the predicted probability diverges from the actual label.</p>
</li>
</ul>
<ol>
<li>For a dataset with multiple instances, the average Binary Cross Entropy loss is calculated:</li>
</ol>
<p>$$BCE(y, \hat{y}) = - \frac{1}{n} \sum_{i=1}^{n} \left(y_i \cdot \log(\hat{y}_i) + (1 - y_i) \cdot \log(1 - \hat{y}_i)\right)$$</p><ul>
<li><p>y is the vector of actual labels.</p>
</li>
<li><p>ŷ is the vector of predicted probabilities</p>
</li>
<li><p>n is the number of instances in the dataset</p>
</li>
</ul>
<p>Now we've learned about three important tools that data scientists use: mean squared error, binary cross-entropy loss, and mean absolute error. These tools help us make accurate predictions.</p>
<p>Now that we have learned about losses and costs, we are ready to tackle data science problems. We will use what we have learned to turn raw data into useful information that can help us make better decisions.</p>
]]></content:encoded></item></channel></rss>