Displaying 20 results from an estimated 20 matches for "nn2".
Did you mean:
nb2
2009 Feb 18
1
Training nnet in two ways, trying to understand the performance difference - with (i hope!) commented, minimal, self-contained, reproducible code
...nonspam spam
nonspam 778 43
spam 63 496
# Calucate overall error percentage ~ 7.68%
>(nn1.test.perf <- 100 * (nn1.test.tab[2] + nn1.test.tab[3]) / sum(nn1.test.tab))
[1] 7.68116
## Example 2 - code based on rattles log script
# train artifical neural network
>nn2<-nnet(as.numeric(type)-1~., data=spam.train, size=3, decay=0.1, maxit=1000)
# predict spam.test dataset on nn2.
# ?predict.nnet does have the parameter type='class', but i can't use
that here as an option
>nn2.pr.test <- predict(nn2, spam.test)
[,1]
3 0.984972...
2006 Sep 11
2
Translating R code + library into Fortran?
...]
max.shape=quantile(cor.shape,seq(0,1,.05))[20]
#re-train nets to reduced parameter space
training.data=data.gen(1e4,min.obs.samples,max.obs.samples,min.shift,max.shift,min.scale,max.scale,min.shape,max.shape)
#train nn.shift with error checking
ok=F
while(ok==F){
nn2.shift=nnet(exp.shift~min+q1+med+mean+q3+max+samples,data=training.data,size=8,linout=T,rang=1e-08,maxit=500,trace=F)
cor.shift=predict(nn2.shift,training.data[,c(1:7)],type="raw")
temp=hist(cor.shift,plot=F)
if(length(temp$counts[temp$counts>0])>10){...
2003 Jul 16
1
Help on NNET
Hi, Dear all,
I am just starting using R in my work and got some trouble to figure out some of the errors. Can anybody help me?
The following is the script:
read.csv('pupil.txt',header=TRUE,sep='\t')->pupil
samp<-c(1:50, 112:162, 171:220, 228:278)
pupil.nn2 <- nnet(Type ~ ., data = pupil, subset = samp, size = 2, rang = 0.1, decay = 5e-4, maxit = 200)
table(pupil$Type[-samp], predict(pupil.nn2, pupil[-samp,], type = "class"))
After running this, I got error information as
#Error in switch(type, raw = z, class = { :
# inappropria...
2005 Jul 27
1
how to get actual value from predict in nnet?
...just give me the label(either "N" or "P")? Thanks!
FYI: The nnet example I followed from help document is,
ird <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),
species = c(rep("s",50), rep("c", 50), rep("v", 50)))
ir.nn2 <- nnet(species ~ ., data = ird, subset = samp, size = 2, rang = 0.1,
decay = 5e-4, maxit = 200)
table(ird$species[-samp], predict(ir.nn2, ird[-samp,], type = "class"))
Best regards,
Baoqiang Cao
2011 Jun 14
1
heatmap with values
Hi!
I'm displaying a contingency table with heatmap():
> svm.predPix.tabla
svm.predPix CC DD LL NN NN2
CC 22 0 3 8 3
DD 0 27 0 1 0
LL 1 1 90 3 7
NN 2 0 1 11 4
NN2 0 0 5 1 20
> heatmap(svm.predPix.tabla[5:1,], Rowv=NA, Colv=NA,col =
rev(heat.colors(32)), scale="column", margins=c(5,10))
and I'm happy with the pl...
2008 Jun 12
1
About Mcneil Hanley test for a portion of AUC!
...an only find the value of "r" for the whole AUC's .
> seROC<-function(AUC,na,nn){
> a<-AUC
> q1<-a/(2-a)
> q2<-(2*a^2)/(1+a)
> se<-sqrt((a*(1-a)+(na-1)*(q1-a^2)+(nn-1)*(q2-a^2))/(nn*na))
> se
> }
>
> cROC<-function(AUC1,na1,nn1,AUC2,na2,nn2,r){
> se1<-seROC(AUC1,na1,nn1)
> se2<-seROC(AUC2,na2,nn2)
>
> sed<-sqrt(se1^2+se2^2-2*r*se1*se2)
> zad<-(AUC1-AUC2)/sed
> p<-dnorm(zad)
> a<-list(zad,p)
> a
Could somebody kindly suggest me how to calculate the value of "r" or
some ways to calcul...
2012 Jul 24
3
Nearest Neighbors
I was wondering if there is a way in R to find k nearest neighbors of various
orders, say order 2, 3, or 4. In otherwords neighbors of neighbors of
neighbors. You get the idea. I know that I can use knearneigh(matrix.data,
k) but this only gives me the k nearest neighbors and not of a particular
order.
Thanks in advance.
--
View this message in context:
2006 Mar 15
1
How to compare areas under ROC curves calculated with ROCR package
...following program I found on R-help archives :
From: Bernardo Rangel Tura
Date: Thu 16 Dec 2004 - 07:30:37 EST
seROC<-function(AUC,na,nn){
a<-AUC
q1<-a/(2-a)
q2<-(2*a^2)/(1+a)
se<-sqrt((a*(1-a)+(na-1)*(q1-a^2)+(nn-1)*(q2-a^2))/(nn*na))
se
}
cROC<-function(AUC1,na1,nn1,AUC2,na2,nn2,r){
se1<-seROC(AUC1,na1,nn1)
se2<-seROC(AUC2,na2,nn2)
sed<-sqrt(se1^2+se2^2-2*r*se1*se2)
zad<-(AUC1-AUC2)/sed
p<-dnorm(zad)
a<-list(zad,p)
a
}
The author of this script says: "The first function (seROC) calculate the standard error of ROC curve, the
second function (cROC)...
2006 Mar 20
1
How to compare areas under ROC curves calculated with ROC R package
...following program I found on R-help archives :
From: Bernardo Rangel Tura
Date: Thu 16 Dec 2004 - 07:30:37 EST
seROC<-function(AUC,na,nn){
a<-AUC
q1<-a/(2-a)
q2<-(2*a^2)/(1+a)
se<-sqrt((a*(1-a)+(na-1)*(q1-a^2)+(nn-1)*(q2-a^2))/(nn*na))
se
}
cROC<-function(AUC1,na1,nn1,AUC2,na2,nn2,r){
se1<-seROC(AUC1,na1,nn1)
se2<-seROC(AUC2,na2,nn2)
sed<-sqrt(se1^2+se2^2-2*r*se1*se2)
zad<-(AUC1-AUC2)/sed
p<-dnorm(zad)
a<-list(zad,p)
a
}
The author of this script says: "The first function (seROC) calculate the
standard error of ROC curve, the
second function (cROC)...
2006 Jun 23
1
Problems creating packages.
...file format:
###########################################################################
#
# Freq function returns the frequencies of numerical vectors
#
###########################################################################
freq = function(x1,x2,x3){
nn1=rep(0, length(x))
nn2=rep(0, length(x))
nn3=rep(0, length(x))
for ( i in 1:length(x)){
nn1[i]=sum(x[i]==x1)
nn2[i]=sum(x[i]==x2)
nn3[i]=sum(x[i]==x3)
}
mm = as.matrix(rbind(nn1,nn2,nn3))
mm
}
Here is a sample man page format:
\name{freq}
\alias{freq}
\title{Frequencies...
2009 Jun 02
2
What do you think about my function?
...ake!)
########## My function #############################################
dzieci<-transform(dzieci, zywnosc=0)
zywnoscCalosc<- function( jedzenie, sklep, n1, n2, n3, n4, d1, d2, d3, d4 )
{
skl <- sklep
wynik <- vector()
wynik <- jedzenie
ndf <- data.frame(nn1=n1,nn2=n2,nn3=n3,nn4=n4)
ddf <- data.frame(dd1=d1,dd2=d2,dd3=d3,dd4=d4)
for (i in 1:length(n1)){
wekt_n = ndf[i,]
wekt_d = ddf[i,]
wekt_n_ok = wekt_n[!is.na(wekt_n)]
wekt_n_ok = as.numeric(wekt_n_ok)
wekt_d_ok = wekt_d[!is.na(wekt_d)]
wekt_d_ok = as.numeri...
2009 May 31
1
Error:non-numeric argument in my function
Hello!
I have a function:
zywnoscCalosc<- function( jedzenie, n1, n2, n3, n4, d1, d2, d3, d4 ) {
ndf <- data.frame(nn1=n1,nn2=n2,nn3=n3,nn4=n4)
ddf <- data.frame(dd1=d1,dd2=d2,dd3=d3,dd4=d4)
for (i in 1:length(n1)){
wekt_n = ndf[i,]
wekt_n_ok = wekt_n[!is.na(wekt_n)]
dl_n = length(wekt_n_ok)
wynik = (1*wekt_n_ok)/(1*dl_n)
}
}
and I get an error like this:
Error in 1 * wekt_n_ok : non-numeric argument to binary ope...
2009 Oct 28
1
need help explain the routine input parameters for seROC and cROC found in the R archive
...: Bernardo Rangel Tura
> Date: Thu 16 Dec 2004 - 07:30:37 EST
>
> seROC<-function(AUC,na,nn){
> a<-AUC
> q1<-a/(2-a)
> q2<-(2*a^2)/(1+a)
> se<-sqrt((a*(1-a)+(na-1)*(q1-a^2)+(nn-1)*(q2-a^2))/(nn*na))
> se
> }
>
> cROC<-function(AUC1,na1,nn1,AUC2,na2,nn2,r){
> se1<-seROC(AUC1,na1,nn1)
> se2<-seROC(AUC2,na2,nn2)
>
> sed<-sqrt(se1^2+se2^2-2*r*se1*se2)
> zad<-(AUC1-AUC2)/sed
> p<-dnorm(zad)
> a<-list(zad,p)
> a
> }
>
--
Waverley @ Palo Alto
2012 Jun 20
1
nearest neighbours and their ID
Dear R users,
I used nndist() to gain the distance of 2 nearest
neighbours of the points in my dataset. Is there a way of getting the ID numbers
of these nearest neighbours (along with their distances).
The command I used: nn2 <- nndist(X2, k=1:2). This is the output of the nearest neighbour distances I got (the IDs of the given points are there but their IDs aren't). Any help or suggestionsare very much appreciated. > d1to2 [,1] [,2]
[1,] 1.9721585 2.979509
[2,] 1.9342647 1.972158
[3,]...
2011 Jun 03
1
Traversing KD-tree (or equivalent) for radius-based search
...at limit and setting it
to large values makes their execution impractical.
OTOH, as far as I have understood, DBSCAN needs to know all the points
in the eps-neighbourhood, or will create too many clusters, especially
if there are really high-density region, as it happened when I used
RANN's nn2 function in my implementation.
thanks in advance,
Andrea Taverna
2004 Dec 15
3
(no subject)
Dear R-helper,
I would like to compare the AUC of two logistic regression models (same
population). Is it possible with R ?
Thank you
Roman Rouzier
[[alternative HTML version deleted]]
2004 Sep 23
0
nnet and weights: error analysis using V&R example
...cat("error rate = ",
round(100*sum(tab)/length(list(...)[[1]]), 2), "%\n")
invisible()
}
set.seed(123)
rand <- sample(10, dim(fgl)[1], replace = 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 <-...
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 runs:...
2009 Dec 13
6
Company Of Heroes, broke at Wine 1.1.34
Hey there, I'm an unhappy camper since I didn't carefully select my updates to install for Linux, now I'm stuck with the newest wine, which for some reason broke my company of heroes. There is no downgrading Wine on Ubuntu Karmic is there? I have not been able to find package archives so far.
Before, I had 1.1.32, and COH worked perfectly. Now however, it (the game) searches for
2009 Jul 23
1
[PATCH server] changes required for fedora rawhide inclusion.
...p)4O-DIFx%1G$4MvlgE
zNv9 at Pw<}TC!*Ot(83D<o=7)>HmXPm^Yh)<}i`u$qc;~mf4ohc;?(`fKyt6z;z6gV4
z<y8IX1yr;dG%z(LV#-Yde0Un${`}Ohn9Okdjf}Hw9Zo2lTwQoF;3}ebql`A-1irUM
zn$G9kzalTwoH5-TYKw<BEmh;g*d;x?NY0;u&7P>|8*O5F44RFA=G at s9H*hV=$PQ4$
zj)<Z!j~)!l3Nbp?D{8{w8Ti`mp2iI}$XUZCjHd2UKc#SNn2a=p<-poVM(5b;AL*Fn
zEZ&5qBiybmgG+Ot`^dxux~iVrwc(s*rs2gB==P4#n2cCro0&{6N8a<gKm#Qs%1L3v
zP{jcXwD(j4{%qb##ziESGY!;@3zREztcWNEx|ORGcy3<bt=bPfN%rQjmUpdC?e7Q&
z*Tg at doe8DJr%-Q<G6{3e%XfF<PZdVOM()6OInw$)Wf_5Kf>%8vfvgrqzHwTYZDcwG
zT+yYS$DF7U9292XD$<2*4P<@hD1h(cF9REe-of a...