From b7f6abfc941e0d8d198e3fc54d72997d44722cc8 Mon Sep 17 00:00:00 2001 From: Jan Benda Date: Tue, 10 Dec 2019 22:33:48 +0100 Subject: [PATCH] [regression] updated exercise to new chapter --- regression/exercises/exercises01.tex | 16 ++++++++-------- regression/exercises/lin_regression.mat | Bin 0 -> 487 bytes 2 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 regression/exercises/lin_regression.mat diff --git a/regression/exercises/exercises01.tex b/regression/exercises/exercises01.tex index 6d9e335..9e7c5b3 100644 --- a/regression/exercises/exercises01.tex +++ b/regression/exercises/exercises01.tex @@ -62,13 +62,13 @@ data in the file \emph{lin\_regression.mat}. In the lecture we already prepared the cost function - (\code{lsqError()}), and the gradient (\code{lsqGradient()}) (read - chapter 8 ``Optimization and gradient descent'' in the script, in - particular section 8.4 and exercise 8.4!). With these functions in - place we here want to implement a gradient descend algorithm that - finds the minimum of the cost function and thus the slope and - intercept of the straigth line that minimizes the squared distance - to the data values. + (\code{meanSquaredError()}), and the gradient + (\code{meanSquaredGradient()}) (read chapter 8 ``Optimization and + gradient descent'' in the script, in particular section 8.4 and + exercise 8.4!). With these functions in place we here want to + implement a gradient descend algorithm that finds the minimum of the + cost function and thus the slope and intercept of the straigth line + that minimizes the squared distance to the data values. The algorithm for the descent towards the minimum of the cost function is as follows: @@ -86,7 +86,7 @@ why we just require the gradient to be sufficiently small (e.g. \code{norm(gradient) < 0.1}). \item \label{gradientstep} Move against the gradient by a small step - ($\epsilon = 0.01$): + $\epsilon = 0.01$: \[\vec p_{i+1} = \vec p_i - \epsilon \cdot \nabla f_{cost}(m_i, b_i)\] \item Repeat steps \ref{computegradient} -- \ref{gradientstep}. \end{enumerate} diff --git a/regression/exercises/lin_regression.mat b/regression/exercises/lin_regression.mat new file mode 100644 index 0000000000000000000000000000000000000000..6a2162211ff903c5586fb5a36bee5375f29849eb GIT binary patch literal 487 zcmeZu4DoSvQZUssQ1EpO(M`+DN!3vZ$Vn_o%P-2cQgHY2i*PhE(NSSQtP%t#MGP1BTHV3i|O%;d)3^2gx>B|pfcLH(6oX5!t2|E~$sR%sd@396iPBp44hp9ANdB<@eB@L1i8LkwW>5|0<?`*2F$$DhINW{8z`)Go_8#P*b9f!Z33iac`?|l8KkGOCYWx~6Ew$Yz zz*-?>%8Q_9%L^K6T~p8JRqtf}?VVKLdZbfs$JaZ#bqTw!G>UIe7u#IfEmu)CBYP&e~u;Zb9k5>OPHDnKU{CM=#qb|PKnWED9K4B$0>fWc7FI>0Fx$gn< P+g!USK8EM7JbwcK2=l=y literal 0 HcmV?d00001