r - Number of predictions in each run must be equal to the number of labels for each run -
i trying detect best auc using genetic algorithm in r. here code:
library(ga) library(rocr) realresult <- sample( c(t,f), 350, replace=true, prob=c( 0.5, 0.5) ) aucfitness<-function(scores){ res<-prediction(scores, realresult, label.ordering = null) auc.tmp <- performance(res,"auc"); auc <- as.numeric(auc.tmp@y.values) # print(paste0("auc is: ",auc)) auc } min <- 0.000654226 max <- 9433.873 ga <- ga(type = "real-valued", fitness = aucfitness, min = min, max = max, monitor = false,popsize = 350) summary(ga) but in line ga complains :
error in prediction(scores, realresult, label.ordering = null) : number of predictions in each run must equal number of labels each run. as see, have size of realresult 350 , popsize = 350, shouldn't face error
Comments
Post a Comment