\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{def} \PYG{n+nf}{show\PYGZus{}progress}\PYG{p}{(}\PYG{n}{iteration}\PYG{p}{,} \PYG{n}{loglikelihood}\PYG{p}{):}
\PYG{g+go}{        print(\PYGZdq{}Iteration:\PYGZdq{}, iteration, \PYGZdq{}Log\PYGZhy{}likelihood function:\PYGZdq{}, loglikelihood)}
\PYG{g+go}{\PYGZgt{}\PYGZgt{}\PYGZgt{}}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{model} \PYG{o}{=} \PYG{n}{LogisticRegression}\PYG{o}{.}\PYG{n}{train}\PYG{p}{(}\PYG{n}{xs}\PYG{p}{,} \PYG{n}{ys}\PYG{p}{,} \PYG{n}{update\PYGZus{}fn}\PYG{o}{=}\PYG{n}{show\PYGZus{}progress}\PYG{p}{)}
\PYG{g+go}{Iteration: 0 Log\PYGZhy{}likelihood function: \PYGZhy{}11.7835020695}
\PYG{g+go}{Iteration: 1 Log\PYGZhy{}likelihood function: \PYGZhy{}7.15886767672}
\PYG{g+go}{Iteration: 2 Log\PYGZhy{}likelihood function: \PYGZhy{}5.76877209868}
\PYG{g+go}{Iteration: 3 Log\PYGZhy{}likelihood function: \PYGZhy{}5.11362294338}
\PYG{g+go}{Iteration: 4 Log\PYGZhy{}likelihood function: \PYGZhy{}4.74870642433}
\PYG{g+go}{Iteration: 5 Log\PYGZhy{}likelihood function: \PYGZhy{}4.50026077146}
\PYG{g+go}{Iteration: 6 Log\PYGZhy{}likelihood function: \PYGZhy{}4.31127773737}
\PYG{g+go}{Iteration: 7 Log\PYGZhy{}likelihood function: \PYGZhy{}4.16015043396}
\PYG{g+go}{Iteration: 8 Log\PYGZhy{}likelihood function: \PYGZhy{}4.03561719785}
\PYG{g+go}{Iteration: 9 Log\PYGZhy{}likelihood function: \PYGZhy{}3.93073282192}
\PYG{g+go}{Iteration: 10 Log\PYGZhy{}likelihood function: \PYGZhy{}3.84087660929}
\PYG{g+go}{Iteration: 11 Log\PYGZhy{}likelihood function: \PYGZhy{}3.76282560605}
\PYG{g+go}{Iteration: 12 Log\PYGZhy{}likelihood function: \PYGZhy{}3.69425027154}
\PYG{g+go}{Iteration: 13 Log\PYGZhy{}likelihood function: \PYGZhy{}3.6334178602}
\PYG{g+go}{Iteration: 14 Log\PYGZhy{}likelihood function: \PYGZhy{}3.57900855837}
\PYG{g+go}{Iteration: 15 Log\PYGZhy{}likelihood function: \PYGZhy{}3.52999671386}
\PYG{g+go}{Iteration: 16 Log\PYGZhy{}likelihood function: \PYGZhy{}3.48557145163}
\PYG{g+go}{Iteration: 17 Log\PYGZhy{}likelihood function: \PYGZhy{}3.44508206139}
\PYG{g+go}{Iteration: 18 Log\PYGZhy{}likelihood function: \PYGZhy{}3.40799948447}
\PYG{g+go}{Iteration: 19 Log\PYGZhy{}likelihood function: \PYGZhy{}3.3738885624}
\PYG{g+go}{Iteration: 20 Log\PYGZhy{}likelihood function: \PYGZhy{}3.3423876581}
\PYG{g+go}{Iteration: 21 Log\PYGZhy{}likelihood function: \PYGZhy{}3.31319343769}
\PYG{g+go}{Iteration: 22 Log\PYGZhy{}likelihood function: \PYGZhy{}3.2860493346}
\PYG{g+go}{Iteration: 23 Log\PYGZhy{}likelihood function: \PYGZhy{}3.2607366863}
\PYG{g+go}{Iteration: 24 Log\PYGZhy{}likelihood function: \PYGZhy{}3.23706784091}
\PYG{g+go}{Iteration: 25 Log\PYGZhy{}likelihood function: \PYGZhy{}3.21488073614}
\PYG{g+go}{Iteration: 26 Log\PYGZhy{}likelihood function: \PYGZhy{}3.19403459259}
\PYG{g+go}{Iteration: 27 Log\PYGZhy{}likelihood function: \PYGZhy{}3.17440646052}
\PYG{g+go}{Iteration: 28 Log\PYGZhy{}likelihood function: \PYGZhy{}3.15588842703}
\PYG{g+go}{Iteration: 29 Log\PYGZhy{}likelihood function: \PYGZhy{}3.13838533947}
\PYG{g+go}{Iteration: 30 Log\PYGZhy{}likelihood function: \PYGZhy{}3.12181293595}
\PYG{g+go}{Iteration: 31 Log\PYGZhy{}likelihood function: \PYGZhy{}3.10609629966}
\PYG{g+go}{Iteration: 32 Log\PYGZhy{}likelihood function: \PYGZhy{}3.09116857282}
\PYG{g+go}{Iteration: 33 Log\PYGZhy{}likelihood function: \PYGZhy{}3.07696988017}
\PYG{g+go}{Iteration: 34 Log\PYGZhy{}likelihood function: \PYGZhy{}3.06344642288}
\PYG{g+go}{Iteration: 35 Log\PYGZhy{}likelihood function: \PYGZhy{}3.05054971191}
\PYG{g+go}{Iteration: 36 Log\PYGZhy{}likelihood function: \PYGZhy{}3.03823591619}
\PYG{g+go}{Iteration: 37 Log\PYGZhy{}likelihood function: \PYGZhy{}3.02646530573}
\PYG{g+go}{Iteration: 38 Log\PYGZhy{}likelihood function: \PYGZhy{}3.01520177394}
\PYG{g+go}{Iteration: 39 Log\PYGZhy{}likelihood function: \PYGZhy{}3.00441242601}
\PYG{g+go}{Iteration: 40 Log\PYGZhy{}likelihood function: \PYGZhy{}2.99406722296}
\PYG{g+go}{Iteration: 41 Log\PYGZhy{}likelihood function: \PYGZhy{}2.98413867259}
\end{Verbatim}
