Skip to content

Commit 4889cc8

Browse files
committed
fix regls in re. PDF searching
1 parent 9806833 commit 4889cc8

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

addons/regls/doc/regls.tex

+34-34
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ \section{Basic options}
129129

130130
In case you wish to specify a sequence succinctly but with more
131131
control, the package contains a utility function
132-
\texttt{lambda\_sequence()}, which takes up to three arguments. The
132+
\dtk{lambda_sequence()}, which takes up to three arguments. The
133133
first and second arguments (required) give the maximum $s$ and the
134134
number of values, while the third (optional) argument can be used to
135135
give the minimum $s$ (by default 0.0001). As with the \texttt{nlambda}
@@ -380,14 +380,14 @@ \section{Obtaining predicted values}
380380
Optimization of out-of-sample prediction is of course the name of the
381381
game with regularized regression. To obtain out-of-sample predictions
382382
(and/or within-sample fitted values if you want them), the recommended
383-
approach is to use \texttt{regls\_pred()}. This function takes two
383+
approach is to use \dtk{regls_pred()}. This function takes two
384384
arguments: a bundle produced by \texttt{regls()} and the list passed
385385
to \texttt{regls} as \texttt{X}. By default the return value is a
386386
series holding predicted values.
387387

388388
If you use \texttt{mregls()} for estimation, the alternative
389-
prediction function \texttt{mregls\_pred()} should be called in place
390-
of \texttt{regls\_pred}. In that case the second argument should be a
389+
prediction function \dtk{mregls_pred()} should be called in place
390+
of \dtk{regls_pred}. In that case the second argument should be a
391391
matrix of regressors with the same number of columns as that passed to
392392
\texttt{mregls}, and by default the return value is a column vector of
393393
length equal to the row dimension of the matrix argument.
@@ -398,7 +398,7 @@ \section{Obtaining predicted values}
398398
values---that is, the BIC minimizer if cross-validation is not
399399
performed, or that corresponding to either \texttt{idxmin} or
400400
\texttt{idx1se} (see above) after cross-validation. The
401-
\texttt{idxmin} value is used automatically unless \texttt{use\_1se}
401+
\texttt{idxmin} value is used automatically unless \dtk{use_1se}
402402
was set in the parameter bundle passed to \texttt{regls} or
403403
\texttt{mregls}.
404404

@@ -427,8 +427,8 @@ \subsection{Further options}
427427
Beyond the default behavior of the prediction functions, if multiple
428428
$\lambda$ values were used in estimation you can control the output by
429429
adding a preference to the bundle \texttt{b}, under the key
430-
\texttt{pred}, before passing it to \texttt{regls\_pred} or
431-
\texttt{mregls\_pred}. The admissible values for \texttt{pred} are as
430+
\texttt{pred}, before passing it to \dtk{regls_pred} or
431+
\dtk{mregls_pred}. The admissible values for \texttt{pred} are as
432432
follows:
433433
\begin{enumerate}
434434
\item \texttt{idxmin}: use the \texttt{idxmin} column of the \texttt{B}
@@ -482,7 +482,7 @@ \section{Execution speed}
482482
\item We implemented automatic ``farming out'' of cross validation to
483483
multiple \textsf{MPI} processes (when \textsf{MPI} is available on
484484
the host machine). It's possible to prevent this by adding
485-
\texttt{no\_mpi} to the parameter bundle with a non-zero value.
485+
\dtk{no_mpi} to the parameter bundle with a non-zero value.
486486
\end{itemize}
487487
In one benchmark case we considered---with 1500 training observations,
488488
101 covariates, 50 values of $\lambda$ and 10 randomized cross
@@ -574,34 +574,34 @@ \section{Ridge regression}
574574
drive all coefficients to zero and so no ``natural'' maximum to serve
575575
as a benchmark. We therefore offer the user three options for the
576576
specification of ``\texttt{lfrac},'' controlled by the integer-valued
577-
parameter \texttt{lambda\_scale}:
577+
parameter \dtk{lambda_scale}:
578578
\begin{itemize}
579-
\item \texttt{lambda\_scale} = 0: no scaling is performed. The
579+
\item \dtk{lambda_scale} = 0: no scaling is performed. The
580580
``\texttt{lfrac}'' values are taken as actual $\lambda$ values (and
581581
so do not have to be bounded by 1.0 above).
582-
\item \texttt{lambda\_scale} = 1 (the default): we emulate
582+
\item \dtk{lambda_scale} = 1 (the default): we emulate
583583
\textsf{glmnet}. The largest value of $\lambda$ is set to
584584
$9.9 \times 10^{35}$, which will drive all coefficients to
585585
near-zero. The second-largest $\lambda$ (call it $\lambda_2$) is
586586
then set to 1000 times $\|X'y\|_{\infty}$, and subsequent values in
587587
the sequence are scaled in relation to $\lambda_2$.
588-
\item \texttt{lambda\_scale} = 2: we follow the suggestion of some
588+
\item \dtk{lambda_scale} = 2: we follow the suggestion of some
589589
practitioners, setting $\lambda_{\max}$ to the squared Frobenius
590590
norm of $X$, which will not drive all coefficients to near-zero but
591591
will impose substantial shrinkage in relation to OLS.
592592
\end{itemize}
593593

594594
To be clear on the action of options 1 and 2 for
595-
\texttt{lambda\_scale}, suppose our \texttt{lfrac} specification is
595+
\dtk{lambda_scale}, suppose our \texttt{lfrac} specification is
596596
\begin{code}
597597
lfrac = {1, 0.5, 0.25, 0.125}
598598
\end{code}
599-
Then if \texttt{lambda\_scale} = 1 this translates to
599+
Then if \dtk{lambda_scale} = 1 this translates to
600600
\begin{code}
601601
lam2 = 1000 * infnorm(X'y)
602602
effective_lambda = {9.9e35, lam2, 0.5*lam2, 0.25*lam2}
603603
\end{code}
604-
while if \texttt{lambda\_scale} = 2 it becomes
604+
while if \dtk{lambda_scale} = 2 it becomes
605605
\begin{code}
606606
lam1 = tr(X'X) # Frobenius norm squared
607607
effective_lambda = {lam1, 0.5*lam1, 0.25*lam1, 0.125*lam1}
@@ -610,10 +610,10 @@ \section{Ridge regression}
610610
standardization.
611611

612612
One further point on the scaling of $\lambda$: since the key
613-
\texttt{lfrac} doesn't look right when \texttt{lambda\_scale} = 0, we
613+
\texttt{lfrac} doesn't look right when \dtk{lambda_scale} = 0, we
614614
accept \texttt{lambda} as an alternative key. In fact, if
615615
\texttt{lambda} rather than \texttt{lfrac} is found in the input
616-
bundle, the default for \texttt{lambda\_scale} switches to 0 (but an
616+
bundle, the default for \dtk{lambda_scale} switches to 0 (but an
617617
explicit setting will override this).
618618

619619
In addition to \texttt{BIC} and \texttt{R2} the return bundle from
@@ -646,7 +646,7 @@ \section{The CCD option}
646646
governed by two additional keys in the \texttt{parms} bundle:
647647
\begin{itemize}
648648
\item \texttt{ccd}: boolean, default 0. Set this to 1 to use CCD.
649-
\item \texttt{ccd\_toler}: a positive scalar setting the convergence
649+
\item \dtk{ccd_toler}: a positive scalar setting the convergence
650650
tolerance for CCD. The default is $10^{-7}$ (as in \textsf{glmnet});
651651
setting a smaller value will give greater accuracy at the expense of
652652
more iterations.
@@ -683,7 +683,7 @@ \section{Elastic net}
683683
In the \texttt{regls} function, elastic net is selected by specifying
684684
a fractional value under the key \texttt{alpha} in the parameters
685685
bundle. This automatically switches to the CCD algorithm
686-
(Section~\ref{sec:ccd}), so the \texttt{ccd\_toler} option becomes
686+
(Section~\ref{sec:ccd}), so the \dtk{ccd_toler} option becomes
687687
applicable.\footnote{In principle the ADMM algorithm could handle
688688
elastic net, but to date we have not implemented such support.}
689689

@@ -802,20 +802,20 @@ \section{Reference: public functions}
802802
\texttt{nlambda} & integer & number of automatic $\lambda$s \\
803803
\texttt{stdize} & 0/1, default 1 & standardize the data \\
804804
\texttt{ridge} & 0/1, default 0 & do Ridge regression \\
805-
\texttt{lambda\_scale} & 0, 1 or 2, default 1 & see Section~\ref{sec:ridge} \\
805+
\dtk{lambda_scale} & 0, 1 or 2, default 1 & see Section~\ref{sec:ridge} \\
806806
\texttt{verbosity} & 0, 1, 2 or 3, default 1 & printing of output\\
807807
\texttt{xvalidate} & 0/1, default 0 & do cross validation\\
808808
\texttt{nfolds} & optional integer $>1$, default 10 & number of
809809
folds \\
810810
\texttt{randfolds} & 0/1, default 0 & use random folds\\
811-
\texttt{use\_1se} & 0/1, default 0 & see Section~\ref{sec:xvalid} \\
811+
\dtk{use_1se} & 0/1, default 0 & see Section~\ref{sec:xvalid} \\
812812
\texttt{seed} & optional integer & controls random folds\\
813-
\texttt{single\_b} & 0/1, default 0 & see Section~\ref{sec:xvalid}\\
814-
\texttt{no\_mpi} & 0/1, default 0 & see Section~\ref{sec:speed}\\
813+
\dtk{single_b} & 0/1, default 0 & see Section~\ref{sec:xvalid}\\
814+
\dtk{no_mpi} & 0/1, default 0 & see Section~\ref{sec:speed}\\
815815
\texttt{admmctrl} & optional control vector & see
816816
Section~\ref{sec:add-controls} \\
817817
\texttt{ccd} & 0/1, default 0 & see section~\ref{sec:ccd} \\
818-
\texttt{ccd\_toler} & positive scalar, default $10^{-7}$ & see
818+
\dtk{ccd_toler} & positive scalar, default $10^{-7}$ & see
819819
Section~\ref{sec:ccd}\\
820820
\texttt{alpha} & $0 \leq \alpha \leq 1$ (default 1) & see
821821
Section~\ref{sec:elnet}
@@ -883,7 +883,7 @@ \section{Reference: public functions}
883883
$R^2$, the sum of absolute values of the coefficients, and df (the
884884
number of non-zero coefficients) associated with each value of
885885
$\lambda$. Usage is illustrated in the example script
886-
\texttt{lambda\_sequence.inp}, which is reproduced in part in
886+
\dtk{lambda_sequence.inp}, which is reproduced in part in
887887
Listing~\ref{script:lamseq}.
888888
\end{funcdoc}
889889

@@ -907,7 +907,7 @@ \section{Reference: public functions}
907907
file, as described in the documentation for gretl's \texttt{gnuplot}
908908
command. By default the plot is shown on screen.
909909

910-
See also \texttt{mregls\_coeff\_plot} below.
910+
See also \dtk{mregls_coeff_plot} below.
911911
\end{funcdoc}
912912

913913
\begin{funcdoc}
@@ -937,7 +937,7 @@ \section{Reference: public functions}
937937
handles the presence or absence of an estimated intercept, as well
938938
as selection of a specific coefficient vector when estimation has
939939
been performed for multiple values of the regularization parameter.
940-
See also \texttt{mregls\_pred} below. See Section~\ref{sec:predict}
940+
See also \dtk{mregls_pred} below. See Section~\ref{sec:predict}
941941
for details.
942942
\end{funcdoc}
943943

@@ -959,7 +959,7 @@ \section{Reference: public functions}
959959
\begin{verbatim}
960960
matrix mregls_pred (const bundle b, const matrix X)
961961
\end{verbatim}
962-
Companion to \texttt{regls\_pred}, for a bundle obtained via
962+
Companion to \dtk{regls_pred}, for a bundle obtained via
963963
\texttt{mregls}. The matrix \texttt{X} must have the same number of
964964
columns as that passed to \texttt{mregls}. The return value is by
965965
default a column vector of length equal to the row dimension of
@@ -974,7 +974,7 @@ \section{Reference: public functions}
974974
\begin{verbatim}
975975
void mregls_coeff_plot (const bundle b, const matrix sel[null], string fname[null])
976976
\end{verbatim}
977-
Works just like \texttt{regls\_coeff\_plot} (see above) except that
977+
Works just like \dtk{regls_coeff_plot} (see above) except that
978978
this variant is for use after \texttt{mregls} estimation. The
979979
optional selection of coefficients to be tracked works via a
980980
selection (row) vector. The elements of this vector should be column
@@ -1003,7 +1003,7 @@ \section{Reference: public functions}
10031003
Convenience function for facilitating comparison of results when the
10041004
same regularization task has been performed in gretl using
10051005
\texttt{regls} and in \textsf{R} using \texttt{glmnet}. The output
1006-
is like that of \texttt{regls\_multiprint}. The matrices
1006+
is like that of \dtk{regls_multiprint}. The matrices
10071007
\texttt{RB} and \texttt{Rlam} should be obtained from the object
10081008
returned by \texttt{glmnet()}; \texttt{b} should be the bundle
10091009
returned by \texttt{regls}. Usage is illustrated in
@@ -1019,8 +1019,8 @@ \section{Change log}
10191019
variable; make plots more robust; add descriptive labels to the
10201020
included murder-rates dataset; expand and update the documentation.\\[4pt]
10211021
2023-05-20: Add support for matrix input via the \texttt{mregls}
1022-
function; simplify the signature of \texttt{regls\_multiprint};
1023-
add function \texttt{glmnet\_multiprint}.\\[4pt]
1022+
function; simplify the signature of \dtk{regls_multiprint};
1023+
add function \dtk{glmnet_multiprint}.\\[4pt]
10241024
2022-10-02: Enhancements for regls plots; document GUI usage; update
10251025
an internal function signature to comply with gretl's
10261026
new ``const inheritance'' policy.\\[4pt]
@@ -1149,7 +1149,7 @@ \subsection{Ridge: SVD and CCD}
11491149
a tolerance of $10^{-9}$ or less. Note, however, that there seems to
11501150
be little point in reducing the CCD tolerance below $10^{-9}$.
11511151
1152-
%% Ridge: CCD and SVD, using \texttt{ridge\_crit\_native.inp}
1152+
%% Ridge: CCD and SVD, using \dtk{ridge_crit_native.inp}
11531153
\begin{figure}[htbp]
11541154
\begin{center}
11551155
\includegraphics[scale=0.9]{ccd_svd.pdf}
@@ -1181,7 +1181,7 @@ \subsection{LASSO: ADMM and CCD}
11811181
$10^{-7}$ to $10^{-9}$ Ridge time becomes slightly greater than SVD
11821182
time, while LASSO time becomes over twice that of ADMM.
11831183
1184-
%% LASSO: CCD and ADMM, using \texttt{lasso\_crit\_native.inp}
1184+
%% LASSO: CCD and ADMM, using \dtk{lasso_crit_native.inp}
11851185
\begin{figure}[htbp]
11861186
\begin{center}
11871187
\includegraphics[scale=0.9]{ccd_admm.pdf}

0 commit comments

Comments
 (0)