rm(list=ls())
setwd("/yourpath/codes")


# Denoeux E-knn
source("./knn_belief_fusion.r")
iris <- read.table(file="iris.data",sep=",")

train <- data.matrix(rbind(iris[1:25,1:4],iris[51:75,1:4],iris[101:125,1:4]))
trainLabel <- c(rep(1,25), rep(2,25), rep(3,25))

test <- data.matrix(rbind(iris[26:50,1:4],iris[76:100,1:4],iris[126:150,1:4]))
trueLabel <- c(rep(1,25), rep(2,25), rep(3,25)) #trainLabel

res <- knn_belief_fusion(train,trainLabel,test,trueLabel,k=3)
res$matr_sort_classif # bbas: mass only on focal elements




# Appriou models
resTrain <- knn_belief_fusion(train,trainLabel,train,trueLabel,k=3)
resTrain$matr_conf

mat_conf <- resTrain$matr_conf[[1]]
mat_conf=cbind(c(68, 12, 22),c(9, 42, 5),c( 8, 2, 87))

source("./buildBbas.r")
res <- knn_belief_fusion(train,trainLabel,test,trueLabel,k=3)
bbas=buildBbas(res$findLabel,mat_conf,alpha=0.95,model=1)
  