From b4f3cdc8b09739c28b8d2c6e08b234ba2879c4bf Mon Sep 17 00:00:00 2001 From: nakul-py Date: Thu, 12 Dec 2024 11:40:19 +0530 Subject: [PATCH 1/2] Adding Balanced Accuracy formula into the book --- book/3-classification.tex | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/book/3-classification.tex b/book/3-classification.tex index 7ebe745..e9b8784 100644 --- a/book/3-classification.tex +++ b/book/3-classification.tex @@ -344,7 +344,20 @@ \subsection{Balanced Accuracy} % formula \begin{center} - [FORMULA GOES HERE] + \tikz{ + \node[inner sep=2pt, font=\Large] (a) { + { + $\displaystyle + Accuracy = \frac{\textcolor{nmlred}{TP} + \textcolor{nmlcyan}{TN}} + {\textcolor{nmlred}{TP} + \textcolor{nmlcyan}{TN} + \textcolor{nmlpurple}{FP} + \textcolor{nmlgreen}{FN}} + $ + } + }; + \draw[-latex, nmlpurple, semithick] ($(a.south)+(1.9,0.04)$) to[bend left=25] node[pos=1, left] {\color{nmlpurple} false positive} +(-.8, -.5); + \draw[-latex, nmlgreen, semithick] ($(a.south)+(3.4,0.04)$) to[bend left=-25] node[pos=1, right] {\color{nmlgreen} false negative} +(.8, -.7); + \draw[-latex, nmlred, semithick] ($(a.south)+(0.8, 1.2)$) to[bend right=25] node[pos=1, left] {\color{nmlred} true positive} +(-0.9, .6); + \draw[-latex, nmlcyan, semithick] ($(a.south)+(2.1, 1.2)$) to[bend left=25] node[pos=1, right] {\color{nmlcyan} true negative} +(0.9, .6); + } \end{center} It is particularly useful when working with datasets where some classes are significantly underrepresented, ensuring that the performance of all classes is treated equally. From aba2123aec779311d784202a2fcf9e85ff51f77a Mon Sep 17 00:00:00 2001 From: nakul-py Date: Fri, 13 Dec 2024 18:41:59 +0530 Subject: [PATCH 2/2] Adding Balanced-Accuracy Formula --- book/3-classification.tex | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/book/3-classification.tex b/book/3-classification.tex index e9b8784..d832339 100644 --- a/book/3-classification.tex +++ b/book/3-classification.tex @@ -348,15 +348,17 @@ \subsection{Balanced Accuracy} \node[inner sep=2pt, font=\Large] (a) { { $\displaystyle - Accuracy = \frac{\textcolor{nmlred}{TP} + \textcolor{nmlcyan}{TN}} - {\textcolor{nmlred}{TP} + \textcolor{nmlcyan}{TN} + \textcolor{nmlpurple}{FP} + \textcolor{nmlgreen}{FN}} + Balanced-Accuracy = \frac{1}{2} \left( + \frac{\textcolor{nmlred}{TP}}{\textcolor{nmlred}{TP} + \textcolor{nmlgreen}{FN}} + + \frac{\textcolor{nmlcyan}{TN}}{\textcolor{nmlcyan}{TN} + \textcolor{nmlpurple}{FP}} + \right) $ } }; - \draw[-latex, nmlpurple, semithick] ($(a.south)+(1.9,0.04)$) to[bend left=25] node[pos=1, left] {\color{nmlpurple} false positive} +(-.8, -.5); - \draw[-latex, nmlgreen, semithick] ($(a.south)+(3.4,0.04)$) to[bend left=-25] node[pos=1, right] {\color{nmlgreen} false negative} +(.8, -.7); - \draw[-latex, nmlred, semithick] ($(a.south)+(0.8, 1.2)$) to[bend right=25] node[pos=1, left] {\color{nmlred} true positive} +(-0.9, .6); - \draw[-latex, nmlcyan, semithick] ($(a.south)+(2.1, 1.2)$) to[bend left=25] node[pos=1, right] {\color{nmlcyan} true negative} +(0.9, .6); + \draw[-latex, nmlgreen, semithick] ($(a.south)+(2.1,0.04)$) to[bend left=25] node[pos=1, left] {\color{nmlgreen} false negative} +(-.8, -.5); + \draw[-latex, nmlpurple, semithick] ($(a.south)+(5.1,0.04)$) to[bend left=-25] node[pos=1, right] {\color{nmlpurple} false positive} +(.8, -.7); + \draw[-latex, nmlred, semithick] ($(a.south)+(1.5, 1.3)$) to[bend right=25] node[pos=1, left] {\color{nmlred} true positive} +(-0.9, .6); + \draw[-latex, nmlcyan, semithick] ($(a.south)+(4.5, 1.3)$) to[bend left=25] node[pos=1, right] {\color{nmlcyan} true negative} +(0.9, .6); } \end{center}