Displaying 20 results from an estimated 3000 matches similar to: "ROC plot for KNN"
2011 Sep 08
1
error in knn: too many ties in knn
Hello.
I found the behavior of knn(
http://stat.ethz.ch/R-manual/R-devel/library/class/html/knn.html) function
looking very strange.
Consider the toy example.
> library(class)
> train <- matrix(nrow=5000,ncol=2,data=rnorm(10000,0,1))
> test <- matrix(nrow=10,ncol=2,data=rnorm(20,0,1))
> cl <- rep(c(0,1),2500)
> knn(train,test,cl,1)
[1] 1 1 0 0 1 0 1 1 0 1
Levels: 0 1
It
2006 Jun 07
1
knn - 10 fold cross validation
Hi,
I was trying to get the optimal 'k' for the knn. To do this I was using the following function :
knn.cvk <- function(datmat, cl, k = 2:9) {
datmatT <- (datmat)
cv.err <- cl.pred <- c()
for (i in k) {
newpre <- as.vector(knn.cv(datmatT, cl, k = i))
cl.pred <- cbind(cl.pred, newpre)
cv.err <- c(cv.err, sum(cl != newpre))
}
2007 Apr 11
1
Function knn.dist from knnflex library
Hello,
I am feeling that this question can have a very simple answer, but I
can't find it.
I need to use the function knn.dist from knnflex library.
Whatever I try, I get the error:
Error in as.vector.dist(x, "character") : unused argument(s) ("character")
First example:
> a<-NULL
> a<-rbind(a,c(5.2,-8.1))
> a<-rbind(a,c(8.8,-16.1))
>
2008 Oct 29
1
Help with impute.knn
ear all,
This is my first time using this listserv and I am seeking help from the
expert. OK, here is my question, I am trying to use impute.knn function
in impute library and when I tested the sample code, I got the error as
followingt:
Here is the sample code:
library(impute)
data(khanmiss)
khan.expr <- khanmiss[-1, -(1:2)]
## ## First example
## if(exists(".Random.seed"))
2011 Aug 31
8
!!!function to do the knn!!!
hi, r users
i have a problem with KNN.
i have 2 datasets, X0 and X1.
>dim(X0)
>1471*13
dim(X1)
>5221*13
and for every instances in the dataset X1, i want to find the nearest
neighbour(1nn) in the dataset X0.
and i dont have the true classifications of dataset X1.
but the function knn() need true classifications(cl) to do prediction.
i just curious if there are some other function
2004 May 05
1
Segfault from knn.cv in class package (PR#6856)
The function knn.cv in the class package doesn't have error checking to
ensure that the length of the classlabel argument is equal to the number
of rows in the test set. If the classlabel is short, the result is often
a segfault.
> library(class)
> dat <- matrix(rnorm(1000), nrow=10)
> cl <- c(rep(1,5), rep(2,5))
> cl2 <- c(rep(1,5), rep(2,4))
> knn.cv(dat, cl)
[1] 2
2005 Jul 06
1
Error message NA/NaN/Inf in foreign function call (arg 6) when using knn()
I am trying to use knn to do a nearest neighbor classification. I tried using my dataset and got an error message so I used a simple example to try and understand what I was doing wrong and got the same message. Here is what I typed into R:
try
[,1] [,2] [,3] [,4]
r "A" "A" "T" "G"
r "A" "A" "T" "G"
f
2008 Sep 19
3
How to do knn regression?
Hello,
I want to do regression or missing value imputation by knn. I searched
r-help mailing list. This question was asked in 2005. ksmooth and loess
were recommended. But my case is different. I have many predictors (p>20)
and I really want try knn with a given k. ksmooth and loess use band width to define
neighborhood size. This contrasts to knn's variable band width via fixing
a
2005 Oct 06
1
how to use tune.knn() for dataset with missing values
Hi Everybody,
i again have the problem in using tune.knn(), its giving an error saying
missing values are not allowed.... again here is the script for
BreastCancer Data,
library(e1071)
library(mda)
trdata<-data.frame(train,row.names=NULL)
attach(trdata)
xtr <- subset(trdata, select = -Class)
ytr <- Class
bestpara <-tune.knn(xtr,ytr, k = 1:25, tunecontrol = tune.control(sampling
2011 Mar 02
2
*** caught segfault *** when using impute.knn (impute package)
hi,
i am getting an error when calling the impute.knn
function (see the screenshot below).
what is the problem here and how can it be solved?
screenshot:
##################
*** caught segfault ***
address 0x513c7b84, cause 'memory not mapped'
Traceback:
1: .Fortran("knnimp", x, ximp = x, p, n, imiss = imiss, irmiss,
as.integer(k), double(p), double(n), integer(p),
2009 Mar 19
1
Prediction-class ROCR
Hi,
I'm involved in a bioinformatics project at my university, and we're doing a comparison paper between some methods of classification of nc-RNA. I've been encharged of ploting the ROC curves' graphs. But I'm new on working with R and I'm having some difficulty with the prediction-class. I don't get where the values of ROCR.simple$predictions, for example, came from
2005 Mar 21
1
How to do knn regression
How can I do a simple k nearest neighbor regression in R? My training
data have 1 predictor and 1 outcome, both are numeric. I also need to
use FPE and SC to find the optimal model. I know there is knn() in
class package, but it's for knn classification. I also find a kknn
package. What function should I use?
Thanks in advance!
Menghui
2005 Mar 15
1
KNN one factor predicting problem
Could anybody help me out please?
> cl<-as.factor(traindata[,13])
> knn(traindata[1:295,2], newdata[1:32,2], cl,k=2,
prob=TRUE)
Error in knn(traindata[1:295, 2], newdata[1:32, 2],
cl, k = m, prob = TRUE) :
Dims of test and train differ
Both traindata and newdata have 13 elements. Only one
of the first 12 elemnets is needed to predict the 13
element.
What's the problem of
2008 Aug 11
1
question about knn
Hello all,
am a newby in R,
am trying the knn function, and am doing just a stupid test :
> knn(c(1,2,3,4,5,6), c(3), k=4 ,prob=TRUE,factor(c(1:6)))
the result is unstable !! i have each time different result :
[1] 5
attr(,"prob")
[1] 0.1666667
Levels: 1 2 3 4 5 6
[1] 4
attr(,"prob")
[1] 0.1666667
Levels: 1 2 3 4 5 6
[1] 1
attr(,"prob")
[1] 0.1666667
Levels:
2005 Dec 15
3
Name conflict between Epi and ROC packages
The name conflicts in Epi and ROC packages (2 'ROC' functions are the
problem) cause the following code
to work once, but not twice:
library(MASS); data(cats);
x = cats[,2]
y = ifelse(cats[,1]=='F',0,1)
library(Epi); ROC(x,y,grid=0)$AUC
library(ROC); AUC(rocdemo.sca(y, x, dxrule.sca))
What is the standard way of resolving name conflicts? Ask maintainers to
resolve
2004 Mar 29
1
Interpreting knn Results
Maybe you should show your colleague how to access help pages in R? Right
in ?knn, it says:
prob: If this is true, the proportion of the votes for the winning
class are returned as attribute 'prob'.
so 1.0 mean all three NNs are of the `winning'; i.e., predicted, class, and
0.66667 means 2 out of the 3 NNs are of the winning class, etc.
Andy
> From: Ko-Kang
2011 Mar 29
1
plotting several ROC curves on the same graph
Hello
I am trying to make a graph of 10 different lines built each from 4
different
segments and to add a darker line that will represent the average of all
graphs
- all in the same plot.Actually each line is a ROC plot
The code I'm using for plotting one line is as follows:
logit.roc.plot <- function(r, title="ROC curve") {
old.par <- par(no.readonly = TRUE);
2006 Mar 20
1
How to compare areas under ROC curves calculated with ROC R package
I might be missing something but I thought that AUC was a measure for
comparing ROC curves, so there is nothing else needed to "compare" them. The
larger AUC is the higher correlation of 2 variables compared. No other
measures or calculations are needed.
Jarek Tuszynski
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On
2007 Dec 31
2
help on ROC analysis
Dear all,
Some functions like 'ROC(Epi)' can be used to perform ROC analyssi, but it
needs us to specify the fitting model in the argument. Now i have got the
predicted p-values (0,1) for the 0/1 response variable using some other
approach, see the following example dataset:
id mark predict.pvalue
1 1 0.927
2 0 0.928
3 1 0.928
..................
2005 Sep 22
2
Survey of ROC AUC / wilcoxon test functions
Hi,
I was lately debugging parts of my 'colAUC' function in caTools package, and
in a process looked into other packages for calculating Areas Under ROC
Curves (AUC). To my surprise I found at least 6 other functions:
* wilcox.test
* AUC from ROC package,
* performance from ROCR package,
* auROC from limma package,
* ROC from Epi package,
* roc.area from verification