From 0b5a0647e257aa0247d57dcb5d31624ff0e6722d Mon Sep 17 00:00:00 2001 From: lukas-heiligenbrunner Date: Mon, 30 Dec 2024 14:06:47 +0100 Subject: [PATCH] add similarities and finish parts of matandmeth --- materialandmethods.typ | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/materialandmethods.typ b/materialandmethods.typ index 822f99c..755eb32 100644 --- a/materialandmethods.typ +++ b/materialandmethods.typ @@ -283,21 +283,40 @@ The softmax function has high similarities with the Boltzmann distribution and w === Cross Entropy Loss #todo[Maybe remove this section] Cross Entropy Loss is a well established loss function in machine learning. -Equation~\eqref{eq:crelformal}\cite{crossentropy} shows the formal general definition of the Cross Entropy Loss. -And equation~\eqref{eq:crelbinary} is the special case of the general Cross Entropy Loss for binary classification tasks. +@crel #cite() shows the formal general definition of the Cross Entropy Loss. +And @crel is the special case of the general Cross Entropy Loss for binary classification tasks. $ H(p,q) &= -sum_(x in cal(X)) p(x) log q(x)\ H(p,q) &= -(p log(q) + (1-p) log(1-q))\ cal(L)(p,q) &= -1/N sum_(i=1)^(cal(B)) (p_i log(q_i) + (1-p_i) log(1-q_i)) -$ +$ +#todo[Check how multiline equation refs work] -Equation~$cal(L)(p,q)$~\eqref{eq:crelbinarybatch}\cite{handsonaiI} is the Binary Cross Entropy Loss for a batch of size $cal(B)$ and used for model training in this Practical Work. +Equation~$cal(L)(p,q)$ @crel #cite() is the Binary Cross Entropy Loss for a batch of size $cal(B)$ and used for model training in this Practical Work. === Cosine Similarity +To measure the distance between two vectors some common distance measures are used. +One popular of them is the Cosine Similarity (@cosinesimilarity). +It measures the cosine of the angle between two vectors. +The Cosine Similarity is especially useful when the magnitude of the vectors is not important. +$ + cos(theta) &:= (A dot B) / (||A|| dot ||B||)\ + &= (sum_(i=1)^n A_i B_i)/ (sqrt(sum_(i=1)^n A_i^2) dot sqrt(sum_(i=1)^n B_i^2)) +$ + +#todo[Source?] === Euclidean Distance +The euclidean distance (@euclideannorm) is a simpler method to measure the distance between two points in a vector space. +It just calculates the square root of the sum of the squared differences of the coordinates. +the euclidean distance can also be represented as the L2 norm (euclidean norm) of the difference of the two vectors. +$ + cal(d)(A,B) = ||A-B|| := sqrt(sum_(i=1)^n (A_i - B_i)^2) +$ +#todo[Source?] == Alternative Methods There are several alternative methods to few-shot learning which are not used in this bachelor thesis. +#todo[Do it!]