Using r and weka. How can I use meta-algorithms with the n-nold valuation method?

Here is an example of my problem

library(RWeka)
iris <- read.arff("iris.arff")

Run nfolds to get the correct classifier accuracy.

m<-J48(class~., data=iris)
e<-evaluate_Weka_classifier(m,numFolds = 5)
summary(e)

The results are obtained by creating a model with a part of the data set and testing it with another part, therefore, provides accurate accuracy

Now I am running AdaBoost to optimize the classifier parameters

m2 <- AdaBoostM1(class ~. , data = temp ,control = Weka_control(W = list(J48, M = 30)))
summary(m2)

The results obtained here were obtained using the same data set for constructing the model, as well as for those used to estimate it, therefore, the accuracy does not reflect the real accuracy of life in which we use other instances to evaluate the model. Nevertheless, this procedure useful for optimizing the constructed model.

, , , n-pold .

+3
1

, _Weka_classifier. __ -, . . :

m<-J48(Species~., data=iris)
e<-evaluate_Weka_classifier(m,numFolds = 5)
summary(m)
e


m2 <- AdaBoostM1(Species ~. , data = iris ,
       control = Weka_control(W = list(J48, M = 30)))
e2 <- evaluate_Weka_classifier(m2,numFolds = 5)
summary(m2)
e2

, evaluate_Weka_classifier() . J48, AdaBoostM1 .

AdaBoost: - " ", . , . , .

, :

id <- sample(1:length(iris$Species),length(iris$Species)*0.5)
m3 <- AdaBoostM1(Species ~. , data = iris[id,] ,
      control = Weka_control(W = list(J48, M=5)))

e3 <- evaluate_Weka_classifier(m3,numFolds = 5)
# true crossvalidation
e4 <- evaluate_Weka_classifier(m3,newdata=iris[-id,])

summary(m3)
e3
e4

, , , randomForest() randomForest. . RWeka.

edit: . subset evaluate_Weka_classifier().

+4

Source: https://habr.com/ru/post/1768209/


All Articles