1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#------------------ # Data Preparation #------------------ #Read datasets #Download the data from http://datascience.esy.es/wp-content/uploads/2018/03/CreditData-1.zip train <- read.csv("Credit_train.csv") test <- read.csv("Credit_test.csv") #Rows and Cols dim(train) dim(test) #Columns name colnames(train) colnames(test) #Show head(train) head(test) #------ # OneR #------ library(OneR) #remove all records with missing values train <- na.omit(train) test <- na.omit(test) #binning the numerical variable train.bin <- optbin(train) #train model.OneR <- OneR(DEFAULT~., data = train.bin, verbose = TRUE) summary(model.OneR) plot(model.OneR) #test pc <-NULL pc <- predict(model.OneR, test, type = "class") eval_model(pc,test) |
Ejemplo en R OneR
Mapa -> Predecir el Futuro (inferir) -> Modelizacion -> Clasificacion -> Un R -> Ejemplo en R