Displaying 20 results from an estimated 900 matches similar to: "lda (MASS)"
2013 Mar 23
1
LOOCV over SVM,KNN
Good afternoon.
I would like to know if there is any function in R to do LOOCV with these
classifiers:
1)SVM
2)Neural Networks
3)C4.5 ( J48)
4)KNN
Thanks a lot!
[[alternative HTML version deleted]]
2011 Jul 25
1
Problem with random number simulation
Hi this is my first post. I am trying to run a simulation for a computer
playing Von Neumann poker and adjusting it's expectation of an opponent's
behavior according to how the opponent plays. This program involves random
generation of "hands" and shifting of parameters. However, when I run the
code, no errors come up, but the program doesn't do anything. Could someone
2004 Jul 26
1
do.call and double-colon access
Using R 2.0.0 of July 20 2004
train, test, and cl as defined in example(knn),
we have
> search()
[1] ".GlobalEnv" "package:methods" "package:stats" "package:graphics"
[5] "package:utils" "Autoloads" "package:base"
> knn(train, test, cl, k=3)
Error: couldn't find function "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
2000 Jan 10
1
'at' parameter in mtext(.., adj=0, outer=T) (PR#396)
Depending on the setting of par()$usr,
the 'at' setting in mtext(.., adj=0, outer=T) may cause the
text to appear in an anomalous position (e. g. in the first
instance below, at the left of the plot region rather than
at 'at=0' in the figure region), or the text may not appear
at all.
If one does not set the 'at' parameter the text appears
(with 'adj=0') on the
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))
}
2013 Mar 22
1
Trouble embedding functions (e.g., deltaMethod) in other functions
Dear R community,
I've been writing simple functions for the past year and half and have come
across a similar problem several times. The execution of a function within
my own function produces NaN's or fails to execute as intended. My conundrum
is that I can execute the function outside of my function without error, so
it's difficult for me, as a novice functioneer, to figure out
2010 Mar 09
1
create picture (k -the nearest neighbours)
Hi
I want to create a nice picture about my result of k -the nearest neighbours
algorithm. Here is my easy code:
#################################
library(klaR)
library(ipred)
library(mlbench)
data(PimaIndiansDiabetes2)
dane=na.omit(PimaIndiansDiabetes2)[,c(2,5,9)]
dane[,2]=log(dane[,2])
dane[,1:2]=scale(dane[,1:2])
zbior.uczacy=sample(1:nrow(dane),nrow(dane)/2,F)
1999 Nov 22
1
variance?,...
hi
I'm learning R and making some examples.
One of them is that for given distribution
I show density function, distribution function
expected value and variance(?).
I know
EX <- function(xval,xprob) sum( (xval*xprob) );
where xval is vector of values and xprob vector of probabalities,
but
DX <- function(xval,xprob) EX((xval^2),xprob) - (EX(xval,xprob))^2;
doesn't work as I
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))
>
2009 Jun 09
3
rpart - the xval argument in rpart.control and in xpred.rpart
Dear R users,
I'm working with the rpart package and want to evaluate the performance of
user defined split functions.
I have some problems in understanding the meaning of the xval argument in
the two functions rpart.control and xpred.rpart. In the former it is defined
as the number of cross-validations while in the latter it is defined as the
number of cross-validation groups. If I am
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
2008 Sep 06
0
New caret packages
New major versions of the caret packages (caret 3.37, caretLSF 1.23 and
caretNWS 0.23) have been uploaded to CRAN.
caret is a package for building and evaluating a wide variety of predictive
models. There are functions for pre-processing, tuning models using
resampling, visualizing the results, calculating performance and estimating
variable importance. caretNWS and caretLSF are two parallel
2008 Sep 06
0
New caret packages
New major versions of the caret packages (caret 3.37, caretLSF 1.23 and
caretNWS 0.23) have been uploaded to CRAN.
caret is a package for building and evaluating a wide variety of predictive
models. There are functions for pre-processing, tuning models using
resampling, visualizing the results, calculating performance and estimating
variable importance. caretNWS and caretLSF are two parallel
2009 Sep 23
0
ROCR.plot methods, cross validation averaging
Dear R-help and ROCR developers (Tobias Sing and Oliver Sander) -
I think my first question is generic and could apply to many methods,
which is why I'm directing this initially to R-help as well as Tobias and Oliver.
Question 1. The plot function in ROCR will average your cross validation
data if asked. I'd like to use that averaged data to find a "best" cutoff
but I
2010 Mar 12
1
using xval in mvpart to specify cross validation groups
Dear R's
I'm trying to use specific rather than random cross-validation groups
in mvpart.
The man page says:
xval Number of cross-validations or vector defining cross-validation groups.
And I found this reply to the list by Terry Therneau from 2006
The rpart function allows one to give the cross-validation groups explicitly.
So if the number of observations was 10, you could use
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 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"))
2009 Apr 25
1
Overlapping parameters "k" in different functions in "ipred"
Dear List,
I have a question regarding "ipred" package. Under 10-fold cv, for different knn ( = 1,3,...25), I am getting same misclassification errors:
#############################################
library(ipred)
data(iris)
cv.k = 10 ## 10-fold cross-validation
bwpredict.knn <- function(object, newdata) predict.ipredknn(object, newdata, type="class")
for (i in
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