Displaying 4 results from an estimated 4 matches for "cvnn1".
Did you mean:
cvnn2
2004 Sep 23
0
nnet with weights parameter: odd error
Dear R-users
I use nnet for a classification (2 classes) problem. I use the code
CVnn1, CVnn2 as described in V&R.
The thing I changed to the code is: I define the (class) weight for each
observation in each cv 'bag' and give the vector of weights as parameter
of nnet(..weights = weight.vector...)
Unfortunately I get an error during some (but not all!) inner-fold cv...
2004 Mar 30
1
classification with nnet: handling unequal class sizes
...<- as.numeric(as.factor((predict(learn, data[ri ==
i,], type = "class"))))
for (k in 1:dim(rae.matrix)[1]) {
if (rae.vector[k] == 1) rae.matrix[k,1] <- rae.matrix[k,1] + 1
else
rae.matrix[k,2] <- rae.matrix[k,2] + 1
}
rae.matrix
}
CVnn1 <- function(formula, data, nreps=1, ri, verbose, ...)
{
totalerror <- 0
truth <- data[,deparse(formula[[2]])]
res <- matrix(0, nrow(data), length(levels(truth)))
if(verbose > 20) cat(" inner fold")
for (i in sort(unique(ri))) {...
2011 Jan 05
0
Nnet and AIC: selection of a parsimonious parameterisation
...;AIC ) {
cat('\n j',j,'AIC'=AIC.tmp,'AIC_1',AIC,'\n')
break
} else {
nn=nn.tmp; AIC=AIC.tmp; RSS=RSS.tmp
}
}
list(choice=sqrt(RSS/100),nparam=sum(nn$wts!=0),AIC=AIC,nn=nn)
}
#Modified function for optimisation
CVnn1 <- function(decay, formula, data, nreps=1, ri, size, linout, skip,
maxit, optimFlag=FALSE, alpha) {
truth <- log10(data$perf)
nn <- nnet(formula, data[ri !=1,], trace=FALSE, size=size, linout=linout,
skip=skip, maxit=maxit, Hess = TRUE)
RSS=(alpha-1)*sum((truth[ri != 1] - pre...
2004 Sep 23
0
nnet and weights: error analysis using V&R example
...ce = T)
fgl1 <- fgl
fgl1[1:9] <- lapply(fgl[, 1:9], function(x) {r <- range(x); (x -
r[1])/diff(r)})
CVnn2 <- function(formula, data,
size = c(0,4,4,10,10), lambda = c(0, rep(c(0.001,
0.01),2)),
nreps = 1, nifold = 5, verbose = 99, ...)
{
CVnn1 <- function(formula, data, nreps=1, ri, verbose, ...)
{
totalerror <- 0
truth <- data[,deparse(formula[[2]])]
res <- matrix(0, nrow(data), length(levels(truth)))
if(verbose > 20) cat(" inner fold")
for (i in sort(unique(r...