This part provides nearest neighbour based methods for predicting decision values/classes of new datasets. In other words, by supplying a decision table as training data, we can predict decision values of new data at the same time. We have considered the following methods:

  •  C.FRNN.FRST: The fuzzy-rough nearest neighbors based on Jensen and Cornelis' technique.

R> #############################################################
R> ## In this example, we are using Iris dataset.
R> ## It should be noted that since the values of the decision attribute
R> ## are strings, they should be transformed into numeric values using unclass()
R> #############################################################
R> data(iris)
R> ## shuffle the data
R> set.seed(2)
R> irisShuffled <- iris[sample(nrow(iris)),]
R> ## transform values of the decision attribute into numerics
R> irisShuffled[,5] <- unclass(irisShuffled[,5])
R> ## split the data into training and testing data
R> iris.training <- irisShuffled[1:105,]
R> iris.testing <- irisShuffled[106:nrow(irisShuffled),1:4]
R> colnames(iris.training) <- c("Sepal.Length", "Sepal.Width", "Petal.Length",
+ "Petal.Width", "Species")
R> ## convert into a standard decision table
R> decision.table <- SF.asDecisionTable(dataset = iris.training, decision.attr = 5,
+ indx.nominal = c(5))
R> tst.iris <- SF.asDecisionTable(dataset = iris.testing)


R> ###### FRNN algorithm using lower/upper approximation:
R> ###### Implicator/tnorm based approach
R> control <- list(type.LU = "implicator.tnorm", k = 20,
+ type.aggregation = c("t.tnorm", "lukasiewicz"),
+ type.relation = c("tolerance", "eq.1"), t.implicator = "lukasiewicz")

R> res.1 <- C.FRNN.FRST(decision.table = decision.table, newdata = tst.iris,
+ control = control)

R> ###### FRNN algorithm using VQRS
R> control <- list(type.LU = "vqrs", k = 20, q.some = c(0.1, 0.6),
+ q.most = c(0.2, 1), type.relation = c("tolerance", "eq.1"),
+ type.aggregation = c("t.tnorm","lukasiewicz"))

R> res.2 <- C.FRNN.FRST(decision.table = decision.table, newdata = tst.iris,
+ control = control)


  • C.FRNN.O.FRST: The fuzzy-rough ownership nearest neighbour algorithm based on Sarkar's method.

R> #############################################################
R> ## In this example, we are using Iris dataset.
R> ## It should be noted that since the values of the decision attribute are strings,
R> ## they should be transformed into numeric values using unclass()
R> #############################################################
R> data(iris)
R> ## shuffle the data
R> set.seed(2)
R> irisShuffled <- iris[sample(nrow(iris)),]
R> ## transform values of the decision attribute into numerics
R> irisShuffled[,5] <- unclass(irisShuffled[,5])
R> ## split the data into training and testing data
R> iris.training <- irisShuffled[1:105,]
R> iris.testing <- irisShuffled[106:nrow(irisShuffled),1:4]
R> ## convert into the standard decision table
R> colnames(iris.training) <- c("Sepal.Length", "Sepal.Width", "Petal.Length",
+ "Petal.Width", "Species")


R> decision.table <- SF.asDecisionTable(dataset = iris.training, decision.attr = 5,
+ indx.nominal = c(5))

R> tst.iris <- SF.asDecisionTable(dataset = iris.testing)
R> ## in this case, we are using "gradual" for type of membership
R> control <- list(m = 2)


R> res.test.FRNN.O <- C.FRNN.O.FRST(decision.table = decision.table,
+ newdata = tst.iris, control = control)