search for: knn1

Displaying 10 results from an estimated 10 matches for "knn1".

Did you mean: knn
2010 May 26
3
cluster analysis and supervised classification: an alternative to knn1?
...s in order to assign a new observation (with the same 10 attributes but not the measure) to a cluster. I want to calculate for the new observation a measure as the average of the meausures M of the observations in the cluster assigned. I would use cluster analysis ( ?Clara? algorithm?) and then ?knn1? (in package class) to assign the new observation to a cluster. The problem is: I?m not able to use ?knn1? because some of attributes are categorical. Do you know something like ?knn1? that works with categorical variables too? Do you have any suggestion? -- View this message in context: htt...
2004 Feb 02
2
Nearest Neighbor Algorithm in R -- again.
...nly accepts 2D data points. Hans Werner Borchers ABB Corporate Research, Germany ________________________________________________________________________ require (class) nearest <- function (X, n, k=3) ## Find k nearest neighbors of X[n, ] in the data frame ## or matrix X, utilizing function knn1 k-times. { N <- nrow(X) # inds contains the indices of nearest neighbors inds <- c(n); i <- 0 while (i < k) { # use knn1 for one index... j <- as.integer(knn1(X [-inds, ], X[n, ], 1:(N-length(inds)))) # ...and change to true index of neighbor...
2004 Jan 27
8
distance between two matrices
Hi all, Say I have a matrix A with dimension m x 2 and matrix B with dimension n x 2. I would like to find the row in A that is closest to the each row in B. Here's an example (using a loop): set.seed(1) A <- matrix(runif(12), 6, 2) # 6 x 2 B <- matrix(runif(6), 3, 2) # 3 x 2 m <- vector("numeric", nrow(B)) for(j in 1:nrow(B)) { d <- (A[, 1] - B[j, 1])^2 + (A[,
2008 Oct 07
2
masking a regular lat/lon grid to extract map boundaries
...the many political boundaries provided by that library, when I move on from Montana to something else... Any suggestion for an algorithm to do this? Of course if someone out there has a high-res mask for the US states I'll happily forget about using map(): I'll take it and interpolate (or knn1) away to my grid! thank you in advance claudia -- Claudia Tebaldi Research Scientist, Climate Central http://www.climatecentral.org
1998 May 11
1
R-beta: C/Fortran function not in load table
...gotten this sort of problem some weeks ago and have solved it with the mailing list archive. But now I have this problem again with the class library. What should I put in library/class/R/zzz.R? Everything I put in that file leads to the same error message. I'm running 0.61.3 on Linux. > knn1(train, test, cl) Error in .C("VR_knn1", as.integer(ntr), as.integer(nte), as.integer(p), : C/Fortran function not in load table Execution halted -Egon -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~...
2002 Jun 12
1
Bagged clustering (package e1071)
...the iris data : data(iris) bc1 <- bclust(iris[,1:4], 3, base.centers=5) I got the following message error : Loading required package: class Committee Member: 1(1) 2(1) 3(1) 4(1) 5(1) 6(1) 7(1) 8(1) 9(1) 10(1)Error in bclust(iris[, 1:4], 3, base.centers = 5) : couldn't find function "knn1" In addition: Warning message: There is no package called `class' in: library(package, char = TRUE, logical = TRUE, warn.conflicts = warn.conflicts, I have looked for the package class at CRAN but I have not found it. Thank you in advance. Aboubakar Maitournam. -.-.-.-.-.-.-.-.-.-.-...
2011 Nov 07
1
Aggregate or extract function ?
Hi R user, I have two dataframe with different variables and coordinates : X Y sp bio3 bio5 bio6 bio13 bio14 1 -70.91667 -45.08333 0 47 194 -27 47 12 2 -86.58333 66.25000 0 16 119 -345 42 3 3 -62.58333 -17.91667 0 68 334 152 144 28 4 -68.91667 -31.25000 0 54 235 -45 25 7 5 55.58333 48.41667 0 23 319 -172 23 14 6 66.25000
2008 Mar 12
4
Distances between two datasets of x and y co-ordinates
Hi all I am trying to determine the distances between two datasets of x and y points. The number of points in dataset One is very small i.e. perhaps 5-10. The number of points in dataset Two is likely to be very large i.e. 20,000-30,000. My initial approach was to append the first dataset to the second and then carry out the calculation: dists <- as.matrix(dist(gis data from 2 * datasets))
2009 Jun 29
0
Naive knn question
...ta set test.data = rbind(comm.data[clust.data$medoids,],comm.data2) #get the distance matrix for the validation data test.dist = dist(test.data[-1]) test.dist.matrix = as.matrix(test.dist, rownames.force = TRUE) write.matrix(test.dist.matrix, file = "tested.dist.csv", sep = ",") knn1 = knn(test.dist.matrix[7:25,], clust.data$mediods, factor(c("1","2","3","4","5","6")), k = 3) Perhaps I am incorrect in thinking that I can use knn to distinguish distances between the training data mediods and the validation data, but I...
2003 Jul 30
3
nested for() loops for returning a nearest point
I'm trying to do the following: For each ordered pair of a data frame (D1) containing longitudes and latitudes and unique point IDs, calculate the distance to every point in another data frame (D2) also containing longitudes, latitudes and point IDs, and return to a new variable in D1 the point ID of the nearest element of D2. Dramatis personae (mostly self-explanatory): D1$long