Commit 6316eb9e authored by Armin Rauschenberger's avatar Armin Rauschenberger

automation

parent b178b6f6
......@@ -492,11 +492,9 @@ print.starnet <- function(x,...){
#' X <- matrix(rnorm(n*p),nrow=n,ncol=p)
#' y <- rnorm(n=n,mean=rowSums(X[,1:20]))
#' \dontshow{
#' loss <- cv.starnet(y=y,X=X,nfolds.ext=2,nfolds.int=3)
#' }
#' loss <- cv.starnet(y=y,X=X,nfolds.ext=2,nfolds.int=3)}
#' \dontrun{
#' loss <- cv.starnet(y=y,X=X)
#' }
#' loss <- cv.starnet(y=y,X=X)}
#'
cv.starnet <- function(y,X,family="gaussian",nalpha=21,alpha=NULL,nfolds.ext=10,nfolds.int=10,foldid.ext=NULL,foldid.int=NULL,type.measure="deviance",alpha.meta=1,nzero=NULL,intercept=NULL,upper.limit=NULL,unit.sum=NULL,...){
......@@ -574,9 +572,7 @@ cv.starnet <- function(y,X,family="gaussian",nalpha=21,alpha=NULL,nfolds.ext=10,
return(list(meta=meta,base=base,extra=extra))
}
#' @name
#' .simulate
#' @name .simulate
#' @title
#' Simulation
#'
......@@ -622,8 +618,7 @@ cv.starnet <- function(y,X,family="gaussian",nalpha=21,alpha=NULL,nfolds.ext=10,
}
return(list(y=y,X=X))
}
#' @describeIn .simulate.block
#' @rdname .simulate
#' @param rho
#' correlation\strong{:}
#' numeric between \eqn{0} and \eqn{1}
......@@ -644,8 +639,7 @@ cv.starnet <- function(y,X,family="gaussian",nalpha=21,alpha=NULL,nfolds.ext=10,
y <- switch(family,gaussian=y,binomial=round(1/(1+exp(-y))),stop("Invalid."))
return(list(y=y,X=X,beta=beta))
}
#' @describeIn .simulate.block
#' @rdname .simulate
#'
.simulate.mode <- function(n,p,mode,family="gaussian"){
mean <- rep(x=0,times=p)
......@@ -661,7 +655,6 @@ cv.starnet <- function(y,X,family="gaussian",nalpha=21,alpha=NULL,nfolds.ext=10,
return(list(y=y,X=X,beta=beta))
}
#' @title
#' Loss
#'
......
......@@ -51,7 +51,8 @@
#' # vector "beta": slopes
#'
#' #--- model comparison ---
#' loss <- cv.starnet(y=y,X=X)
#' \dontrun{
#' loss <- cv.starnet(y=y,X=X)}
#' # cross-validated loss for different alpha,
#' # and for tuning and stacking
#'
......
......@@ -97,7 +97,7 @@
<p>or the latest development version from <a href="https://github.com/rauschenberger/starnet">GitHub</a>:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1"><span class="co">#install.packages("devtools")</span></a>
<a class="sourceLine" id="cb2-2" title="2">devtools<span class="op">::</span><span class="kw"><a href="https://devtools.r-lib.org//reference/remote-reexports.html">install_github</a></span>(<span class="st">"rauschenberger/starnet"</span>)</a></code></pre></div>
<p>A Rauschenberger, E Glaab, and MA van de Wiel (2020). “Predictive and interpretable models via the stacked elastic net”. <em>Manuscript in preparation.</em></p>
<p>A Rauschenberger, E Glaab, and MA van de Wiel (2020). “Predictive and interpretable models via the stacked elastic net”. <em>Bioinformatics.</em> In press.</p>
</div>
</div>
......
......@@ -240,10 +240,8 @@ or <code>NULL</code>
<span class='no'>X</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/base/matrix.html'>matrix</a></span>(<span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='no'>n</span>*<span class='no'>p</span>),<span class='kw'>nrow</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>ncol</span><span class='kw'>=</span><span class='no'>p</span>)
<span class='no'>y</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='https://rdrr.io/r/stats/Normal.html'>rnorm</a></span>(<span class='kw'>n</span><span class='kw'>=</span><span class='no'>n</span>,<span class='kw'>mean</span><span class='kw'>=</span><span class='fu'><a href='https://rdrr.io/r/base/colSums.html'>rowSums</a></span>(<span class='no'>X</span>[,<span class='fl'>1</span>:<span class='fl'>20</span>]))
<span class='co'># \dontshow{</span>
<span class='no'>loss</span> <span class='kw'>&lt;-</span> <span class='fu'>cv.starnet</span>(<span class='kw'>y</span><span class='kw'>=</span><span class='no'>y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>,<span class='kw'>nfolds.ext</span><span class='kw'>=</span><span class='fl'>2</span>,<span class='kw'>nfolds.int</span><span class='kw'>=</span><span class='fl'>3</span>)</div><div class='img'><img src='cv.starnet-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='co'># }</span>
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='no'>loss</span> <span class='kw'>&lt;-</span> <span class='fu'>cv.starnet</span>(<span class='kw'>y</span><span class='kw'>=</span><span class='no'>y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>)
}</div></pre>
<span class='no'>loss</span> <span class='kw'>&lt;-</span> <span class='fu'>cv.starnet</span>(<span class='kw'>y</span><span class='kw'>=</span><span class='no'>y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>,<span class='kw'>nfolds.ext</span><span class='kw'>=</span><span class='fl'>2</span>,<span class='kw'>nfolds.int</span><span class='kw'>=</span><span class='fl'>3</span>)<span class='co'># }</span></div><div class='img'><img src='cv.starnet-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='no'>loss</span> <span class='kw'>&lt;-</span> <span class='fu'>cv.starnet</span>(<span class='kw'>y</span><span class='kw'>=</span><span class='no'>y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>)}</div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
......
......@@ -172,10 +172,10 @@ Predictive and interpretable models via the stacked elastic net".
<span class='co'># vector "beta": slopes</span>
<span class='co'>#--- model comparison ---</span>
<span class='no'>loss</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='cv.starnet.html'>cv.starnet</a></span>(<span class='kw'>y</span><span class='kw'>=</span><span class='no'>y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>)</div><div class='img'><img src='starnet-package-1.png' alt='' width='700' height='433' /></div><div class='input'># cross-validated loss for different alpha,
# and for tuning and stacking
</div></pre>
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
<span class='no'>loss</span> <span class='kw'>&lt;-</span> <span class='fu'><a href='cv.starnet.html'>cv.starnet</a></span>(<span class='kw'>y</span><span class='kw'>=</span><span class='no'>y</span>,<span class='kw'>X</span><span class='kw'>=</span><span class='no'>X</span>)}
<span class='co'># cross-validated loss for different alpha,</span>
<span class='co'># and for tuning and stacking</span></div></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
......
......@@ -90,10 +90,8 @@ n <- 50; p <- 20
X <- matrix(rnorm(n*p),nrow=n,ncol=p)
y <- rnorm(n=n,mean=rowSums(X[,1:20]))
\dontshow{
loss <- cv.starnet(y=y,X=X,nfolds.ext=2,nfolds.int=3)
}
loss <- cv.starnet(y=y,X=X,nfolds.ext=2,nfolds.int=3)}
\dontrun{
loss <- cv.starnet(y=y,X=X)
}
loss <- cv.starnet(y=y,X=X)}
}
......@@ -42,7 +42,8 @@ coef <- coef(object)
# vector "beta": slopes
#--- model comparison ---
loss <- cv.starnet(y=y,X=X)
\dontrun{
loss <- cv.starnet(y=y,X=X)}
# cross-validated loss for different alpha,
# and for tuning and stacking
......
......@@ -30,4 +30,4 @@ devtools::install_github("rauschenberger/starnet")
A Rauschenberger, E Glaab, and MA van de Wiel (2020).
"Predictive and interpretable models via the stacked elastic net".
*Manuscript in preparation.*
*Bioinformatics.* In press.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment