Displaying 4 results from an estimated 4 matches for "pimaindiansdiabetes2".
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)
KNN=ipredknn(diabetes~glucose+insulin,data=dane,subset=zbior.uczacy,k=3)
KNN=ipredknn(diabetes~glucose+insulin,data=dane,subset=zbior.uczacy,k=3)
b=...
2009 Oct 27
1
"ipredknn" - How may I find values?
Hi everybody!
I want to find a closer neighbourins observation. This is my 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)
klasyfikatorKNN=ipredknn(diabetes~glucose+insulin,data=dane,subset=zbior.uczacy,k=3)
oceny=predict(klasyfikatorKNN,dane[-zbior.uczacy,],"class&q...
2009 May 12
1
questions on rpart (tree changes when rearrange the order of covariates?!)
...growing phase. The second tree is a
little different from the first one. The misclassification tables are
different too. I did not change the data, but why the results are so
different?
Does anyone know how rpart deal with ties?
Here is the codes for running the two trees.
library(mlbench)
data(PimaIndiansDiabetes2)
mydata<-PimaIndiansDiabetes2
library(rpart)
fit2<-rpart(diabetes~., data=mydata,method="class")
plot(fit2,uniform=T,main="CART for original data")
text(fit2,use.n=T,cex=0.6)
printcp(fit2)
table(predict(fit2,type="class"),mydata$diabetes)
## misclassifcation tabl...
2009 May 22
1
bug in rpart?
...e fitted values if the decisions are the
same at each step? Why the same structured trees have different observations
on the nodes?
The source code for running the diabetes data example and the output of
trees are attached. Your professional opinion is very much appreciated.
library(mlbench)
data(PimaIndiansDiabetes2)
mydata<-PimaIndiansDiabetes2
library(rpart)
fit2<-rpart(diabetes~., data=mydata,method="class")
plot(fit2,uniform=T,main="CART for original data")
text(fit2,use.n=T,cex=0.6)
printcp(fit2)
table(predict(fit2,type="class"),mydata$diabetes)
## misclassifcation tabl...