I am trying to do prediction using kNN
regression in R. I have two variable (X,Y) in excel table format (total 800 data-sets in each variable). My aim is to predict the value of Y
(present in Test table) So for that I have written code in R as follows,
Table <-read.csv("Table.csv")
Y <-Table[1,];X <-Table[2,];
data_norm<-function(x){((x-min(x))/(max(x)-min(x)))}
Table_norm<-as.data.frame(laaply(Table),data_norm)
Train<-Table(1:30)
Test<-Table(31:49)
library(class)
ypred= <-knn(TRain,Test,Test[1:30,1],k=20)
I have attached the sample of data in Table format attached here3
While doing so I am getting the following error, 'Error in laaply(Table) : could not find function "laaply"
'. The information about laaply
is here.
I want to use above Table 1st 3o data points for training the kNN model and then rest of data points to predict the value of Y for given x
I did all search and try to solve such problem but not able to solve this problem.