\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k+kn}{import} \PYG{n+nn}{cyanure} \PYG{k+kn}{as} \PYG{n+nn}{ars}
\PYG{c+c1}{\PYGZsh{}load rcv1 dataset about 1Gb, n=781265, p=47152}
\PYG{n}{data} \PYG{o}{=} \PYG{n}{np}\PYG{o}{.}\PYG{n}{load}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}rcv1.npz\PYGZsq{}}\PYG{p}{,}\PYG{n}{allow\PYGZus{}pickle}\PYG{o}{=}\PYG{n+nb+bp}{True}\PYG{p}{);} \PYG{n}{y}\PYG{o}{=}\PYG{n}{data}\PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}y\PYGZsq{}}\PYG{p}{];} \PYG{n}{X}\PYG{o}{=}\PYG{n}{data}\PYG{p}{[}\PYG{l+s+s1}{\PYGZsq{}X\PYGZsq{}}\PYG{p}{]}
\PYG{n}{X} \PYG{o}{=} \PYG{n}{scipy}\PYG{o}{.}\PYG{n}{sparse}\PYG{o}{.}\PYG{n}{csc\PYGZus{}matrix}\PYG{p}{(}\PYG{n}{X}\PYG{o}{.}\PYG{n}{all}\PYG{p}{())}\PYG{o}{.}\PYG{n}{T} \PYG{c+c1}{\PYGZsh{} n x p matrix, csr format}
\PYG{c+c1}{\PYGZsh{}normalize the rows of X in\PYGZhy{}place, without performing any copy}
\PYG{n}{ars}\PYG{o}{.}\PYG{n}{preprocess}\PYG{p}{(}\PYG{n}{X}\PYG{p}{,}\PYG{n}{normalize}\PYG{o}{=}\PYG{n+nb+bp}{True}\PYG{p}{,}\PYG{n}{columns}\PYG{o}{=}\PYG{n+nb+bp}{False}\PYG{p}{)}
\PYG{c+c1}{\PYGZsh{}declare a binary classifier for squared hinge loss + l1 regularization}
\PYG{n}{classifier}\PYG{o}{=}\PYG{n}{ars}\PYG{o}{.}\PYG{n}{BinaryClassifier}\PYG{p}{(}\PYG{n}{loss}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}sqhinge\PYGZsq{}}\PYG{p}{,}\PYG{n}{penalty}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}l2\PYGZsq{}}\PYG{p}{)}
\PYG{c+c1}{\PYGZsh{} uses the auto solver by default, performs at most 500 epochs}
\PYG{n}{classifier}\PYG{o}{.}\PYG{n}{fit}\PYG{p}{(}\PYG{n}{X}\PYG{p}{,}\PYG{n}{y}\PYG{p}{,}\PYG{n}{lambd}\PYG{o}{=}\PYG{l+m+mf}{0.000005}\PYG{p}{,}\PYG{n}{nepochs}\PYG{o}{=}\PYG{l+m+mi}{500}\PYG{p}{,}\PYG{n}{tol}\PYG{o}{=}\PYG{l+m+mf}{1e\PYGZhy{}3}\PYG{p}{)}
\end{Verbatim}
