Displaying 2 results from an estimated 2 matches for "zbior".
2010 Mar 09
1
create picture (k -the nearest neighbours)
...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= ifelse((a==1),'red','blue' )
a=as.numeric(KNN$learn$y)
plot(KNN$learn$X[,1], KNN$learn$X...
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")
#data frames with my result from klasyfikatorKNN
df=data.frame(glucose=c(klasyfikatorKNN$learn$X[...