Commit 71948291 authored by Armin Rauschenberger's avatar Armin Rauschenberger
Browse files

automation

parent a79a8bca
This diff is collapsed.
......@@ -405,11 +405,14 @@ predict.cornet <- function(object,newx,type="probability",...){
#' Compares models for a continuous response with a cutoff value
#'
#' @inheritParams cornet
#'
#' @param trial
#' logical
#'
#' @examples
#' NA
#'
.compare <- function(y,cutoff,X,alpha=1,nfolds=5,foldid=NULL,type.measure="deviance"){
.compare <- function(y,cutoff,X,alpha=1,nfolds=5,foldid=NULL,type.measure="deviance",trial=FALSE){
z <- 1*(y > cutoff)
if(is.null(foldid)){
......@@ -439,8 +442,15 @@ predict.cornet <- function(object,newx,type="probability",...){
type <- c("deviance","class","mse","mae","auc")
loss <- lapply(X=type,FUN=function(x) cornet:::.loss(y=z,fit=pred,family="binomial",type.measure=x,foldid=fold)[[1]])
names(loss) <- type
if(trial){
list <- list(diff=(pred-z)^2,loss=loss)
return(list)
} else {
return(loss)
}
return(loss)
}
#' @title
......
......@@ -112,7 +112,7 @@
</div>
<pre class="usage"><span class='fu'>.compare</span>(<span class='no'>y</span>, <span class='no'>cutoff</span>, <span class='no'>X</span>, <span class='kw'>alpha</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>nfolds</span> <span class='kw'>=</span> <span class='fl'>5</span>, <span class='kw'>foldid</span> <span class='kw'>=</span> <span class='kw'>NULL</span>,
<span class='kw'>type.measure</span> <span class='kw'>=</span> <span class='st'>"deviance"</span>)</pre>
<span class='kw'>type.measure</span> <span class='kw'>=</span> <span class='st'>"deviance"</span>, <span class='kw'>trial</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
......@@ -153,6 +153,10 @@ or <code>NULL</code> (balance)</p></td>
<td><p>loss function for binary classification
(linear regression uses the deviance)</p></td>
</tr>
<tr>
<th>trial</th>
<td><p>logical</p></td>
</tr>
</table>
......
......@@ -5,7 +5,7 @@
\title{Comparison}
\usage{
.compare(y, cutoff, X, alpha = 1, nfolds = 5, foldid = NULL,
type.measure = "deviance")
type.measure = "deviance", trial = FALSE)
}
\arguments{
\item{y}{continuous response\strong{:}
......@@ -29,6 +29,8 @@ or \code{NULL} (balance)}
\item{type.measure}{loss function for binary classification
(linear regression uses the deviance)}
\item{trial}{logical}
}
\description{
Compares models for a continuous response with a cutoff value
......
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