<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Metrics on davethehuman.com</title><link>https://davethehuman.com/tags/metrics/</link><description>Recent content in Metrics on davethehuman.com</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>© 2026 Dave the human</copyright><lastBuildDate>Tue, 29 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://davethehuman.com/tags/metrics/index.xml" rel="self" type="application/rss+xml"/><item><title>accuracy</title><link>https://davethehuman.com/notes/accuracy/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/accuracy/</guid><description>&lt;p&gt;&lt;em&gt;Accuracy&lt;/em&gt; is the &lt;strong&gt;ratio of the correctly classified observations&lt;/strong&gt;.
In &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;binary classification&lt;/a&gt; settings, it checks the sum of &lt;a href="https://davethehuman.com/notes/tp/"&gt;TP&lt;/a&gt; and &lt;a href="https://davethehuman.com/notes/tn/"&gt;TN&lt;/a&gt; over all the predictions:
&lt;/p&gt;
$$
\mathrm{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN}
$$&lt;p&gt;It is very important to use this metric on datasets that &lt;strong&gt;do not suffer from &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;class imbalance&lt;/a&gt;&lt;/strong&gt;; for example, a model that always predicts &amp;ldquo;False&amp;rdquo; on a dataset having 99.9% of False observations will have a very high 0.999 accuracy score but it won&amp;rsquo;t be meaningful for detecting the True observations.&lt;/p&gt;</description></item><item><title>classification metrics</title><link>https://davethehuman.com/notes/classification-metrics/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/classification-metrics/</guid><description>&lt;p&gt;When building a &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;classifier&lt;/a&gt; we want to minimize the number of misclassified observations.
In &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;binary&lt;/a&gt; cases, we talk about &lt;a href="https://davethehuman.com/notes/tp/"&gt;true positives&lt;/a&gt;, &lt;a href="https://davethehuman.com/notes/fp/"&gt;false positives&lt;/a&gt;, &lt;a href="https://davethehuman.com/notes/tn/"&gt;true negatives&lt;/a&gt; and &lt;a href="https://davethehuman.com/notes/fn/"&gt;false negatives&lt;/a&gt; that can be visualized in a &lt;strong&gt;confusion matrix&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;&lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="auto"
 alt="confusion-matrix"
 width="2400"
 height="1640"
 src="https://davethehuman.com/attachments/confusion-matrix_hu_51d2cad18105cc81.png"
 srcset="https://davethehuman.com/attachments/confusion-matrix_hu_51d2cad18105cc81.png 800w, https://davethehuman.com/attachments/confusion-matrix_hu_bd6c4f8161120a6d.png 1280w"
 sizes="(min-width: 768px) 50vw, 65vw"
 data-zoom-src="https://davethehuman.com/attachments/confusion-matrix.png"&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;The main classification metrics are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://davethehuman.com/notes/accuracy/"&gt;accuracy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://davethehuman.com/notes/precision/"&gt;precision&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://davethehuman.com/notes/recall/"&gt;recall&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://davethehuman.com/notes/fpr/"&gt;false positive rate&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Their usage depends on the classification task.&lt;/p&gt;</description></item><item><title>euclidean distance</title><link>https://davethehuman.com/notes/euclidean-distance/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/euclidean-distance/</guid><description>&lt;p&gt;The &lt;em&gt;Euclidean distance&lt;/em&gt; is the measure of the true straight-line distance between two points in a Euclidean space. It is the geometric distance you would measure with a ruler, representing the shortest path between those points.&lt;/p&gt;

&lt;h2 class="relative group"&gt;The Formula
 &lt;div id="the-formula" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-formula" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
$$
d(p, q) = \sqrt{\sum_{i=1}^{n} (q_i - p_i)^2}
$$&lt;p&gt;In a 2D Space, for two points $P_1(x_1, y_1)$ and $P_2(x_2, y_2)$: &lt;/p&gt;</description></item><item><title>F1-score</title><link>https://davethehuman.com/notes/f1-score/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/f1-score/</guid><description>&lt;p&gt;&lt;em&gt;F1-score&lt;/em&gt; (also called &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;harmonic mean&lt;/a&gt;) is a &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;metric&lt;/a&gt; that takes into account both &lt;a href="https://davethehuman.com/notes/precision/"&gt;precision&lt;/a&gt; and &lt;a href="https://davethehuman.com/notes/recall/"&gt;recall&lt;/a&gt;:
&lt;/p&gt;
$$
\mathrm{F1} = \frac{2*Precision*Recall}{Precision + Recall}
$$&lt;p&gt;It is widely used in &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;NLP&lt;/a&gt; and it balances precision and recall, handling &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;class imbalance&lt;/a&gt; and highlighting poor performance on minority classes.&lt;/p&gt;</description></item><item><title>FN</title><link>https://davethehuman.com/notes/fn/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/fn/</guid><description>&lt;p&gt;In &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;binary classification&lt;/a&gt;, a &lt;em&gt;False Negative (FN)&lt;/em&gt; is a misclassification of the model that assigns a &amp;ldquo;False&amp;rdquo; label to an observation whose label is actually &amp;ldquo;True&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Used in the &lt;a href="https://davethehuman.com/notes/classification-metrics/"&gt;classification metrics&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>FP</title><link>https://davethehuman.com/notes/fp/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/fp/</guid><description>&lt;p&gt;In &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;binary classification&lt;/a&gt;, a &lt;em&gt;False Positive (FP)&lt;/em&gt; is a misclassification of the model that assigns a &amp;ldquo;True&amp;rdquo; label to an observation whose actual label is &amp;ldquo;False&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Used in the &lt;a href="https://davethehuman.com/notes/classification-metrics/"&gt;classification metrics&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>FPR</title><link>https://davethehuman.com/notes/fpr/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/fpr/</guid><description>&lt;p&gt;&lt;em&gt;False Positive Rate (FPR)&lt;/em&gt; is the ratio of &lt;strong&gt;the negative observations that are classified as positives&lt;/strong&gt; (how many &lt;a href="https://davethehuman.com/notes/fp/"&gt;FP&lt;/a&gt; over the sum of &lt;a href="https://davethehuman.com/notes/tp/"&gt;FP&lt;/a&gt; and &lt;a href="https://davethehuman.com/notes/tn/"&gt;FN&lt;/a&gt;):
&lt;/p&gt;
$$
\mathrm{FPR} = \frac{FP}{FP + TN}
$$&lt;p&gt;It is used in &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;ROC-AUC&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>precision</title><link>https://davethehuman.com/notes/precision/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/precision/</guid><description>&lt;p&gt;&lt;em&gt;Precision&lt;/em&gt; is the ratio of &lt;strong&gt;the observation classified as positives that are actually positives&lt;/strong&gt;.
In &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;binary classification&lt;/a&gt; settings, it takes the number of &lt;a href="https://davethehuman.com/notes/tp/"&gt;TP&lt;/a&gt; and divides it by the sum of &lt;a href="https://davethehuman.com/notes/tp/"&gt;TP&lt;/a&gt; and &lt;a href="https://davethehuman.com/notes/fp/"&gt;FP&lt;/a&gt;:
&lt;/p&gt;
$$
\mathrm{Precision} = \frac{TP}{TP + FP}
$$&lt;p&gt;While &lt;a href="https://davethehuman.com/notes/recall/"&gt;recall&lt;/a&gt; uses in the denominator the total number of observations that are actually positives, precision uses the total number of observations that are &lt;strong&gt;classified as positives&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This metric is useful in cases of &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;class imbalance&lt;/a&gt; and when the false positive creates severe inconvenience, financial loss or user distrust; a typical task where precision is used as a &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;metric&lt;/a&gt; is spam detection.&lt;/p&gt;</description></item><item><title>recall</title><link>https://davethehuman.com/notes/recall/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/recall/</guid><description>&lt;p&gt;&lt;em&gt;Recall&lt;/em&gt; is the ratio of &lt;strong&gt;the positive observations that are actually classified as positives&lt;/strong&gt;.
In &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;binary classification&lt;/a&gt; setting, it takes the number of &lt;a href="https://davethehuman.com/notes/tp/"&gt;TP&lt;/a&gt; and divides it by the sum of &lt;a href="https://davethehuman.com/notes/tp/"&gt;TP&lt;/a&gt; and &lt;a href="https://davethehuman.com/notes/fn/"&gt;FN&lt;/a&gt;:
&lt;/p&gt;
$$
\mathrm{Recall} = \frac{TP}{TP + FN}
$$&lt;p&gt;It is also called &lt;a href="https://davethehuman.com/notes/sensitivity/"&gt;sensitivity&lt;/a&gt; or &lt;a href="https://davethehuman.com/notes/tpr/"&gt;true positive rate&lt;/a&gt;. the correctly classified observations.&lt;/p&gt;
&lt;p&gt;While &lt;a href="https://davethehuman.com/notes/precision/"&gt;precision&lt;/a&gt; uses in the denominator the total number of observations classified as positives, recall uses the total number of observations that are &lt;strong&gt;actual positives&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>RSS</title><link>https://davethehuman.com/notes/rss/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/rss/</guid><description>&lt;p&gt;The &lt;em&gt;&lt;a href="https://davethehuman.com/notes/residual/"&gt;Residual&lt;/a&gt; Sum of Squares (RSS)&lt;/em&gt; is the &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;loss function&lt;/a&gt; used in &lt;a href="https://davethehuman.com/notes/linear-regression/"&gt;Linear Regression&lt;/a&gt; to find the &lt;a href="https://davethehuman.com/notes/weights/"&gt;weights&lt;/a&gt;.&lt;/p&gt;
$$
\operatorname{RSS} = \sum_{i=1}^{n} (y_i - \hat{y}_i)^2,
\qquad
\hat{y}_i = \beta_0 + x_i^{\mathsf{T}}\beta
$$&lt;p&gt;It is also the core error &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;metric&lt;/a&gt; used to build and optimize &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;regression&lt;/a&gt; &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;decision trees&lt;/a&gt; by selecting the best split that results in the lowest total RSS for the resulting &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;child nodes&lt;/a&gt;:&lt;/p&gt;
$$RSS = \sum_{i \in R_1} (y_i - \hat{y}_{R_1})^2 + \sum_{i \in R_2} (y_i - \hat{y}_{R_2})^2$$</description></item><item><title>sensitivity</title><link>https://davethehuman.com/notes/sensitivity/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/sensitivity/</guid><description>&lt;p&gt;See &lt;a href="https://davethehuman.com/notes/recall/"&gt;recall&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>TN</title><link>https://davethehuman.com/notes/tn/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/tn/</guid><description>&lt;p&gt;In &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;binary classification&lt;/a&gt;, a &lt;em&gt;True Negative (TN)&lt;/em&gt; is a correct classification of the model that assigns a &amp;ldquo;False&amp;rdquo; label to an observation whose label is &amp;ldquo;False&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Used in the &lt;a href="https://davethehuman.com/notes/classification-metrics/"&gt;classification metrics&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>TP</title><link>https://davethehuman.com/notes/tp/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/tp/</guid><description>&lt;p&gt;In &lt;a href="https://davethehuman.com/coming-soon/" rel="nofollow"&gt;binary classification&lt;/a&gt;, a &lt;em&gt;True Positive (TP)&lt;/em&gt; is a correct classification of the model that assigns a &amp;ldquo;True&amp;rdquo; label to an observation whose label is &amp;ldquo;True&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Used in the &lt;a href="https://davethehuman.com/notes/classification-metrics/"&gt;classification metrics&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>TPR</title><link>https://davethehuman.com/notes/tpr/</link><pubDate>Tue, 29 Sep 2026 00:00:00 +0000</pubDate><guid>https://davethehuman.com/notes/tpr/</guid><description>&lt;p&gt;See &lt;a href="https://davethehuman.com/notes/recall/"&gt;recall&lt;/a&gt;.&lt;/p&gt;</description></item></channel></rss>