search for: nn3

Displaying 5 results from an estimated 5 matches for "nn3".

Did you mean: nn
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 Jun 23
1
Problems creating packages.
...############################################################## # # 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 of numerical vectors} \des...
2009 Jun 02
2
What do you think about my function?
...########## 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.numeric(wekt_...
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 operator...
2010 Aug 16
0
Help for using nnet in R for NN training and testing
...7","x18","x19","y") colnames (data ) <? headings xtrain<-data[1:1200,2:20] ytrain<-data[1:1200,21] xtest<-data[1201:2000,2:20] ytest<-data[1201:2000,21] xtrainytrain<-data[1:1200,1:20] sample.int(1200, size=1200, replace = FALSE, prob = NULL) ir.nn3<-nnet(xtrain[samp,], xtrainytrain[samp,], size =10, rang = 0.1,decay=5e-4,maxit=1000) ******************************************************************* I am not sure if the sample.int function I used is correct. On running the above code I get a following results in R : %# weights: 420 %initi...